From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933512AbbDQPlj (ORCPT ); Fri, 17 Apr 2015 11:41:39 -0400 Received: from mail-db3on0078.outbound.protection.outlook.com ([157.55.234.78]:57280 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753924AbbDQPlg (ORCPT ); Fri, 17 Apr 2015 11:41:36 -0400 Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none; Message-ID: <5531299C.60600@ezchip.com> Date: Fri, 17 Apr 2015 11:41:16 -0400 From: Chris Metcalf User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Ulrich Obergfell CC: Frederic Weisbecker , Don Zickus , Ingo Molnar , Andrew Morton , Andrew Jones , chai wen , Fabian Frederick , Aaron Tomlin , Ben Zhang , Christoph Lameter , Gilad Ben-Yossef , Steven Rostedt , , Jonathan Corbet , , Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH v8 2/3] watchdog: add watchdog_cpumask sysctl to assist nohz References: <20150413215423.GA6121@lerouge> <1429040253-7054-1-git-send-email-cmetcalf@ezchip.com> <1429040253-7054-2-git-send-email-cmetcalf@ezchip.com> <755157528.1109591.1429181212104.JavaMail.zimbra@redhat.com> In-Reply-To: <755157528.1109591.1429181212104.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [12.216.194.146] X-ClientProxiedBy: BY2PR04CA0074.namprd04.prod.outlook.com (10.255.247.42) To HE1PR02MB0777.eurprd02.prod.outlook.com (25.161.118.141) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0777; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1;SFV:NSPM;SFS:(10009020)(6049001)(6009001)(24454002)(41574002)(377454003)(51704005)(479174004)(50986999)(76176999)(42186005)(93886004)(65816999)(2950100001)(19580395003)(110136001)(33656002)(4001350100001)(83506001)(23676002)(54356999)(77096005)(15975445007)(65806001)(66066001)(65956001)(64126003)(47776003)(62966003)(77156002)(92566002)(46102003)(122386002)(50466002)(87976001)(40100003)(86362001)(36756003)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR02MB0777;H:[10.7.0.41];FPR:;SPF:None;MLV:sfv;LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002010);SRVR:HE1PR02MB0777;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0777; X-Forefront-PRVS: 0549E6FD50 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2015 15:41:28.2874 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB0777 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/16/2015 06:46 AM, Ulrich Obergfell wrote: > if a user changes watchdog parameters in /proc/sys/kernel, the watchdog threads > are not stopped and restarted in all cases. Parameters can also be changed 'on > the fly', for example like 'watchdog_thresh' in the following flow of execution: > > proc_watchdog_thresh > proc_watchdog_update > if (watchdog_enabled && watchdog_thresh) > watchdog_enable_all_cpus > if (!watchdog_running) { > // watchdog threads are already running so we don't get here > } else { > update_watchdog_all_cpus > for_each_online_cpu <-----------------------------. > update_watchdog | > watchdog_nmi_disable | > watchdog_nmi_enable | > } | > | > I think we would not want to call watchdog_nmi_enable() for each_online_ CPU, > but rather for each CPU that has an_unparked_ watchdog thread (i.e. where the > watchdog mechanism is actually enabled). How about something like this? I'll fold it into v9 of the patchset. Thanks! diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 0c5a37cdbedd..a4e1c9a2e769 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -61,6 +61,10 @@ static cpumask_var_t watchdog_cpumask_for_smpboot; static cpumask_var_t watchdog_cpumask; unsigned long *watchdog_cpumask_bits; +/* Helper for online, unparked cpus. */ +#define for_each_watchdog_cpu(cpu) \ + for_each_cpu_and((cpu), cpu_online_mask, watchdog_cpumask) + static int __read_mostly watchdog_running; static u64 __read_mostly sample_period; @@ -209,7 +213,7 @@ void touch_all_softlockup_watchdogs(void) * do we care if a 0 races with a timestamp? * all it means is the softlock check starts one cycle later */ - for_each_online_cpu(cpu) + for_each_watchdog_cpu(cpu) per_cpu(watchdog_touch_ts, cpu) = 0; } @@ -616,7 +620,7 @@ void watchdog_nmi_enable_all(void) return; get_online_cpus(); - for_each_online_cpu(cpu) + for_each_watchdog_cpu(cpu) watchdog_nmi_enable(cpu); put_online_cpus(); } @@ -629,7 +633,7 @@ void watchdog_nmi_disable_all(void) return; get_online_cpus(); - for_each_online_cpu(cpu) + for_each_watchdog_cpu(cpu) watchdog_nmi_disable(cpu); put_online_cpus(); } @@ -688,7 +692,7 @@ static void update_watchdog_all_cpus(void) int cpu; get_online_cpus(); - for_each_online_cpu(cpu) + for_each_watchdog_cpu(cpu) update_watchdog(cpu); put_online_cpus(); } -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com