Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2286571ybd; Mon, 24 Jun 2019 03:58:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhKT3IAqF8kRJpUKyfMuAgwsqMFN7qNLwTulJNgNLbvmlv7zV6QzUAfchuurKL9sl0P1Mm X-Received: by 2002:a17:902:7247:: with SMTP id c7mr7550037pll.202.1561373890698; Mon, 24 Jun 2019 03:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561373890; cv=none; d=google.com; s=arc-20160816; b=r4cUzHVhbNab3s7lFNrMf3EGslaOpsIb+tia6xiK8t4KAHHtVgT8mokqNfyAc2IV5f /UBRCn32OnhM2FPOqNUteR3zbfNfPQziBzWrAGpidda7lvSZY8Rom9Ks3rjl5p+I6eMI 7FL2p2jlQweSxKGQAukShw5uVlGtQgyGeMVtyP9vMFXoiKaJrpi3ooDbDrxJ7AMGkIaZ SbASMdXakVrQ31MSwCOPpUz4vw2/8+0eXn+eUTmZw6WbnZ1yHXrN645Xo61pH6XyplAD YwZxOYA7o8z3yq25/cfkCIqIIScZHWqS98HUvg7vTFzq/eTzPhJaXIeyEiOctRQ/71lF S/tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZnPZt3uY1VH65E2nx1yNYGT1Lh3yLm/lCrbSNwJc4yg=; b=hEx47QMdb58nlzjdK07ca57uR37mpTZgmTWnVG0LFeIek9tvuuYKNl/NIphG3HzWHh 6O13J2v0ye0m7Nx77NQN1l6Rk/Uht2Z1ktv3AkzkAhHw7eZEpWAXSt45xlKi7tGNdNnR 5PlfjqzVGU89cW/jEp1DQR+qDfCUBWtO8JOXC3ibmgo3CxptrYVtqDNNNfZRLro3ADEQ cjR2xJN201QZoxqKnyLY1biMsTruuZPNbZnaMvPDgLafRsYyA5NzPNopLEmzhPmCK1+0 PrbcXwHSPsp3PEQQ4WdaDxjkNEKgWDLV1vgkINOlZYbI4tT670pi2GTDQXuIAAQizCWd 3rZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si10857503ple.240.2019.06.24.03.57.54; Mon, 24 Jun 2019 03:58:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728964AbfFXK5k (ORCPT + 99 others); Mon, 24 Jun 2019 06:57:40 -0400 Received: from foss.arm.com ([217.140.110.172]:46956 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbfFXK5k (ORCPT ); Mon, 24 Jun 2019 06:57:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5CCEB2B; Mon, 24 Jun 2019 03:57:39 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.51]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8F3063F718; Mon, 24 Jun 2019 03:57:38 -0700 (PDT) Date: Mon, 24 Jun 2019 11:57:36 +0100 From: Qais Yousef To: Nicholas Piggin Cc: linux-kernel@vger.kernel.org, Frederic Weisbecker , Ingo Molnar , Peter Zijlstra Subject: Re: [PATCH] kernel/isolation: Asset that a housekeeping CPU comes up at boot time Message-ID: <20190624105729.3isejrp4455suxaz@e107158-lin.cambridge.arm.com> References: <20190601113919.2678-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190601113919.2678-1-npiggin@gmail.com> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/19 21:39, Nicholas Piggin wrote: > With the change to allow the boot CPU0 to be isolated, it is possible > to specify command line options that result in no housekeeping CPU > online at boot. > > An 8 CPU system booted with "nohz_full=0-6 maxcpus=4", for example. > > It is not easily possible at housekeeping init time to know all the > various SMP options that will result in an invalid configuration, so > this patch adds a sanity check after SMP init, to ensure that a > housekeeping CPU has been onlined. > > The panic is undesirable, but it's better than the alternative of an > obscure non deterministic failure. The panic will reliably happen > when advanced parameters are used incorrectly. > > Signed-off-by: Nicholas Piggin > --- > kernel/sched/isolation.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c > index 123ea07a3f3b..7b9e1e0d4ec3 100644 > --- a/kernel/sched/isolation.c > +++ b/kernel/sched/isolation.c > @@ -63,6 +63,29 @@ void __init housekeeping_init(void) > WARN_ON_ONCE(cpumask_empty(housekeeping_mask)); > } > > +static int __init housekeeping_verify_smp(void) > +{ > + int cpu; > + > + /* > + * Early housekeeping setup is done before CPUs come up, and there are > + * a range of options scattered around that can restrict which CPUs > + * come up. It is possible to pass in a combination of housekeeping > + * and SMP arguments that result in housekeeping assigned to an > + * offline CPU. > + * > + * Check that condition here after SMP comes up, and give a useful > + * error message rather than an obscure non deterministic crash or > + * hang later. > + */ > + for_each_online_cpu(cpu) { > + if (cpumask_test_cpu(cpu, housekeeping_mask)) > + return 0; > + } > + panic("Housekeeping: nohz_full= or isolcpus= resulted in no online CPUs for housekeeping.\n"); I am hitting this panic when I boot my juno board. I have CONFIG_CPU_ISOLATION=y but I don't pass nohuz_full nor isolcpus in the commandline. I think what's going on is that housekeeping_setup() doesn't get called and hence housekeeping_mask isn't initialized in my case, causing this check to fail and trigger the panic. The below seems to 'fix' it though not sure if it's the right way forward. A revert obviously fixes it too but I doubt we want that :-) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 7b9e1e0d4ec3..a9ca8628c1a2 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -67,6 +67,9 @@ static int __init housekeeping_verify_smp(void) { int cpu; + if (!housekeeping_flags) + return 0; + /* * Early housekeeping setup is done before CPUs come up, and there are * a range of options scattered around that can restrict which CPUs Cheers -- Qais Yousef > +} > +core_initcall(housekeeping_verify_smp); > + > static int __init housekeeping_setup(char *str, enum hk_flags flags) > { > cpumask_var_t non_housekeeping_mask; > -- > 2.20.1 >