From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752776AbbJRMmZ (ORCPT ); Sun, 18 Oct 2015 08:42:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43882 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146AbbJRMmX (ORCPT ); Sun, 18 Oct 2015 08:42:23 -0400 Date: Sun, 18 Oct 2015 13:42:16 +0100 From: Aaron Tomlin To: Don Zickus Cc: LKML , Andrew Morton , uobergfe@redhat.com, jkosina@suse.cz Subject: Re: [PATCH v2] watchdog: Add sysctl knob hardlockup_panic Message-ID: <20151018124216.GA3737@atomlin.usersys.redhat.com> References: <1444921616-233246-1-git-send-email-dzickus@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ibTvN161/egqYuK8" Content-Disposition: inline In-Reply-To: <1444921616-233246-1-git-send-email-dzickus@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 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2015-10-15 11:06 -0400, Don Zickus wrote: > The only way to enable a hardlockup to panic the machine is to set > 'nmi_watchdog=3Dpanic' on the kernel command line. >=20 > This makes it awkward for end users and folks who want to run automate te= sts > (like myself). >=20 > Mimic the softlockup_panic knob and create a /proc/sys/kernel/hardlockup_= panic > knob. >=20 > Signed-off-by: Don Zickus >=20 > -- > V2 - wrap the sysctl variable with CONFIG_HARDLOCKUP_DETECTOR (kbuid bot) > --- > Documentation/lockup-watchdogs.txt | 5 +++-- > include/linux/sched.h | 1 + > kernel/sysctl.c | 11 +++++++++++ > kernel/watchdog.c | 2 +- > 4 files changed, 16 insertions(+), 3 deletions(-) >=20 > diff --git a/Documentation/lockup-watchdogs.txt b/Documentation/lockup-wa= tchdogs.txt > index 22dd6af..4a6e33e 100644 > --- a/Documentation/lockup-watchdogs.txt > +++ b/Documentation/lockup-watchdogs.txt > @@ -20,8 +20,9 @@ kernel mode for more than 10 seconds (see "Implementati= on" below for > details), without letting other interrupts have a chance to run. > Similarly to the softlockup case, the current stack trace is displayed > upon detection and the system will stay locked up unless the default > -behavior is changed, which can be done through a compile time knob, > -"BOOTPARAM_HARDLOCKUP_PANIC", and a kernel parameter, "nmi_watchdog" > +behavior is changed, which can be done through a sysctl, > +'hardlockup_panic', a compile time knob, "BOOTPARAM_HARDLOCKUP_PANIC", > +and a kernel parameter, "nmi_watchdog" > (see "Documentation/kernel-parameters.txt" for details). > =20 > The panic option can be used in combination with panic_timeout (this > diff --git a/include/linux/sched.h b/include/linux/sched.h > index b7b9501..5e65b14 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -384,6 +384,7 @@ extern int proc_dowatchdog_thresh(struct ctl_table *t= able, int write, > void __user *buffer, > size_t *lenp, loff_t *ppos); > extern unsigned int softlockup_panic; > +extern unsigned int hardlockup_panic; > void lockup_detector_init(void); > #else > static inline void touch_softlockup_watchdog(void) > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index efb0370..a341117 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -887,6 +887,17 @@ static struct ctl_table kern_table[] =3D { > .extra1 =3D &zero, > .extra2 =3D &one, > }, > +#ifdef CONFIG_HARDLOCKUP_DETECTOR > + { > + .procname =3D "hardlockup_panic", > + .data =3D &hardlockup_panic, > + .maxlen =3D sizeof(int), > + .mode =3D 0644, > + .proc_handler =3D proc_dointvec_minmax, > + .extra1 =3D &zero, > + .extra2 =3D &one, > + }, > +#endif > #ifdef CONFIG_SMP > { > .procname =3D "softlockup_all_cpu_backtrace", > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index f6b32b8..0a23125 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -112,7 +112,7 @@ static unsigned long soft_lockup_nmi_warn; > * Should we panic when a soft-lockup or hard-lockup occurs: > */ > #ifdef CONFIG_HARDLOCKUP_DETECTOR > -static int hardlockup_panic =3D > +unsigned int __read_mostly hardlockup_panic =3D > CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE; > static unsigned long hardlockup_allcpu_dumped; > /* Reviewed-by: Aaron Tomlin --ibTvN161/egqYuK8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWI5OoAAoJEOLellgZzHfWkm4P/AnCkyS+0QcmgpFmgs62y9d/ BdbPzj6MsHYJHzewViCxVdpLX0Nz1JYGYz9Sf9eR7Pbw1E+7MkrVq/zTXaJYwf94 hh+zTZfqWuKtwtjem6lBNmSs4yyVyZKp7XMeDm08ENR37RKxkccpxgfghGIqtlAp WOoW3807wM7QEPgkCNBCN0yBTmq70ozVQ3WO4HfZGZDBPu2pU/tMwlvNckz5XbeK DwD8YBukBycZjdBX70TXYP3hMOblBa1y/EiJEDgvucnNt5ZLekojjlIdgwFwYgzJ 7qGX8sbP64g+o5I4WvMqkdgqW8OtUgkmOakLbu5ehU8fwS/MbXKqjS5plmZrX4zm rdBC9hE6VZ/KKxraRLOGv7k8B6n7jJANWaruL24phQh7imY0dpalerRT4SHUXZ6O Wl7wkfpMM78EmuNyKFFw0KYrOK4YBx97dOmr0sAJJemDKT+aHsK5ds8lzheF9vx1 W+STpZHPVjzhtfCw8MnxiCcUOMN/dZcG3SKmazNpyat3WECo2ZA7XY0uBcHCsv5V n0VjzSJSh20oXBnO5QE4GQesgi8nKE19SrFx8FX9e+AM4enD5B/VjsVG26WgipLn nDy0AvY6D3J0qnStjMP1RS3WFfO1e/rEzxBnEjJJuILpx5ChGg1jnLA4+q8mNecL Zqc/2Dx7zr7kiVXNqEzx =QHf9 -----END PGP SIGNATURE----- --ibTvN161/egqYuK8--