Skip to content

Commit 9ff4275

Browse files
committed
x86/apic: Use BAD_APICID consistently
APIC ID checks compare with BAD_APICID all over the place, but some initializers and some code which fiddles with global data structure use -1[U] instead. That simply cannot work at all. Fix it up and use BAD_APICID consistently all over the place. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juergen Gross <[email protected]> Tested-by: Sohil Mehta <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Peter Zijlstra (Intel) <[email protected]> Tested-by: Zhang Rui <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6e29032 commit 9ff4275

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

arch/x86/kernel/acpi/boot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ int acpi_unmap_cpu(int cpu)
856856
set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
857857
#endif
858858

859-
per_cpu(x86_cpu_to_apicid, cpu) = -1;
859+
per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
860860
set_cpu_present(cpu, false);
861861
num_processors--;
862862

arch/x86/kernel/apic/apic.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ unsigned int num_processors;
7272
unsigned disabled_cpus;
7373

7474
/* Processor that is doing the boot up */
75-
unsigned int boot_cpu_physical_apicid __ro_after_init = -1U;
75+
unsigned int boot_cpu_physical_apicid __ro_after_init = BAD_APICID;
7676
EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid);
7777

7878
u8 boot_cpu_apic_version __ro_after_init;
@@ -2318,9 +2318,7 @@ static int nr_logical_cpuids = 1;
23182318
/*
23192319
* Used to store mapping between logical CPU IDs and APIC IDs.
23202320
*/
2321-
int cpuid_to_apicid[] = {
2322-
[0 ... NR_CPUS - 1] = -1,
2323-
};
2321+
int cpuid_to_apicid[] = { [0 ... NR_CPUS - 1] = BAD_APICID, };
23242322

23252323
bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
23262324
{

0 commit comments

Comments
 (0)