From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EADD121D3E4 for ; Sat, 18 Apr 2026 15:05:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776524761; cv=none; b=Vy2gowIL6mxySdYF9Ds92oRp10UVCz9zp9XRlgVZgV/jCm4GPargkbq57eJYhwXUjkHX/PJY+jdId2UPs7IetT0YQ4HiQ2EgYtC4TwIhEKf6QReMAVMffiFfXkHbUd7lG8JT/FvBxch/gl/7q0kC+I9JX5A5cUiaPLufc6EdB0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776524761; c=relaxed/simple; bh=QjkMgdtnnr6QyAbjVKb3oOqBzdDyc0QvQhg3gnVrWj0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qb7Kb10qCjQvJTPYyZ/vyRts/2JFKSWZMGEv7O+nUwjtRp+m2fZ2O4Sg6nio+XQ/7bwZlmrMC814EPPbW16QAbhD2zdzh7Uiq+PUJH1ICJh5i9L9HCWGvhTM5uEc/BCxtzVPz0fyHBdlG+jpD4I2UEC+MOBTJumWr+AD3pVbLlY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=UbNeVP1C; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="UbNeVP1C" 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 7B4EA1A2D; Sat, 18 Apr 2026 08:05:52 -0700 (PDT) Received: from arm.com (unknown [10.57.88.248]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E46063F7B4; Sat, 18 Apr 2026 08:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1776524758; bh=QjkMgdtnnr6QyAbjVKb3oOqBzdDyc0QvQhg3gnVrWj0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UbNeVP1CiWfhKFVx05XTZeDzgYuoXzfA3WIb3LiMZkWsdFza6zq6qf104MV8waZWn xllyegoeZz1kyGDCRdtJzmW4W7K393qkMYc1MVLWlbVWI9GNn9+adHsAhexdYJHC53 5yb+klqyuMlaDz5PlOdJ0eeZtxZALwnX8rzhnTic= Date: Sat, 18 Apr 2026 16:05:52 +0100 From: Catalin Marinas To: Jinjie Ruan Cc: tglx@kernel.org, peterz@infradead.org, sudeep.holla@kernel.org, yangyicong@hisilicon.com, dietmar.eggemann@arm.com, Jonathan.Cameron@huawei.com, linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable() Message-ID: References: <20260417075534.3745793-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sat, Apr 18, 2026 at 12:55:22PM +0100, Catalin Marinas wrote: > On Fri, Apr 17, 2026 at 03:55:34PM +0800, Jinjie Ruan wrote: > > When booting with `maxcpus` greater than the number of present CPUs (e.g., > > QEMU -smp cpus=4,maxcpus=8), some CPUs are marked as 'present' but have not > > yet been registered via register_cpu(). Consequently, the per-cpu device > > objects for these CPUs are not yet initialized. [...] > 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). Something like below, untested (and I don't claim I properly understand this code; just lots of tokens used trying to make sense of it ;)) ------------------------8<------------------------- diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c index a9d884fd1d00..4c0a5ed906ea 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -448,12 +448,14 @@ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 apci_id, return *pcpu; } + set_cpu_present(*pcpu, true); return 0; } EXPORT_SYMBOL(acpi_map_cpu); int acpi_unmap_cpu(int cpu) { + set_cpu_present(cpu, false); return 0; } EXPORT_SYMBOL(acpi_unmap_cpu); diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 1aa324104afb..751a74d997e1 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -510,8 +510,10 @@ int arch_register_cpu(int cpu) struct cpu *c = &per_cpu(cpu_devices, cpu); if (!acpi_disabled && !acpi_handle && - IS_ENABLED(CONFIG_ACPI_HOTPLUG_CPU)) + IS_ENABLED(CONFIG_ACPI_HOTPLUG_CPU)) { + set_cpu_present(cpu, false); return -EPROBE_DEFER; + } #ifdef CONFIG_ACPI_HOTPLUG_CPU /* For now block anything that looks like physical CPU Hotplug */