diff mbox series

[v2,11/38] x86/apic: Use BAD_APICID consistently;

Message ID 20230728120930.281607646@linutronix.de (mailing list archive)
State Not Applicable
Headers show
Series x86/cpu: Rework the topology evaluation | expand

Commit Message

Thomas Gleixner July 28, 2023, 12:12 p.m. UTC
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 consistenly all over the place.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/acpi/boot.c |    2 +-
 arch/x86/kernel/apic/apic.c |    6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Sohil Mehta July 28, 2023, 10:36 p.m. UTC | #1
There is an extra semicolon at the end of the patch subject.

On 7/28/2023 5:12 AM, Thomas Gleixner wrote:
> 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 consistenly all over the place.
> 

s/consistenly/consistently

-Sohil
Thomas Gleixner July 28, 2023, 10:50 p.m. UTC | #2
On Fri, Jul 28 2023 at 15:36, Sohil Mehta wrote:

> There is an extra semicolon at the end of the patch subject.

Oops

> On 7/28/2023 5:12 AM, Thomas Gleixner wrote:
>> 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 consistenly all over the place.
>> 
>
> s/consistenly/consistently

Indeed.
diff mbox series

Patch

--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -852,7 +852,7 @@  int acpi_unmap_cpu(int cpu)
 	set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
 #endif
 
-	per_cpu(x86_cpu_to_apicid, cpu) = -1;
+	per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
 	set_cpu_present(cpu, false);
 	num_processors--;
 
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -70,7 +70,7 @@  unsigned int num_processors;
 unsigned disabled_cpus;
 
 /* Processor that is doing the boot up */
-unsigned int boot_cpu_physical_apicid __ro_after_init = -1U;
+unsigned int boot_cpu_physical_apicid __ro_after_init = BAD_APICID;
 EXPORT_SYMBOL_GPL(boot_cpu_physical_apicid);
 
 u8 boot_cpu_apic_version __ro_after_init;
@@ -2316,9 +2316,7 @@  static int nr_logical_cpuids = 1;
 /*
  * Used to store mapping between logical CPU IDs and APIC IDs.
  */
-int cpuid_to_apicid[] = {
-	[0 ... NR_CPUS - 1] = -1,
-};
+int cpuid_to_apicid[] = { [0 ... NR_CPUS - 1] = BAD_APICID, };
 
 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {