Skip to contentSkip to conversation

the return value of is_smp() is bug?

SMP BUG? Wang Long 3 participants 5 messages Sep 1, 2014 – Sep 4, 2014 Arm (32-bit)

lore
Share & tools
lore

Wang Long

author
#0 lore raw

Hi,all

In kernel 3.17-rc2, when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y in .config file. the secondary core can not boot.

when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = n in .config file, the secondary core can boot.

But this does not happen in kernel 3.10 lts kernel, Whether the CONFIG_SMP_ON_UP is set yes or no ,the secondary core can boot.

Does the meaning of CONFIG_SMP_ON_UP changed or this is a bug in kernel 3.17-rc2 ?

I write the following patch to test the return value of is_smp().

----------------------------------------

---
 arch/arm/kernel/setup.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/kernel/setup.c +5 -0
index 84db893d..fbeb67f 100644
@@ -925,6 +925,11 @@ void __init setup_arch(char **cmdline_p)
 	arm_dt_init_cpu_maps();
 	psci_init();
 #ifdef CONFIG_SMP
+	
+	if (is_smp() == 1)
+		printk("is_smp() return true;\n");
+	else if (is_smp() == 0)
+		printk("is_smp() return false;\n");
 	if (is_smp()) {
 		if (!mdesc->smp_init || !mdesc->smp_init()) {
 			if (psci_smp_available())

kernel version: 3.17-rc2

config:     set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

..........
is_smp() return false;
CPU: Testing write buffer coherency: ok
missing device node for CPU 0
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 Setting up static identity map for 0x604643d8 - 0x60464430 Brought up 1 CPUs
SMP: Total of 1 processors activated.
CPU: All CPU(s) started in SVC mode.
...........

config:     set CONFIG_HAVE_SMP = y and not set CONFIG_SMP_ON_UP 
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

.....
Memory policy: Data cache writealloc
is_smp() return true;
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
......
......
CPU: Testing write buffer coherency: ok
missing device node for CPU 0
missing device node for CPU 1
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x60463ef8 - 0x60463f50
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
.......

Any ideas?

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Wang Long

Hi,all

In kernel 3.17-rc2, when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y in .config file. the secondary core can not boot.

Quoted 9 lines

when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = n in .config file, the secondary core can boot.

But this does not happen in kernel 3.10 lts kernel, Whether the CONFIG_SMP_ON_UP is set yes or no ,the secondary core can boot.

Does the meaning of CONFIG_SMP_ON_UP changed or this is a bug in kernel 3.17-rc2 ?

hi Arnd

In above two cases, i also set CONFIG_SMP = y. in addtion, the CONFIG_SMP_ON_UP depends on CONFIG_SMP. when set CONFIG_SMP_ON_UP = y, the value of CONFIG_SMP must be y.

Quoted 69 lines

I write the following patch to test the return value of is_smp().

----------------------------------------

---
 arch/arm/kernel/setup.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/arm/kernel/setup.c +5 -0
index 84db893d..fbeb67f 100644
@@ -925,6 +925,11 @@ void __init setup_arch(char **cmdline_p)
 	arm_dt_init_cpu_maps();
 	psci_init();
 #ifdef CONFIG_SMP
+	
+	if (is_smp() == 1)
+		printk("is_smp() return true;\n");
+	else if (is_smp() == 0)
+		printk("is_smp() return false;\n");
 	if (is_smp()) {
 		if (!mdesc->smp_init || !mdesc->smp_init()) {
 			if (psci_smp_available())

kernel version: 3.17-rc2

config:     set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

..........
is_smp() return false;
CPU: Testing write buffer coherency: ok
missing device node for CPU 0
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000 Setting up static identity map for 0x604643d8 - 0x60464430 Brought up 1 CPUs
SMP: Total of 1 processors activated.
CPU: All CPU(s) started in SVC mode.
...........

config:     set CONFIG_HAVE_SMP = y and not set CONFIG_SMP_ON_UP 
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

.....
Memory policy: Data cache writealloc
is_smp() return true;
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
......
......
CPU: Testing write buffer coherency: ok
missing device node for CPU 0
missing device node for CPU 1
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x60463ef8 - 0x60463f50
CPU1: Booted secondary processor
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated.
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
.......

Any ideas?

#2 lore raw
Quoted 17 lines · On Monday 01 September 2014 18:00:58 long.wanglong wrote:
Quoted 6 lines · Wang Long

Hi,all

In kernel 3.17-rc2, when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y in .config file. the secondary core can not boot.

Quoted 9 lines

when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = n in .config file, the secondary core can boot.

But this does not happen in kernel 3.10 lts kernel, Whether the CONFIG_SMP_ON_UP is set yes or no ,the secondary core can boot.

Does the meaning of CONFIG_SMP_ON_UP changed or this is a bug in kernel 3.17-rc2 ?

Quoted 5 lines

hi Arnd

In above two cases, i also set CONFIG_SMP = y. in addtion, the CONFIG_SMP_ON_UP depends on CONFIG_SMP. when set CONFIG_SMP_ON_UP = y, the value of CONFIG_SMP must be y.

I see.

I'm looking at the code more closely now:

Quoted 6 lines
Quoted 6 lines
config:     set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

..........
is_smp() return false;

This test basically checks whether the __fixup_smp_on_up code was run or not. This has changed in bc41b8724f24 "ARM: 7846/1: Update SMP_ON_UP code to detect A9MPCore with 1 CPU devices", in order to support a quirk in the Aegis platform. Can you try reverting that commit?

Arnd

#3 lore raw
Quoted 41 lines · Arnd Bergmann
Quoted 17 lines · On Monday 01 September 2014 18:00:58 long.wanglong wrote:
Quoted 6 lines · Wang Long

Hi,all

In kernel 3.17-rc2, when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y in .config file. the secondary core can not boot.

Quoted 9 lines

when i set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = n in .config file, the secondary core can boot.

But this does not happen in kernel 3.10 lts kernel, Whether the CONFIG_SMP_ON_UP is set yes or no ,the secondary core can boot.

Does the meaning of CONFIG_SMP_ON_UP changed or this is a bug in kernel 3.17-rc2 ?

Quoted 5 lines

hi Arnd

In above two cases, i also set CONFIG_SMP = y. in addtion, the CONFIG_SMP_ON_UP depends on CONFIG_SMP. when set CONFIG_SMP_ON_UP = y, the value of CONFIG_SMP must be y.

I see.

I'm looking at the code more closely now:

Quoted 6 lines
Quoted 6 lines
config:     set CONFIG_HAVE_SMP = y and CONFIG_SMP_ON_UP = y
command:    # qemu-system-arm -M vexpress-a9 -smp 2  -m 128M -kernel arch/arm/boot/zImage -nographic

The output:

..........
is_smp() return false;

This test basically checks whether the __fixup_smp_on_up code was run or not. This has changed in bc41b8724f24 "ARM: 7846/1: Update SMP_ON_UP code to detect A9MPCore with 1 CPU devices", in order to support a quirk in the Aegis platform. Can you try reverting that commit?

Quoted 4 lines

Arnd

.

Hi Arnd

When i revert the commit bc41b8724f24, the secondary core can boot. The problem is that qemu doesn't provide emulation of the SCU base address register. When reading the SCU base, qemu just return 0.

In the real hardware, there is no this problem.

#4 lore raw
Quoted 3 lines · long.wanglong

When i revert the commit bc41b8724f24, the secondary core can boot. The problem is that qemu doesn't provide emulation of the SCU base address register. When reading the SCU base, qemu just return 0.

You need to upgrade your QEMU -- we improved the emulation of all our Cortex-A9 boards to make sure they set valid values for the base address register, in order to fix exactly this regression. QEMU 2.0 or later should work.

(As an aside, I think the Aegis quirk test is pretty ugly:
"base address happens to be set to zero" is not exactly a very reliable way to identify a particular SoC. However in this case QEMU was emulating real h/w insufficiently accurately, so we fixed it.)

thanks
-- PMM