Skip to contentSkip to conversation

x86: fix missing cpu_index initialisation

PATCH Applied James Bottomley 3 participants 7 messages Oct 30, 2008 – Oct 31, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix missing cpu_index initialisation

Quoted 1 line

From f49bbb826d8ec87609a63fb014af6aacb16aac38 Mon Sep 17 00:00:00 2001

From: James Bottomley <[email protected]>
Date: Wed, 29 Oct 2008 15:13:09 -0500
Subject: [VOYAGER] x86: fix missing cpu_index initialisation

Ever since

commit 92cb7612aee39642d109b8d935ad265e602c0563

Author: Mike Travis <[email protected]>
Date:   Fri Oct 19 20:35:04 2007 +0200

x86: convert cpuinfo_x86 array to a per_cpu array

We've had an extra field in cpuinfo_x86 which is cpu_index. Unfortunately, voyager has never initialised this, although the only noticeable impact seems to be that /proc/cpuinfo shows all zeros for the processor ids.

Anyway, fix this by initialising the boot CPU properly and setting the index when the secondaries update.

---

Depends on [VOYAGER] x86: add ability to test for boot CPU

 arch/x86/kernel/cpu/common.c        |    2 ++
 arch/x86/mach-voyager/voyager_smp.c |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/common.c +2 -0
index 93e9393..da8f15a 100644
@@ -549,6 +549,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 		this_cpu->c_early_init(c);
 
 	validate_pat_support(c);
+
+	c->cpu_index = boot_cpu_id;
 }
 
 void __init early_cpu_init(void)
arch/x86/mach-voyager/voyager_smp.c +1 -0
index 63ed72b..761d491 100644
@@ -415,6 +415,7 @@ void __init smp_store_cpu_info(int id)
 	struct cpuinfo_x86 *c = &cpu_data(id);
 
 	*c = boot_cpu_data;
+	c->cpu_index = id;
 
 	identify_secondary_cpu(c);
 }
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 35 lines · James Bottomley
Quoted 1 line

From f49bbb826d8ec87609a63fb014af6aacb16aac38 Mon Sep 17 00:00:00 2001

From: James Bottomley <[email protected]>
Date: Wed, 29 Oct 2008 15:13:09 -0500
Subject: [VOYAGER] x86: fix missing cpu_index initialisation

Ever since

commit 92cb7612aee39642d109b8d935ad265e602c0563

Author: Mike Travis <[email protected]>
Date:   Fri Oct 19 20:35:04 2007 +0200

x86: convert cpuinfo_x86 array to a per_cpu array

We've had an extra field in cpuinfo_x86 which is cpu_index. Unfortunately, voyager has never initialised this, although the only noticeable impact seems to be that /proc/cpuinfo shows all zeros for the processor ids.

Anyway, fix this by initialising the boot CPU properly and setting the index when the secondaries update.

---

Depends on [VOYAGER] x86: add ability to test for boot CPU

 arch/x86/kernel/cpu/common.c        |    2 ++
 arch/x86/mach-voyager/voyager_smp.c |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/common.c +0 -0
index 93e9393..da8f15a 100644

arch/x86/kernel/cpu/common.c static void __init early_identify_cpu(struct cpuinfo_x86 *c) · line 554

Quoted 6 lines
arch/x86/kernel/cpu/common.c +2 -0
@@ -549,6 +549,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
               this_cpu->c_early_init(c);
 
       validate_pat_support(c);
+
+       c->cpu_index = boot_cpu_id;
 }

...
CC arch/x86/kernel/cpu/common.o
arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'boot_cpu_id' undeclared (first use in this function)
arch/x86/kernel/cpu/common.c:553: error: (Each undeclared identifier is reported only once
arch/x86/kernel/cpu/common.c:553: error: for each function it appears in.) make[2]: *** [arch/x86/kernel/cpu/common.o] Error 1
make[1]: *** [arch/x86/kernel/cpu] Error 2
make: *** [arch/x86/kernel] Error 2

YH

#2 lore raw
Quoted 10 lines · Yinghai Lu

CC arch/x86/kernel/cpu/common.o
arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'boot_cpu_id' undeclared (first use in this function)
arch/x86/kernel/cpu/common.c:553: error: (Each undeclared identifier is reported only once
arch/x86/kernel/cpu/common.c:553: error: for each function it appears in.) make[2]: *** [arch/x86/kernel/cpu/common.o] Error 1
make[1]: *** [arch/x86/kernel/cpu] Error 2
make: *** [arch/x86/kernel] Error 2

depends on this patch perhaps:

Subject: [PATCH] fix compile breakage caused by dc1e35c6e95e8923cf1d3510438b63c600fee1e2

?

Ingo

#3 lore raw
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Yinghai Lu

CC arch/x86/kernel/cpu/common.o
arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'boot_cpu_id' undeclared (first use in this function)
arch/x86/kernel/cpu/common.c:553: error: (Each undeclared identifier is reported only once
arch/x86/kernel/cpu/common.c:553: error: for each function it appears in.) make[2]: *** [arch/x86/kernel/cpu/common.o] Error 1
make[1]: *** [arch/x86/kernel/cpu] Error 2
make: *** [arch/x86/kernel] Error 2

