From patchwork Wed Jul 30 13:43:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Zickus X-Patchwork-Id: 4649331 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 66A499F32F for ; Wed, 30 Jul 2014 13:44:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D06420158 for ; Wed, 30 Jul 2014 13:44:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2335720138 for ; Wed, 30 Jul 2014 13:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751931AbaG3Nnq (ORCPT ); Wed, 30 Jul 2014 09:43:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1949 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbaG3Nnp (ORCPT ); Wed, 30 Jul 2014 09:43:45 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6UDhhNA022142 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jul 2014 09:43:43 -0400 Received: from redhat.com (intel-canoepass-08.lab.bos.redhat.com [10.16.44.153]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s6UDhTlu028584; Wed, 30 Jul 2014 09:43:29 -0400 Date: Wed, 30 Jul 2014 09:43:42 -0400 From: Don Zickus To: Andrew Jones Cc: Ulrich Obergfell , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, akpm@linux-foundation.org, mingo@redhat.com Subject: Re: [PATCH 2/3] watchdog: control hard lockup detection default Message-ID: <20140730134342.GA7959@redhat.com> References: <1406196811-5384-1-git-send-email-drjones@redhat.com> <1406196811-5384-3-git-send-email-drjones@redhat.com> <615371508.17867577.1406277175913.JavaMail.zimbra@redhat.com> <20140725112510.GA3456@hawk.usersys.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140725112510.GA3456@hawk.usersys.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 25, 2014 at 01:25:11PM +0200, Andrew Jones wrote: > > to enable hard lockup detection explicitly. > > > > I think changing the 'watchdog_thresh' while 'watchdog_running' is true should > > _not_ enable hard lockup detection as a side-effect, because a user may have a > > 'sysctl.conf' entry such as > > > > kernel.watchdog_thresh = ... > > > > or may only want to change the 'watchdog_thresh' on the fly. > > > > I think the following flow of execution could cause such undesired side-effect. > > > > proc_dowatchdog > > if (watchdog_user_enabled && watchdog_thresh) { > > > > watchdog_enable_hardlockup_detector > > hardlockup_detector_enabled = true > > > > watchdog_enable_all_cpus > > if (!watchdog_running) { > > ... > > } else if (sample_period_changed) > > update_timers_all_cpus > > for_each_online_cpu > > update_timers > > watchdog_nmi_disable > > ... > > watchdog_nmi_enable > > > > watchdog_hardlockup_detector_is_enabled > > return true > > > > enable perf counter for hard lockup detection > > > > Regards, > > > > Uli > > Nice catch. Looks like this will need a v2. Paolo, do we have a > consensus on the proc echoing? Or should that be revisited in the v2 as > well? As discussed privately, how about something like this to handle that case: (applied on top of these patches) Cheers, Don --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 34eca29..027fb6c 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -666,7 +666,12 @@ int proc_dowatchdog(struct ctl_table *table, int write, * watchdog_*_all_cpus() function takes care of this. */ if (watchdog_user_enabled && watchdog_thresh) { - watchdog_enable_hardlockup_detector(true); + /* + * Prevent a change in watchdog_thresh accidentally overriding + * the enablement of the hardlockup detector. + */ + if (watchdog_user_enabled != old_enabled) + watchdog_enable_hardlockup_detector(true); err = watchdog_enable_all_cpus(old_thresh != watchdog_thresh); } else watchdog_disable_all_cpus();