linux/Documentation/arch/arm64
Jinjie Ruan f9a82544c7 cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable()
On arm64, 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.

In cpuhp_smt_enable(), the code iterates over all present CPUs. Calling
_cpu_up() for these unregistered CPUs eventually leads to
sysfs_create_group() being called with a NULL kobject (or a kobject
without a directory), triggering the following warning in
fs/sysfs/group.c:

  WARNING: fs/sysfs/group.c:137 at internal_create_group+0x41c/0x4bc, CPU#2: sh/181
  [...]
  Call trace:
    internal_create_group+0x41c/0x4bc (P)
    sysfs_create_group+0x18/0x24
    topology_add_dev+0x1c/0x28
    cpuhp_invoke_callback+0x104/0x20c
    __cpuhp_invoke_callback_range+0x94/0x11c
    _cpu_up+0x200/0x37c

When booting with ACPI, arm64 smp_prepare_cpus() currently sets all
enumerated CPUs as "present" regardless of their status in the MADT. This
causes issues with SMT hotplug control. For instance, with QEMU's
"-smp 4,maxcpus=8" configuration, the MADT GICC entries are populated as
follows:

1. The first four CPUs: `Enabled` set but `Online Capable` not set.

2. The remaining four CPUs: `Online Capable` set but `Enabled` not set
   to support potential hot-plugging.

Fix this by:

1. When booting with ACPI, checking the ACPI_MADT_ENABLED flag in the GICC
   entry before calling set_cpu_present() during SMP initialization.

2. Properly managing the present mask in acpi_map_cpu() and
   acpi_unmap_cpu() to support actual CPU hotplug events, This aligns with
   other architectures like x86 and LoongArch.

3. Update the arm64 CPU hotplug documentation to no longer state that all
   online-capable vCPUs are marked as present by the kernel at boot time.

This ensures that only physically available or explicitly enabled CPUs
are in the present mask, keeping the SMT control logic consistent with
the actual hardware state.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Cc: stable@vger.kernel.org
Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#gic-cpu-interface-gicc-structure
Fixes: eed4583bcf ("arm64: Kconfig: Enable HOTPLUG_SMT")
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Signed-off-by: Will Deacon <will@kernel.org>
2026-06-29 11:47:36 +01:00
..
acpi_object_usage.rst Documentation: Fix typos 2023-08-18 11:29:03 -06:00
amu.rst Docs/arch/arm64: Fix spelling in amu.rst 2025-03-04 09:37:44 -07:00
arm-acpi.rst docs: fix 're-use' -> 'reuse' in documentation 2026-02-02 09:54:15 -07:00
arm-cca.rst arm64: Document Arm Confidential Compute 2024-10-23 10:19:33 +01:00
asymmetric-32bit.rst sched/arm64: Move fallback task cpumask to HK_TYPE_DOMAIN 2026-02-03 15:23:35 +01:00
booting.rst arm64: Add support for FEAT_{LS64, LS64_V} 2026-01-22 13:24:49 +00:00
cpu-feature-registers.rst arm64: Expose AIDR_EL1 via sysfs 2025-04-29 14:03:18 +01:00
cpu-hotplug.rst cpu/hotplug: Fix NULL kobject warning in cpuhp_smt_enable() 2026-06-29 11:47:36 +01:00
elf_hwcaps.rst arm64: Document SVE constraints on new hwcaps 2026-06-03 12:49:21 +01:00
features.rst docs: kernel_feat.py: fix potential command injection 2024-01-11 09:21:01 -07:00
gcs.rst arm64/gcs: Fix documentation for HWCAP 2025-02-04 12:26:26 +00:00
hugetlbpage.rst docs: arm64: Move arm64 documentation under Documentation/arch/ 2023-06-21 08:51:51 -06:00
index.rst arm64: mpam: Add initial MPAM documentation 2026-03-27 15:32:52 +00:00
kasan-offsets.sh docs: arm64: Move arm64 documentation under Documentation/arch/ 2023-06-21 08:51:51 -06:00
kdump.rst Move the arm64 architecture documentation under Documentation/arch/. This 2023-06-27 21:52:15 -07:00
legacy_instructions.rst docs: arm64: Move arm64 documentation under Documentation/arch/ 2023-06-21 08:51:51 -06:00
memory-tagging-extension.rst Documentation: arch: fix brackets 2026-06-12 13:16:01 -06:00
memory.rst Documentation: arm64: Remove stale and redundant virtual memory diagrams 2025-01-13 16:40:30 +00:00
mops.rst arm64: mops: Document requirements for hypervisors 2024-11-01 14:52:24 +00:00
mpam.rst arm64: mpam: Add initial MPAM documentation 2026-03-27 15:32:52 +00:00
perf.rst Documentation: arm64: Document the PMU event counting threshold feature 2023-12-12 09:46:23 +00:00
pointer-authentication.rst docs: arm64: Move arm64 documentation under Documentation/arch/ 2023-06-21 08:51:51 -06:00
ptdump.rst docs: arm64: drop PTDUMP config options from ptdump.rst 2025-03-17 00:05:31 -07:00
silicon-errata.rst arm64: errata: Mitigate TLBI errata on Microsoft Azure Cobalt 100 CPU 2026-06-10 12:00:21 +01:00
sme.rst arm64/sme: Drop inaccurate documentation of streaming mode switches 2025-09-08 13:25:38 +01:00
sve.rst arm64/sme: Support disabling streaming mode via ptrace on SME only systems 2025-11-17 20:11:54 +00:00
tagged-address-abi.rst docs: arm64: Move arm64 documentation under Documentation/arch/ 2023-06-21 08:51:51 -06:00
tagged-pointers.rst arm64: Report address tag when FEAT_MTE_TAGGED_FAR is supported 2025-07-02 17:44:17 +01:00