{"id":808103,"url":"http://patchwork.ozlabs.org/api/patches/808103/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170831073054.740462115@linutronix.de/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170831073054.740462115@linutronix.de>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170831073054.740462115@linutronix.de/","date":"2017-08-31T07:16:20","name":"[22/29] lockup_detector: Make watchdog_nmi_reconfigure() two stage","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"afacc4bee8f8c1de9ca75124f9023fd15e06419b","submitter":{"id":180,"url":"http://patchwork.ozlabs.org/api/people/180/?format=json","name":"Thomas Gleixner","email":"tglx@linutronix.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170831073054.740462115@linutronix.de/mbox/","series":[{"id":761,"url":"http://patchwork.ozlabs.org/api/series/761/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=761","date":"2017-08-31T07:16:20","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/761/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808103/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808103/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjZ192NFzz9sRW\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 17:35:57 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xjZ1917CMzDqTy\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 31 Aug 2017 17:35:57 +1000 (AEST)","from Galois.linutronix.de (Galois.linutronix.de\n\t[IPv6:2a01:7a0:2:106d:700::1])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xjYwy0Ps1zDqXk\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 31 Aug 2017 17:32:18 +1000 (AEST)","from localhost ([127.0.0.1] helo=[127.0.1.1])\n\tby Galois.linutronix.de with esmtp (Exim 4.80)\n\t(envelope-from <tglx@linutronix.de>)\n\tid 1dnJvl-0003JE-4a; Thu, 31 Aug 2017 09:30:25 +0200"],"Message-Id":"<20170831073054.740462115@linutronix.de>","User-Agent":"quilt/0.63-1","Date":"Thu, 31 Aug 2017 09:16:20 +0200","From":"Thomas Gleixner <tglx@linutronix.de>","To":"LKML <linux-kernel@vger.kernel.org>","Subject":"[patch 22/29] lockup_detector: Make watchdog_nmi_reconfigure() two\n\tstage","References":"<20170831071558.995235362@linutronix.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=ISO-8859-15","Content-Disposition":"inline;\n\tfilename=lockup_detector--Make-watchdog_nmi_reconfigure---two-stage.patch","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Don Zickus <dzickus@redhat.com>, Chris Metcalf <cmetcalf@mellanox.com>, \n\tPeter Zijlstra <peterz@infradead.org>,\n\tSebastian Siewior <bigeasy@linutronix.de>,\n\tUlrich Obergfell <uobergfe@redhat.com>,\n\tNicholas Piggin <npiggin@gmail.com>, Borislav Petkov <bp@alien8.de>,\n\tAndrew Morton <akpm@linux-foundation.org>, \n\tlinuxppc-dev@lists.ozlabs.org, Ingo Molnar <mingo@kernel.org>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Both the perf reconfiguration and the powerpc watchdog_nmi_reconfigure()\nneed to be done in two steps.\n\n     1) Stop all NMIs\n     2) Read the new parameters and start NMIs\n\nRight now watchdog_nmi_reconfigure() is a combination of both. To allow a\nclean reconfiguration add a 'run' argument and split the functionality in\npowerpc.\n\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: Benjamin Herrenschmidt <benh@kernel.crashing.org>\nCc: Michael Ellerman <mpe@ellerman.id.au>\nCc: Nicholas Piggin <npiggin@gmail.com>\nCc: linuxppc-dev@lists.ozlabs.org\n---\n arch/powerpc/kernel/watchdog.c |   17 +++++++++--------\n include/linux/nmi.h            |    2 ++\n kernel/watchdog.c              |   31 ++++++++++++++++++++++---------\n 3 files changed, 33 insertions(+), 17 deletions(-)","diff":"--- a/arch/powerpc/kernel/watchdog.c\n+++ b/arch/powerpc/kernel/watchdog.c\n@@ -352,17 +352,18 @@ static void watchdog_calc_timeouts(void)\n \twd_timer_period_ms = watchdog_thresh * 1000 * 2 / 5;\n }\n \n-void watchdog_nmi_reconfigure(void)\n+void watchdog_nmi_reconfigure(bool stop)\n {\n \tint cpu;\n \n-\twatchdog_calc_timeouts();\n-\n-\tfor_each_cpu(cpu, &wd_cpus_enabled)\n-\t\tstop_wd_on_cpu(cpu);\n-\n-\tfor_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask)\n-\t\tstart_wd_on_cpu(cpu);\n+\tif (stop) {\n+\t\tfor_each_cpu(cpu, &wd_cpus_enabled)\n+\t\t\tstop_wd_on_cpu(cpu);\n+\t} else {\n+\t\twatchdog_calc_timeouts();\n+\t\tfor_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask)\n+\t\t\tstart_wd_on_cpu(cpu);\n+\t}\n }\n \n /*\n--- a/include/linux/nmi.h\n+++ b/include/linux/nmi.h\n@@ -103,6 +103,8 @@ static inline void arch_touch_nmi_watchd\n #endif\n #endif\n \n+void watchdog_nmi_reconfigure(bool run);\n+\n /**\n  * touch_nmi_watchdog - restart NMI watchdog timeout.\n  *\n--- a/kernel/watchdog.c\n+++ b/kernel/watchdog.c\n@@ -105,17 +105,25 @@ static int __init hardlockup_all_cpu_bac\n int __weak watchdog_nmi_enable(unsigned int cpu) { return 0; }\n void __weak watchdog_nmi_disable(unsigned int cpu) { }\n \n-/*\n- * watchdog_nmi_reconfigure can be implemented to be notified after any\n- * watchdog configuration change. The arch hardlockup watchdog should\n- * respond to the following variables:\n+/**\n+ * watchdog_nmi_reconfigure - Optional function to reconfigure NMI watchdogs\n+ * @stop:\tIf true stop the watchdogs on all enabled CPUs\n+ *\t\tIf false start the watchdogs on all enabled CPUs\n+ *\n+ * The core call order is:\n+ * watchdog_nmi_reconfigure(true);\n+ * update_variables();\n+ * watchdog_nmi_reconfigure(false);\n+ *\n+ * The second call which starts the watchdogs again guarantees that the\n+ * following variables are stable across the call.\n  * - watchdog_enabled\n  * - watchdog_thresh\n  * - watchdog_cpumask\n- * - sysctl_hardlockup_all_cpu_backtrace\n- * - hardlockup_panic\n+ *\n+ * After the call the variables can be changed again.\n  */\n-void __weak watchdog_nmi_reconfigure(void) { }\n+void __weak watchdog_nmi_reconfigure(bool stop) { }\n \n #ifdef CONFIG_SOFTLOCKUP_DETECTOR\n \n@@ -509,10 +517,12 @@ static void softlockup_unpark_threads(vo\n \n static void softlockup_reconfigure_threads(bool enabled)\n {\n+\twatchdog_nmi_reconfigure(false);\n \tsoftlockup_park_all_threads();\n \tset_sample_period();\n \tif (enabled)\n \t\tsoftlockup_unpark_threads();\n+\twatchdog_nmi_reconfigure(true);\n }\n \n /*\n@@ -553,7 +563,11 @@ static inline void watchdog_unpark_threa\n static inline int watchdog_enable_all_cpus(void) { return 0; }\n static inline void watchdog_disable_all_cpus(void) { }\n static inline void softlockup_init_threads(void) { }\n-static inline void softlockup_reconfigure_threads(bool enabled) { }\n+static void softlockup_reconfigure_threads(bool enabled)\n+{\n+\twatchdog_nmi_reconfigure(false);\n+\twatchdog_nmi_reconfigure(true);\n+}\n #endif /* !CONFIG_SOFTLOCKUP_DETECTOR */\n \n static void __lockup_detector_cleanup(void)\n@@ -593,7 +607,6 @@ static void proc_watchdog_update(void)\n \t/* Remove impossible cpus to keep sysctl output clean. */\n \tcpumask_and(&watchdog_cpumask, &watchdog_cpumask, cpu_possible_mask);\n \tsoftlockup_reconfigure_threads(watchdog_enabled && watchdog_thresh);\n-\twatchdog_nmi_reconfigure();\n }\n \n /*\n","prefixes":["22/29"]}