From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932694AbbI2Gk5 (ORCPT ); Tue, 29 Sep 2015 02:40:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44846 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932565AbbI2Gku (ORCPT ); Tue, 29 Sep 2015 02:40:50 -0400 Date: Tue, 29 Sep 2015 07:40:46 +0100 From: Aaron Tomlin To: Ulrich Obergfell Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dzickus@redhat.com Subject: Re: [PATCH 3/5] watchdog: implement error handling in update_watchdog_all_cpus() and callers Message-ID: <20150929064046.GI25024@atomlin.usersys.redhat.com> References: <1443473052-3053-1-git-send-email-uobergfe@redhat.com> <1443473052-3053-4-git-send-email-uobergfe@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="twz1s1Hj1O0rHoT0" Content-Disposition: inline In-Reply-To: <1443473052-3053-4-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 --twz1s1Hj1O0rHoT0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon 2015-09-28 22:44 +0200, Ulrich Obergfell wrote: > update_watchdog_all_cpus() now passes errors from watchdog_park_threads() > up to functions in the call chain. This allows watchdog_enable_all_cpus() > and proc_watchdog_update() to handle such errors too. >=20 > Signed-off-by: Ulrich Obergfell > --- > kernel/watchdog.c | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) >=20 > diff --git a/kernel/watchdog.c b/kernel/watchdog.c > index eb9527c..457113c 100644 > --- a/kernel/watchdog.c > +++ b/kernel/watchdog.c > @@ -731,10 +731,17 @@ void lockup_detector_resume(void) > mutex_unlock(&watchdog_proc_mutex); > } > =20 > -static void update_watchdog_all_cpus(void) > +static int update_watchdog_all_cpus(void) > { > - watchdog_park_threads(); > + int ret; > + > + ret =3D watchdog_park_threads(); > + if (ret) > + return ret; > + > watchdog_unpark_threads(); > + > + return 0; > } > =20 > static int watchdog_enable_all_cpus(void) > @@ -753,9 +760,17 @@ static int watchdog_enable_all_cpus(void) > * Enable/disable the lockup detectors or > * change the sample period 'on the fly'. > */ > - update_watchdog_all_cpus(); > + err =3D update_watchdog_all_cpus(); > + > + if (err) { > + watchdog_disable_all_cpus(); > + pr_err("Failed to update lockup detectors, disabled\n"); > + } > } > =20 > + if (err) > + watchdog_enabled =3D 0; > + > return err; > } > =20 > @@ -851,12 +866,13 @@ static int proc_watchdog_common(int which, struct c= tl_table *table, int write, > } while (cmpxchg(&watchdog_enabled, old, new) !=3D old); > =20 > /* > - * Update the run state of the lockup detectors. > - * Restore 'watchdog_enabled' on failure. > + * Update the run state of the lockup detectors. There is _no_ > + * need to check the value returned by proc_watchdog_update() > + * and to restore the previous value of 'watchdog_enabled' as > + * both lockup detectors are disabled if proc_watchdog_update() > + * returns an error. > */ > err =3D proc_watchdog_update(); > - if (err) > - watchdog_enabled =3D old; > } > out: > mutex_unlock(&watchdog_proc_mutex); Reviewed-by: Aaron Tomlin --twz1s1Hj1O0rHoT0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWCjJtAAoJEOLellgZzHfW1oUP/2k6PJS2Rfwz3Ip++S/NAGoe GxhlUpDYfafjgMXmelrYAjOXNHhUHRYWUkUtmtKyj1CkQVWAg+X9BcXMTZf/WdUT miZ2MBzHQqOVJTRTpd83XjpKid1aksIpKnLgin3IjG+9SK78srwiPKoRKxK4GcJS RJu1z31OCt64DWhKp07YU4Z1ll0qr1miGMqtYZNVLV/cMAtbgWqZB/mwM4t60pwt bvSnHtCx7n+G8wpnUm6MRksLB3N273/HCLN0XdhQuwmC5mAeKr8kFzVGmpGAQPEH 39t/DEgI0Ualipux3UfOCgJhChG7dg4YBLln0HPlXzO6VBcRm/VmXMzrYhsM5qk7 0QUT7yJnnefzz3bMI9Eo+Uh+dzTVYYd4XMyhAIyb32RAn4sMSbJ+XoKXKPdNwf8L Hv7eB9GkiGzgKbtApefq7xj2HiqM4vp4GoMx8ouv3xCmtQkiQxBJQ3MggRr+ZYQB ru8qj284DJlgdn8eR0LJFzTYSwH7397575odFIfpu4V94swQwG33yO5o7mLfcII/ /TYwbuBXYMFh6NFaONCF9JzZXyNDwyFfxlq0vwcqgn1vCoja1DBYrRYJ1QvFHCQ8 nQsrcqsizKk+wKBzYQe3ZvSmnzosjjSjoG6y4N0s/Z+AM5mUhLy5Q+nbV1QYUuEr +KRsgP8pq31G4Y6juStA =mGBx -----END PGP SIGNATURE----- --twz1s1Hj1O0rHoT0--