From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12B32C4332F for ; Mon, 31 Jan 2022 11:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378921AbiAaL3f (ORCPT ); Mon, 31 Jan 2022 06:29:35 -0500 Received: from foss.arm.com ([217.140.110.172]:47680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378380AbiAaLUG (ORCPT ); Mon, 31 Jan 2022 06:20:06 -0500 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 9BB62D6E; Mon, 31 Jan 2022 03:20:04 -0800 (PST) Received: from FVFF7649Q05P (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E600C3F774; Mon, 31 Jan 2022 03:20:02 -0800 (PST) Date: Mon, 31 Jan 2022 11:19:57 +0000 From: Vincent Donnefort To: Yury Norov Cc: Thomas Gleixner , Peter Zijlstra , Valentin Schneider , Ingo Molnar , YueHaibing , Yuan ZhaoXiong , Randy Dunlap , Mathieu Desnoyers , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel/cpu.c: fix init_cpu_online Message-ID: References: <20220131014648.941629-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220131014648.941629-1-yury.norov@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yury, On Sun, Jan 30, 2022 at 05:46:48PM -0800, Yury Norov wrote: > cpu_online_mask has an associate counter of online cpus, which must be > initialized in init_cpu_online(). > > Fixes: 0c09ab96fc82010 (cpu/hotplug: Cache number of online CPUs) Aren't the increments/decrements from set_cpu_online() enough? I guess we could argue that this isn't a private function and the num_online_cpus should be updated here. But unless I missed something, init_cpu_online() is only called in ia64 arch, in the !SMP case. Is this the problem you're trying to tackle? If not, I'm not sure that warrants a "Fixes:" tag > Signed-off-by: Yury Norov > --- > kernel/cpu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/cpu.c b/kernel/cpu.c > index 407a2568f35e..cd7605204d4d 100644 > --- a/kernel/cpu.c > +++ b/kernel/cpu.c > @@ -2616,6 +2616,7 @@ void init_cpu_possible(const struct cpumask *src) > void init_cpu_online(const struct cpumask *src) > { > cpumask_copy(&__cpu_online_mask, src); > + atomic_set(&__num_online_cpus, cpumask_weight(cpu_online_mask)); > } > > void set_cpu_online(unsigned int cpu, bool online) > -- > 2.30.2 >