Quoted 3 lines

depends on this patch perhaps:

Subject: [PATCH] fix compile breakage caused by dc1e35c6e95e8923cf1d3510438b63c600fee1e2

Yes, sorry, that's what the line:

Quoted 6 lines

---

Depends on [VOYAGER] x86: add ability to test for boot CPU

 arch/x86/kernel/cpu/common.c        |    2 ++

Was supposed to convey

James

Applied
#4 lore raw
In reply to James Bottomley
Quoted 18 lines · James Bottomley
Quoted 1 line

From f49bbb826d8ec87609a63fb014af6aacb16aac38 Mon Sep 17 00:00:00 2001

From: James Bottomley <[email protected]>
Date: Wed, 29 Oct 2008 15:13:09 -0500
Subject: [VOYAGER] x86: fix missing cpu_index initialisation

Ever since

commit 92cb7612aee39642d109b8d935ad265e602c0563

Author: Mike Travis <[email protected]>
Date:   Fri Oct 19 20:35:04 2007 +0200

x86: convert cpuinfo_x86 array to a per_cpu array

We've had an extra field in cpuinfo_x86 which is cpu_index. Unfortunately, voyager has never initialised this, although the only noticeable impact seems to be that /proc/cpuinfo shows all zeros for the processor ids.

Quoted 7 lines

Anyway, fix this by initialising the boot CPU properly and setting the index when the secondaries update.

---

Depends on [VOYAGER] x86: add ability to test for boot CPU

applied both to tip/x86/urgent:

6b5496e: x86/voyager: fix missing cpu_index initialisation 3b25aec: x86/voyager: fix compile breakage caused by dc1e35c6e95e8923cf1d35104

thanks James,

Ingo

#5 lore raw
Quoted 6 lines · Ingo Molnar
Quoted 1 line

Depends on [VOYAGER] x86: add ability to test for boot CPU

applied both to tip/x86/urgent:

6b5496e: x86/voyager: fix missing cpu_index initialisation 3b25aec: x86/voyager: fix compile breakage caused by dc1e35c6e95e8923cf1d35104

this broke the x86 build:

arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'struct cpuinfo_x86' has no member named 'cpu_index'

fixed via the patch below.

Ingo

---------->

Quoted 1 line

From 1c4acdb467f8a6704855a5670ff3d82e3c18eb0b Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 31 Oct 2008 00:43:03 +0100
Subject: [PATCH] x86: cpu_index build fix

fix:

arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'struct cpuinfo_x86' has no member named 'cpu_index'

as cpu_index is only available on SMP.

---
 arch/x86/kernel/cpu/common.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/common.c +2 -0
index da8f15a..003a653 100644
@@ -550,7 +550,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 
 	validate_pat_support(c);
 
+#ifdef CONFIG_SMP
 	c->cpu_index = boot_cpu_id;
+#endif
 }
 
 void __init early_cpu_init(void)
#6 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 6 lines · Ingo Molnar
Quoted 1 line

Depends on [VOYAGER] x86: add ability to test for boot CPU

applied both to tip/x86/urgent:

6b5496e: x86/voyager: fix missing cpu_index initialisation 3b25aec: x86/voyager: fix compile breakage caused by dc1e35c6e95e8923cf1d35104

Quoted 6 lines

this broke the x86 build:

arch/x86/kernel/cpu/common.c: In function 'early_identify_cpu':
arch/x86/kernel/cpu/common.c:553: error: 'struct cpuinfo_x86' has no member named 'cpu_index'

fixed via the patch below.

i just found a third build failure as well, caused by the voyager fixes:

arch/x86/kernel/cpu/common.c: In function 'cpu_init':
arch/x86/kernel/cpu/common.c:1141: error: 'boot_cpu_id' undeclared (first use in this function) arch/x86/kernel/cpu/common.c:1141: error: (Each undeclared identifier is reported only once arch/x86/kernel/cpu/common.c:1141: error: for each function it appears in.)

(see the fix below)

this raises the urgency the conversion of x86/Voyager to normal x86 platform APIs.

Ingo

---------------->

Quoted 1 line

From b342797c1e5116a130841527b47dfaa462ed0968 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 31 Oct 2008 09:31:38 +0100
Subject: [PATCH] x86: build fix

Impact: build fix on certain UP configs

fix:

arch/x86/kernel/cpu/common.c: In function 'cpu_init':
arch/x86/kernel/cpu/common.c:1141: error: 'boot_cpu_id' undeclared (first use in this function) arch/x86/kernel/cpu/common.c:1141: error: (Each undeclared identifier is reported only once arch/x86/kernel/cpu/common.c:1141: error: for each function it appears in.)

Pull in asm/smp.h on UP, so that we get the definition of boot_cpu_id.

---
 arch/x86/kernel/cpu/common.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/common.c +1 -0
index 003a653..b9c9ea0 100644
@@ -20,6 +20,7 @@
 #include <asm/pat.h>
 #include <asm/asm.h>
 #include <asm/numa.h>
+#include <asm/smp.h>
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/mpspec.h>
 #include <asm/apic.h>