Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751602AbbHGKL2 (ORCPT ); Fri, 7 Aug 2015 06:11:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54341 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881AbbHGKL1 (ORCPT ); Fri, 7 Aug 2015 06:11:27 -0400 Date: Fri, 7 Aug 2015 11:11:20 +0100 From: Aaron Tomlin To: Ulrich Obergfell Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dzickus@redhat.com, jolsa@kernel.org, mhocko@suse.cz, eranian@google.com, cmetcalf@ezchip.com, fweisbec@gmail.com, linux@roeck-us.net Subject: Re: [PATCH 1/2] watchdog: rename watchdog_suspend() and watchdog_resume() Message-ID: <20150807101120.GA17775@atomlin.usersys.redhat.com> References: <1438941488-3651-1-git-send-email-uobergfe@redhat.com> <1438941488-3651-2-git-send-email-uobergfe@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0F1p//8PRICkK4MW" Content-Disposition: inline In-Reply-To: <1438941488-3651-2-git-send-email-uobergfe@redhat.com> X-PGP-Key: http://pgp.mit.edu/pks/lookup?search=atomlin%40redhat.com X-PGP-Fingerprint: 7906 84EB FA8A 9638 8D1E 6E9B E2DE 9658 19CC 77D6 User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6149 Lines: 170 --0F1p//8PRICkK4MW Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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(). >=20 > Also provide comment blocks to explain the watchdog_running > and watchdog_suspended variables and their relationship. >=20 > Signed-off-by: Ulrich Obergfell > --- > 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(-) >=20 > 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; > } > =20 > - if (watchdog_suspend() !=3D 0) { > + if (lockup_detector_suspend() !=3D 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 =3D NULL; > x86_pmu.stop_scheduling =3D NULL; > =20 > - watchdog_resume(); > + lockup_detector_resume(); > =20 > get_online_cpus(); > =20 > 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 *, i= nt , > 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; > } > =20 > -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 =3D cpumask_bits(= &watchdog_cpumask); > #define for_each_watchdog_cpu(cpu) \ > for_each_cpu_and((cpu), cpu_online_mask, &watchdog_cpumask) > =20 > -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 threa= ds > + * 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/star= ted > + * or unregistered/stopped via parameters in /proc/sys/kernel, so the st= ate > + * 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; > =20 > 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 thr= eads. > */ > -int watchdog_suspend(void) > +int lockup_detector_suspend(void) > { > int ret =3D 0; > =20 > @@ -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 =3D watchdog_park_threads(); > @@ -695,7 +713,7 @@ int watchdog_suspend(void) > /* > * Resume the hard and soft lockup detector by unparking the watchdog th= reads. > */ > -void watchdog_resume(void) > +void lockup_detector_resume(void) > { > mutex_lock(&watchdog_proc_mutex); > =20 Reviewed-by: Aaron Tomlin --=20 Aaron Tomlin --0F1p//8PRICkK4MW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVxIRIAAoJEOLellgZzHfWr2sP/R5+DKEH1tgkp0wlSKInf8mJ nPgGSTow95yyXQN6xjO878Of/KTjJ8VBUb33nXyvdN4relcYB7yaAo+mYPpfky01 Qy/2Uf7rK2CxKgi/4Llmdr7yukFeqETov1y/0dYxcehoquc0iaBC3RtK8nCh/w++ nnMGka9BPWAM5gfv+nNoh+qPpGO2rgWTHa+UMIoZGcAZrSym/ECp1sc/sqVnhFye M0NVfM1Ic4dxhSUA9a0NJg9AE7buYgxT6NnY2m2Nsr6pdKF+h9KDxibpd3GAPjjn Yesl/qFBnuI+W7ZOMcghslwZK+bwzqkH12kVkxRRUYiE46FJdJXgpfURttgc595Y Vmj3dyF3ke5a064GZrw97Av7w0XDFL8X942rOcxDG883c1IsZnMWauAzwQUhNoQO V5h+CRYW/djN2yOTPB1V2ap1/S2cS3fal+vbgk8xbXWOUXjX/zrWP6SN/Jia5JKc J/Zy5RRgKqzZdz7FjYDQMfptn4/r3ttGJ9XiRclEHBMQxT+ikIn4Zfea6H6N7zWH SL18fHJjkXIpFFFw6YRmJc/nTDZHbQ1+bx+wUrqXjXQR5ixbaA/qRMwEcDTkggY9 hjL7dg0vvrIF/lsMl4dwjpcOfAQ2ymCSPXMjAYUCxvKFrnAo5JJLM9/kBxTwdELJ Dq4fy3cT1RLSOFx1rscw =HRFF -----END PGP SIGNATURE----- --0F1p//8PRICkK4MW-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/