* [PATCH 0/2] watchdog: avoid races in watchdog_nmi_{en|disable} functions - follow up patches
@ 2015-08-07 9:58 Ulrich Obergfell
2015-08-07 9:58 ` [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() Ulrich Obergfell
2015-08-07 9:58 ` [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path Ulrich Obergfell
0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Obergfell @ 2015-08-07 9:58 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, dzickus, atomlin, uobergfe, jolsa, mhocko, eranian,
cmetcalf, fweisbec, linux
This small series follows up to patch discussion related
to $subject patch series which is now in linux-next at:
- introduce watchdog_park_threads() and watchdog_unpark_threads()
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/kernel/watchdog.c?id=89f536017155c7f76c8a620e6aed03809e53cd4c
- introduce watchdog_suspend() and watchdog_resume()
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/kernel/watchdog.c?id=e0dd9ee3ecf3394e93343cf9542d8ca1b54eca08
- use park/unpark functions in update_watchdog_all_cpus()
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/kernel/watchdog.c?id=eef1a759acfb98766fef20afca9e06f014299e3f
- use suspend/resume interface in fixup_ht_bug()
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/kernel/watchdog.c?id=77592a82363dd508ce3dbe4eaaa2c6c45b966ebb
Changes based on patch discussion:
- Patch 1/2: rename watchdog_{suspend|resume}, add comment blocks
http://marc.info/?l=linux-kernel&m=143844050610220&w=2
http://marc.info/?l=linux-kernel&m=143876224114821&w=2
- Patch 2/2: use pr_debug() instead of pr_info()
http://marc.info/?l=linux-kernel&m=143869949229461&w=2
Ulrich Obergfell (2):
watchdog: rename watchdog_suspend() and watchdog_resume()
watchdog: use pr_debug() in fixup_ht_bug() failure path
arch/x86/kernel/cpu/perf_event_intel.c | 6 +++---
include/linux/nmi.h | 8 ++++----
kernel/watchdog.c | 26 ++++++++++++++++++++++----
3 files changed, 29 insertions(+), 11 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() 2015-08-07 9:58 [PATCH 0/2] watchdog: avoid races in watchdog_nmi_{en|disable} functions - follow up patches Ulrich Obergfell @ 2015-08-07 9:58 ` Ulrich Obergfell 2015-08-07 10:11 ` Aaron Tomlin 2015-08-07 9:58 ` [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path Ulrich Obergfell 1 sibling, 1 reply; 5+ messages in thread From: Ulrich Obergfell @ 2015-08-07 9:58 UTC (permalink / raw) To: linux-kernel Cc: akpm, dzickus, atomlin, uobergfe, jolsa, mhocko, eranian, cmetcalf, fweisbec, linux 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@redhat.com> --- 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 --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index d4e1b0c..0357bf7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/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_info("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 --git a/include/linux/nmi.h b/include/linux/nmi.h index 46e28e9e..78488e0 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -84,15 +84,15 @@ extern int proc_watchdog_thresh(struct ctl_table *, int , 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 --git a/kernel/watchdog.c b/kernel/watchdog.c index 69666f4..64ed1c3 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -67,8 +67,26 @@ unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); #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); -- 1.7.11.7 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() 2015-08-07 9:58 ` [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() Ulrich Obergfell @ 2015-08-07 10:11 ` Aaron Tomlin 0 siblings, 0 replies; 5+ messages in thread From: Aaron Tomlin @ 2015-08-07 10:11 UTC (permalink / raw) To: Ulrich Obergfell Cc: linux-kernel, akpm, dzickus, jolsa, mhocko, eranian, cmetcalf, fweisbec, linux [-- Attachment #1: Type: text/plain, Size: 4913 bytes --] On Fri 2015-08-07 11:58 +0200, Ulrich Obergfell wrote: > 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@redhat.com> > --- > 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 --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c > index d4e1b0c..0357bf7 100644 > --- a/arch/x86/kernel/cpu/perf_event_intel.c > +++ b/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_info("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 --git a/include/linux/nmi.h b/include/linux/nmi.h > index 46e28e9e..78488e0 100644 > --- a/include/linux/nmi.h > +++ b/include/linux/nmi.h > @@ -84,15 +84,15 @@ extern int proc_watchdog_thresh(struct ctl_table *, int , > 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 --git a/kernel/watchdog.c b/kernel/watchdog.c > index 69666f4..64ed1c3 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -67,8 +67,26 @@ unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); > #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); > Reviewed-by: Aaron Tomlin <atomlin@redhat.com> -- Aaron Tomlin [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path 2015-08-07 9:58 [PATCH 0/2] watchdog: avoid races in watchdog_nmi_{en|disable} functions - follow up patches Ulrich Obergfell 2015-08-07 9:58 ` [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() Ulrich Obergfell @ 2015-08-07 9:58 ` Ulrich Obergfell 2015-08-07 10:11 ` Aaron Tomlin 1 sibling, 1 reply; 5+ messages in thread From: Ulrich Obergfell @ 2015-08-07 9:58 UTC (permalink / raw) To: linux-kernel Cc: akpm, dzickus, atomlin, uobergfe, jolsa, mhocko, eranian, cmetcalf, fweisbec, linux Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com> --- arch/x86/kernel/cpu/perf_event_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 0357bf7..abb25c3 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c @@ -3369,7 +3369,7 @@ static __init int fixup_ht_bug(void) } if (lockup_detector_suspend() != 0) { - pr_info("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); + pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); return 0; } -- 1.7.11.7 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path 2015-08-07 9:58 ` [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path Ulrich Obergfell @ 2015-08-07 10:11 ` Aaron Tomlin 0 siblings, 0 replies; 5+ messages in thread From: Aaron Tomlin @ 2015-08-07 10:11 UTC (permalink / raw) To: Ulrich Obergfell Cc: linux-kernel, akpm, dzickus, jolsa, mhocko, eranian, cmetcalf, fweisbec, linux [-- Attachment #1: Type: text/plain, Size: 830 bytes --] On Fri 2015-08-07 11:58 +0200, Ulrich Obergfell wrote: > > Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com> > --- > arch/x86/kernel/cpu/perf_event_intel.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c > index 0357bf7..abb25c3 100644 > --- a/arch/x86/kernel/cpu/perf_event_intel.c > +++ b/arch/x86/kernel/cpu/perf_event_intel.c > @@ -3369,7 +3369,7 @@ static __init int fixup_ht_bug(void) > } > > if (lockup_detector_suspend() != 0) { > - pr_info("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); > + pr_debug("failed to disable PMU erratum BJ122, BV98, HSD29 workaround\n"); > return 0; > } > Reviewed-by: Aaron Tomlin <atomlin@redhat.com> -- Aaron Tomlin [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-07 10:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 9:58 [PATCH 0/2] watchdog: avoid races in watchdog_nmi_{en|disable} functions - follow up patches Ulrich Obergfell
2015-08-07 9:58 ` [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() Ulrich Obergfell
2015-08-07 10:11 ` Aaron Tomlin
2015-08-07 9:58 ` [PATCH 2/2] watchdog: use pr_debug() in fixup_ht_bug() failure path Ulrich Obergfell
2015-08-07 10:11 ` Aaron Tomlin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®