From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26BF33932FA for ; Thu, 30 Apr 2026 09:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777541662; cv=none; b=VDtDu/WgtpQT2aHSHEDpukCIOrXmQwMd5z1SswIf5pa43vwTDdjqE+Z06VD9o5kuNc1f9xrUEYoDkJrBrI97leAxA/0ETckIZNzMcwMBLsMmE5ZMr6PlaE0rKAfGgfwhTHWDEz3LeTBzS99zuLZkqU+C6CKda6jfKGfy1skjGz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777541662; c=relaxed/simple; bh=vD46OgpMmHSE73m5ZHZNU/fe4ZkL5+Z9nNvnp1sCGwg=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=HBL6O3TbzmG8Yaf+OUMUmneWM2CG5FFJgpuDWTra1lYrG11QY8PG4vh0PR2JL/cUiS5ZLSocdoHUL/tPHZegvXN1rd51Y4g5bt62XcIr2D1dEfp6Xp3LPCiq9bSfMSua5XX63I6rijP8La9A0pOmoL1XzccoD0J3LelpmZiKNIE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=Cw99BAGg; arc=none smtp.client-ip=113.46.200.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="Cw99BAGg" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=238vQlkIUz0He/YrCIvIsc+2yUKSgaHTScsntRUK/X0=; b=Cw99BAGg3AdARLtOciad+fMlDMmueH9gHIZJomMVxAgGJfE2Bng48Lp/XJuSv4Ms4nGBER+ln aBJ2ZxUBt4iZYjUckwu6SGwkAGhJsMblEhEigk48FhDwvpWEIMpCNeVclW+GHQjSHjwpcV5KzA4 V4dnrYQxPzce3KO3yMz1iQc= Received: from mail.maildlp.com (unknown [172.19.163.127]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4g5pjl3kSBzKm7G; Thu, 30 Apr 2026 17:27:39 +0800 (CST) Received: from kwepemr200004.china.huawei.com (unknown [7.202.195.241]) by mail.maildlp.com (Postfix) with ESMTPS id DA46D402AB; Thu, 30 Apr 2026 17:34:08 +0800 (CST) Received: from [10.67.121.62] (10.67.121.62) by kwepemr200004.china.huawei.com (7.202.195.241) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 30 Apr 2026 17:34:08 +0800 Message-ID: <49f96032-6027-4c79-8d08-9545261e553f@huawei.com> Date: Thu, 30 Apr 2026 17:34:07 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] arm64: smp: Do not mark secondary CPUs possible under nosmp To: Catalin Marinas CC: , , , , , , , , , , , , , , References: <20260423134654.4178271-1-zhangpengjie2@huawei.com> From: "zhangpengjie (A)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To kwepemr200004.china.huawei.com (7.202.195.241) On 4/27/2026 9:20 PM, Catalin Marinas wrote: > On Thu, Apr 23, 2026 at 09:46:54PM +0800, Pengjie Zhang wrote: >> Under nosmp (maxcpus=0), arm64 never brings up secondary CPUs. >> >> However, arm64 still enumerates firmware-described CPUs during SMP >> initialization, which can leave secondary CPUs visible to >> for_each_possible_cpu() users even though they never reach the >> bringup path in this configuration. >> >> This is not just a cosmetic mask mismatch: code iterating over >> possible CPUs may observe secondary CPU per-CPU state that is never >> fully initialized under nosmp. > I'm fine with the patch in principle but I fail to see why it is not > mostly cosmetic. If we have possible & !present CPUs (there's another > thread around cpuhp_smt_enable() to allow this combination on arm64), > get_cpu_device() would return NULL and the core code is supposed to > handle this. What other per-CPU state should be initialised for a > possible CPU but it is not without this patch? Yes, possible-but-not-present CPUs are valid in the general hotplug model. The nosmp/maxcpus=0 case is different though: on arm64, smp_prepare_cpus() treats this as a UP-mandated boot and returns before marking secondary CPUs present, so these CPUs are deliberately kept out of the bringup path for this boot. The kind of issue I had in mind was subsystem-owned per-CPU state where iteration follows cpu_possible_mask but the state is populated only from CPU online/probe paths. The CPPC nosmp issue fixed by commit 15eece6c5b05 ("ACPI: CPPC: Fix NULL pointer dereference when nosmp is used") was the kind of mismatch I was thinking of, although CPPC itself has already been fixed to use online CPUs where appropriate. I agree the changelog overstates this. I can respin with a toned-down changelog if you prefer.