From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 A77183ED5B0 for ; Thu, 23 Apr 2026 12:32:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776947573; cv=none; b=bMbmPWoo4kFoJfkHy8b9QgJ/X1nR1w8HxEpY/VeUl0qeS2sDUhfykroZNZp3EPlYRP5jFdgwHhQxtDyijiqgieb+H0K2Lin/nViwDnmZxbLpOVHihf2wmO3XtvUm8M9F2O7SPnfRmhU7XS1SXAVx7yVnWSKKiLrA5mWSYPooIZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776947573; c=relaxed/simple; bh=muylkL3jtMFVDPBGEHcjq6y5Iqw5RelFvnSa8VQJepo=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=dIeoCMmp8vg90gRJumo9DbPBrp7r3qxcxBximzWx/+CxuTDk7G7NaKPrNxBjDQjHq1fFOBxXA/9Fzo0WyLj0nLLeQ+nT73Sh7MxZOkf3jRXIxYkB792lymBYN+KyEXZuf+9IeF6Lkooy/nvx7MT8qB/46gkAknpJbmfsVUfZ5FQ= 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=vek5LSEi; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=vek5LSEi; arc=none smtp.client-ip=45.249.212.187 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="vek5LSEi"; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="vek5LSEi" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=fo94b7MqFfTgDj99SSJRoVZ8tjQmbwLpsx6plvLcAHM=; b=vek5LSEiClJIzXVuYeoZz7x2S2Tdsogj999dQK1WVA07tF3DQcFMWfs0U3I4hSuXRPdV6cwnl oh77IPF8Sf0Fm2pOh7U+7Dij9xeYsbipUZb9EuHXcEPZg7Tg58IlMf3jOruAIY9VdCYwiRNtbpQ COep4lW3SCwS/mz1FuWqW7Q= Received: from canpmsgout09.his.huawei.com (unknown [172.19.92.135]) by szxga01-in.huawei.com (SkyGuard) with ESMTPS id 4g1b7V1pf7z1BFyM for ; Thu, 23 Apr 2026 20:31:50 +0800 (CST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=fo94b7MqFfTgDj99SSJRoVZ8tjQmbwLpsx6plvLcAHM=; b=vek5LSEiClJIzXVuYeoZz7x2S2Tdsogj999dQK1WVA07tF3DQcFMWfs0U3I4hSuXRPdV6cwnl oh77IPF8Sf0Fm2pOh7U+7Dij9xeYsbipUZb9EuHXcEPZg7Tg58IlMf3jOruAIY9VdCYwiRNtbpQ COep4lW3SCwS/mz1FuWqW7Q= Received: from mail.maildlp.com (unknown [172.19.163.127]) by canpmsgout09.his.huawei.com (SkyGuard) with ESMTPS id 4g1b0z6Wksz1cyPZ; Thu, 23 Apr 2026 20:26:11 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 729E1402AB; Thu, 23 Apr 2026 20:32:34 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 23 Apr 2026 20:32:33 +0800 Message-ID: <78515da3-03a1-4fdb-a606-3fea9f4cd20b@huawei.com> Date: Thu, 23 Apr 2026 20:32:34 +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] cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable() To: Thomas Gleixner , Catalin Marinas CC: , , , , , , James Morse , References: <20260417075534.3745793-1-ruanjinjie@huawei.com> <87ldee0z1w.ffs@tglx> From: Jinjie Ruan In-Reply-To: <87ldee0z1w.ffs@tglx> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500011.china.huawei.com (7.185.36.131) On 4/23/2026 6:08 PM, Thomas Gleixner wrote: > On Sat, Apr 18 2026 at 12:55, Catalin Marinas wrote: >> Another option would have been to avoid marking such CPUs present but I >> think this will break other things. Yet another option is to register >> all CPU devices even if they never come up (like maxcpus greater than >> actual CPUs). >> >> Opinions? It might be an arm64+ACPI-only thing. > > I think so. The proper thing to do is to apply sane limits: > > 1) The possible CPUs enumerated by firmware N_POSSIBLE_FW > > 2) The maxcpus limit on the command line N_MAXCPUS_CL > > So the actual possible CPUs evaluates to: > > num_possible = min(N_POSSIBLE_FW, N_MAXCPUS_CL, CONFIG_NR_CPUS); > > The evaluation of the firmware should not mark CPUs present which are > actually not. ACPI gives you that information. See: > > 5.2.12.14 GIC CPU Interface (GICC) Structure > > in the ACPI spec. That has two related bits: > > Enabled: > > If this bit is set, the processor is ready for use. If this bit is > clear and the Online Capable bit is set, the system supports enabling > this processor during OS runtime. If this bit is clear and the Online > Capable bit is also clear, this processor is un- usable, and the > operating system support will not attempt to use it. > > Online Capable: > > The information conveyed by this bit depends on the value of the > Enabled bit. If the Enabled bit is set, this bit is reserved and must > be zero. Otherwise, if this bit is set, the system supports enabling > this processor later during OS runtime > > So the combination of those gives you the right answer: > > Enabled Online > Capable > 0 0 Not present, not possible > 0 1 Not present, but possible to "hotplug" layter > 1 0 Present > 1 1 Invalid On x86, it seems that all CPUs with the ACPI_MADT_ENABLED bit set will be marked as present. acpi_parse_x2apic() -> enabled = processor->lapic_flags & ACPI_MADT_ENABLED -> topology_register_apic(enabled) -> topo_register_apic(enabled) -> set_cpu_present(cpu, true) > > The kernel sizes everything on the number of possible CPUs and the > present CPU mask is only there to figure out which CPUs are actually > usable and can be brought up. > > The runtime physical hotplug mechanics use acpi_[un]map_cpu() to toggle > the present bit. > > Thanks, > > tglx > > >