Skip to content

Commit d4df174

Browse files
committed
Merge tag 'x86-urgent-2025-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Fix a CPU topology code regression that caused the mishandling of certain boot command line options, and re-enable CONFIG_PTDUMP on i386 that was mistakenly turned off in the Kconfig" * tag 'x86-urgent-2025-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/topology: Implement topology_is_core_online() to address SMT regression x86/Kconfig: Reenable PTDUMP on i386
2 parents 083fc6d + 2066f00 commit d4df174

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ config X86_64
2626
depends on 64BIT
2727
# Options that are inherently 64-bit kernel only:
2828
select ARCH_HAS_GIGANTIC_PAGE
29-
select ARCH_HAS_PTDUMP
3029
select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
3130
select ARCH_SUPPORTS_INT128 if CC_HAS_INT128
3231
select ARCH_SUPPORTS_PER_VMA_LOCK
@@ -99,6 +98,7 @@ config X86
9998
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
10099
select ARCH_HAS_PMEM_API if X86_64
101100
select ARCH_HAS_PREEMPT_LAZY
101+
select ARCH_HAS_PTDUMP
102102
select ARCH_HAS_PTE_SPECIAL
103103
select ARCH_HAS_HW_PTE_YOUNG
104104
select ARCH_HAS_NONLEAF_PMD_YOUNG if PGTABLE_LEVELS > 2

arch/x86/include/asm/topology.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,16 @@ static inline bool topology_is_primary_thread(unsigned int cpu)
231231
}
232232
#define topology_is_primary_thread topology_is_primary_thread
233233

234+
int topology_get_primary_thread(unsigned int cpu);
235+
236+
static inline bool topology_is_core_online(unsigned int cpu)
237+
{
238+
int pcpu = topology_get_primary_thread(cpu);
239+
240+
return pcpu >= 0 ? cpu_online(pcpu) : false;
241+
}
242+
#define topology_is_core_online topology_is_core_online
243+
234244
#else /* CONFIG_SMP */
235245
static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
236246
static inline int topology_max_smt_threads(void) { return 1; }

arch/x86/kernel/cpu/topology.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,19 @@ unsigned int topology_unit_count(u32 apicid, enum x86_topology_domains which_uni
372372
return topo_unit_count(lvlid, at_level, apic_maps[which_units].map);
373373
}
374374

375+
#ifdef CONFIG_SMP
376+
int topology_get_primary_thread(unsigned int cpu)
377+
{
378+
u32 apic_id = cpuid_to_apicid[cpu];
379+
380+
/*
381+
* Get the core domain level APIC id, which is the primary thread
382+
* and return the CPU number assigned to it.
383+
*/
384+
return topo_lookup_cpuid(topo_apicid(apic_id, TOPO_CORE_DOMAIN));
385+
}
386+
#endif
387+
375388
#ifdef CONFIG_ACPI_HOTPLUG_CPU
376389
/**
377390
* topology_hotplug_apic - Handle a physical hotplugged APIC after boot

0 commit comments

Comments
 (0)