The patch titled Subject: watchdog: rename watchdog_suspend() and watchdog_resume() has been added to the -mm tree. Its filename is watchdog-rename-watchdog_suspend-and-watchdog_resume.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/watchdog-rename-watchdog_suspend-and-watchdog_resume.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/watchdog-rename-watchdog_suspend-and-watchdog_resume.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Ulrich Obergfell <uobergfe@xxxxxxxxxx> Subject: watchdog: rename watchdog_suspend() and watchdog_resume() Rename watchdog_suspend() to lockup_detector_suspend() and watchdog_resume() to lockup_detector_resume() to avoid confusion with the watchdog subsystem and to be consistent with the existing name lockup_detector_init(). Also provide comment blocks to explain the watchdog_running and watchdog_suspended variables and their relationship. Signed-off-by: Ulrich Obergfell <uobergfe@xxxxxxxxxx> Reviewed-by: Aaron Tomlin <atomlin@xxxxxxxxxx> Cc: Guenter Roeck <linux@xxxxxxxxxxxx> Cc: Don Zickus <dzickus@xxxxxxxxxx> Cc: Ulrich Obergfell <uobergfe@xxxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Stephane Eranian <eranian@xxxxxxxxxx> Cc: Chris Metcalf <cmetcalf@xxxxxxxxxx> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/x86/kernel/cpu/perf_event_intel.c | 4 +-- include/linux/nmi.h | 8 +++---- kernel/watchdog.c | 26 +++++++++++++++++++---- 3 files changed, 28 insertions(+), 10 deletions(-) diff -puN arch/x86/kernel/cpu/perf_event_intel.c~watchdog-rename-watchdog_suspend-and-watchdog_resume arch/x86/kernel/cpu/perf_event_intel.c --- a/arch/x86/kernel/cpu/perf_event_intel.c~watchdog-rename-watchdog_suspend-and-watchdog_resume +++ a/arch/x86/kernel/cpu/perf_event_intel.c @@ -3368,7 +3368,7 @@ static __init int fixup_ht_bug(void) return 0; } - if (watchdog_suspend() != 0) { + if (lockup_detector_suspend() != 0) { pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); return 0; } @@ -3379,7 +3379,7 @@ static __init int fixup_ht_bug(void) x86_pmu.commit_scheduling = NULL; x86_pmu.stop_scheduling = NULL; - watchdog_resume(); + lockup_detector_resume(); get_online_cpus(); diff -puN include/linux/nmi.h~watchdog-rename-watchdog_suspend-and-watchdog_resume include/linux/nmi.h --- a/include/linux/nmi.h~watchdog-rename-watchdog_suspend-and-watchdog_resume +++ a/include/linux/nmi.h @@ -78,15 +78,15 @@ extern int proc_watchdog_thresh(struct c void __user *, size_t *, loff_t *); extern int proc_watchdog_cpumask(struct ctl_table *, int, void __user *, size_t *, loff_t *); -extern int watchdog_suspend(void); -extern void watchdog_resume(void); +extern int lockup_detector_suspend(void); +extern void lockup_detector_resume(void); #else -static inline int watchdog_suspend(void) +static inline int lockup_detector_suspend(void) { return 0; } -static inline void watchdog_resume(void) +static inline void lockup_detector_resume(void) { } #endif diff -puN kernel/watchdog.c~watchdog-rename-watchdog_suspend-and-watchdog_resume kernel/watchdog.c --- a/kernel/watchdog.c~watchdog-rename-watchdog_suspend-and-watchdog_resume +++ a/kernel/watchdog.c @@ -67,8 +67,26 @@ unsigned long *watchdog_cpumask_bits = c #define for_each_watchdog_cpu(cpu) \ for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) -static int __read_mostly watchdog_suspended; +/* + * The 'watchdog_running' variable is set to 1 when the watchdog threads + * are registered/started and is set to 0 when the watchdog threads are + * unregistered/stopped, so it is an indicator whether the threads exist. + */ static int __read_mostly watchdog_running; +/* + * If a subsystem has a need to deactivate the watchdog temporarily, it + * can use the suspend/resume interface to achieve this. The content of + * the 'watchdog_suspended' variable reflects this state. Existing threads + * are parked/unparked by the lockup_detector_{suspend|resume} functions + * (see comment blocks pertaining to those functions for further details). + * + * 'watchdog_suspended' also prevents threads from being registered/started + * or unregistered/stopped via parameters in /proc/sys/kernel, so the state + * of 'watchdog_running' cannot change while the watchdog is deactivated + * temporarily (see related code in 'proc' handlers). + */ +static int __read_mostly watchdog_suspended; + static u64 __read_mostly sample_period; static DEFINE_PER_CPU(unsigned long, watchdog_touch_ts); @@ -669,7 +687,7 @@ static void watchdog_unpark_threads(void /* * Suspend the hard and soft lockup detector by parking the watchdog threads. */ -int watchdog_suspend(void) +int lockup_detector_suspend(void) { int ret = 0; @@ -679,7 +697,7 @@ int watchdog_suspend(void) * the 'watchdog_suspended' variable). If the watchdog threads are * running, the first caller takes care that they will be parked. * The state of 'watchdog_running' cannot change while a suspend - * request is active (see related changes in 'proc' handlers). + * request is active (see related code in 'proc' handlers). */ if (watchdog_running && !watchdog_suspended) ret = watchdog_park_threads(); @@ -695,7 +713,7 @@ int watchdog_suspend(void) /* * Resume the hard and soft lockup detector by unparking the watchdog threads. */ -void watchdog_resume(void) +void lockup_detector_resume(void) { mutex_lock(&watchdog_proc_mutex); _ Patches currently in -mm which might be from uobergfe@xxxxxxxxxx are smpboot-fix-memory-leak-on-error-handling.patch smpboot-make-cleanup-to-mirror-setup.patch smpboot-allow-to-pass-the-cpumask-on-per-cpu-thread-registration.patch watchdog-simplify-housekeeping-affinity-with-the-appropriate-mask.patch watchdog-introduce-watchdog_park_threads-and-watchdog_unpark_threads.patch watchdog-introduce-watchdog_suspend-and-watchdog_resume.patch watchdog-introduce-watchdog_suspend-and-watchdog_resume-fix.patch watchdog-use-park-unpark-functions-in-update_watchdog_all_cpus.patch watchdog-use-suspend-resume-interface-in-fixup_ht_bug.patch watchdog-use-suspend-resume-interface-in-fixup_ht_bug-fix.patch watchdog-use-suspend-resume-interface-in-fixup_ht_bug-fix-2.patch watchdog-rename-watchdog_suspend-and-watchdog_resume.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html