From nobody Sat Jun 13 17:10:28 2026 Received: from canpmsgout12.his.huawei.com (canpmsgout12.his.huawei.com [113.46.200.227]) (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 5CE183E3D8E for ; Wed, 6 May 2026 09:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778058542; cv=none; b=sCRD91fVKFALRbpxB50GKSSdPFJlyMFdKxE3ETdvjmLdVUgGkc+mnd+fqinapBDU5RAr6Y1fWmWy5XJjKkORtYKD66BMPaLuh5/C1uozH718Q4BQoxapfwyIpgNSqaX8/yqZLMSaTwxvScBZBaxVwqWMbOrfApAg5vSadeFDGOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778058542; c=relaxed/simple; bh=3L/DCDB9JnlPMtUcFGUkrzQ13ewg7CKfxncin1zJqsc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=qJ0uyMwp8pJIA4VEI9uqPDlNUJQC69p1fc79yEPk9kLSHmtiluERgIjQ18SmqTcTjRDLbXaCJPAvjOka3ydEtskYX41rLe35u8WlOCHNuEoz8RvMVfmL6UuwAG9gyevLpAG9dm3doX1v92YDSqkPXUFg0w9+TKJaeMgqo6AXJ94= 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=kVpojNc1; arc=none smtp.client-ip=113.46.200.227 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="kVpojNc1" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=mHoWgooO6LwFDOsKw5fw/hDTuDIt8ZBydSJeevTUgXQ=; b=kVpojNc1+OR2hfPzRXO3xd4wlchgzmH6Osv3ivAS5YAElWVZx1wKi2FmZwFQox6wBCSYRZLSk ZJF7Ua1YfXUP6NPDEurO5BwtVmr9zH7G5/nJD3+p2683a3YVhdmAAjrAE7/2eag401n7nGwTMSB yRtgc/yhhkj8IWAIRlFGO7Y= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4g9Ts53JmDznTbg; Wed, 6 May 2026 17:01:45 +0800 (CST) Received: from kwepemr200004.china.huawei.com (unknown [7.202.195.241]) by mail.maildlp.com (Postfix) with ESMTPS id 468C540571; Wed, 6 May 2026 17:08:52 +0800 (CST) Received: from huawei.com (10.50.163.32) 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; Wed, 6 May 2026 17:08:51 +0800 From: Pengjie Zhang To: , CC: , , , , , , , , , , , , , , Subject: [PATCH v3] arm64: smp: Do not mark secondary CPUs possible under nosmp Date: Wed, 6 May 2026 17:08:51 +0800 Message-ID: <20260506090851.1858467-1-zhangpengjie2@huawei.com> X-Mailer: git-send-email 2.33.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200002.china.huawei.com (7.221.188.68) To kwepemr200004.china.huawei.com (7.202.195.241) Content-Type: text/plain; charset="utf-8" Under nosmp (maxcpus=3D0), arm64 never brings up secondary CPUs. smp_prepare_cpus() already treats this as a UP-mandated boot and returns before marking secondary CPUs present. However, smp_init_cpus() may still enumerate firmware-described secondary CPUs and mark them possible before that point. Avoid marking secondary CPUs possible when nosmp/maxcpus=3D0 is in effect, so that cpu_possible_mask reflects the nosmp boot policy for this boot. Suggested-by: Catalin Marinas Reviewed-by: Catalin Marinas Signed-off-by: Pengjie Zhang --- Changes in v3: - Tone down the changelog - Add Catalin's Reviewed-by tag. Link to v2:https://lore.kernel.org/all/20260423134654.4178271-1-zhangpengji= e2@huawei.com/ Changes in v2: - Drop the arch_disable_smp_support() approach. - Handle nosmp/maxcpus=3D0 directly in smp_init_cpus(). - Update the changelog accordingly. Link to v1:https://lore.kernel.org/all/20260422095831.2926775-1-zhangpengji= e2@huawei.com/ --- arch/arm64/kernel/smp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 1aa324104afb..1b63846f646a 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -745,15 +745,21 @@ void __init smp_init_cpus(void) else acpi_parse_and_init_cpus(); =20 - if (cpu_count > nr_cpu_ids) - pr_warn("Number of cores (%d) exceeds configured maximum of %u - clippin= g\n", - cpu_count, nr_cpu_ids); - if (!bootcpu_valid) { pr_err("missing boot CPU MPIDR, not enabling secondaries\n"); return; } =20 + /* + * For the nosmp/maxcpus=3D0 case, do not mark the secondary CPUs + * possible. + */ + if (!setup_max_cpus) + return; + + if (cpu_count > nr_cpu_ids) + pr_warn("Number of cores (%d) exceeds configured maximum of %u - clippin= g\n", + cpu_count, nr_cpu_ids); /* * We need to set the cpu_logical_map entries before enabling * the cpus so that cpu processor description entries (DT cpu nodes --=20 2.33.0