Skip to contentSkip to conversation

2 CPUs, but only one is used

DISCUSSION Giuliano Pochini 3 participants 9 messages Dec 17, 2006 – Dec 29, 2006

lore
Share & tools
lore
#0 lore raw

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

--
Giuliano.

#1 lore raw
Quoted 8 lines · On Sun, 17 Dec 2006 14:41:27 +0100 Giuliano Pochini <[email protected]> wrote:

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

I tried to reproduce the problem on an intel box, but I couldn't. /sys contains only the cpu0 file if it boots with maxcpus=1.

--
Giuliano.

#2 lore raw
Quoted 10 lines · Giuliano Pochini
Quoted 5 lines · On Sun, 17 Dec 2006 14:41:27 +0100 Giuliano Pochini <[email protected]> wrote:

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

Quoted 10 lines
Quoted 5 lines

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

I tried to reproduce the problem on an intel box, but I couldn't. /sys contains only the cpu0 file if it boots with maxcpus=1.

On powerpc, when maxcpus=1 is passed, it does not reflect that change in cpu_possible_map. This possible bitmap is created based on device-tree. Where as on i386, it does. I.e, cpu_possible_map contains only one cpu. /sys entries will be created based on cpu_possible_map (I think). Hence, you noticed only cpu0 entry on Intel box.

- Haren

Quoted 9 lines

--
Giuliano.
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#3 lore raw
In reply to Giuliano Pochini
Quoted 8 lines · Giuliano Pochini
Quoted 5 lines · On Sun, 17 Dec 2006 14:41:27 +0100 Giuliano Pochini <[email protected]> wrote:

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

Quoted 6 lines
Quoted 3 lines

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

I tried to reproduce the problem on an intel box, but I couldn't. /sys contains only the cpu0 file if it boots with maxcpus=1.

Can you try to git bisect to find the change which caused the regression?

#4 lore raw
Quoted 13 lines · On Wed, 20 Dec 2006 08:16:55 -0600 Nathan Lynch <[email protected]> wrote:
Quoted 12 lines · Giuliano Pochini
Quoted 8 lines · On Sun, 17 Dec 2006 14:41:27 +0100 Giuliano Pochini <[email protected]> wrote:

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

Quoted 5 lines
Quoted 2 lines

I tried to reproduce the problem on an intel box, but I couldn't. /sys contains only the cpu0 file if it boots with maxcpus=1.

Can you try to git bisect to find the change which caused the regression?

*sigh* There are too much changes in the scheduler of 2.6.19 and in the ppc code. I'm trying to find the problem in another way.

--
Giuliano.

#5 lore raw
In reply to Nathan Lynch
Quoted 9 lines · On Wed, 20 Dec 2006 08:16:55 -0600 Nathan Lynch <[email protected]> wrote:
Quoted 9 lines
Quoted 8 lines

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

I saw that there are some cpu hotplug related changes in 2.6.19, but I have no access to a non-ppc dual cpu box to check if the problem also affects other architectures right now.

Quoted 6 lines
Quoted 2 lines

I tried to reproduce the problem on an intel box, but I couldn't. /sys contains only the cpu0 file if it boots with maxcpus=1.

Can you try to git bisect to find the change which caused the regression?

I finally have some time to spend on this issue.

At the end of kernel/cpu.c::cpu_up() both cpus are set as present, possible and online. The problem is that in kernel/sched.c::find_idlest_group() p->cpus_allowed is always 1 (it should be 3). I tried to put a dump_stack() or a printk(mask) in set_cpu_mask() but it crashes badly when mask is not 3, ie. anything different from khelper or kthread, so I couldn't know what sets the wrong cpumask.

--
Giuliano.

#6 lore raw
Quoted 4 lines · Giuliano Pochini

I have a dual G4 MDD mac running linux 2.6.19. When I boot with maxcpus=1 and then I issue "echo 1 >/sys/devices/system/cpu/cpu1/online" the second CPU is put online without errors, but it stays idle+wait=100% and of course user+system+nice=0%. It works fine without maxcpus=1. No problems with 2.6.18.

...

Quoted 6 lines

At the end of kernel/cpu.c::cpu_up() both cpus are set as present, possible and online. The problem is that in kernel/sched.c::find_idlest_group() p->cpus_allowed is always 1 (it should be 3). I tried to put a dump_stack() or a printk(mask) in set_cpu_mask() but it crashes badly when mask is not 3, ie. anything different from khelper or kthread, so I couldn't know what sets the wrong cpumask.

Does this fix it?

kernel/sched.c +1 -1
index b515e3c..3c8b1c5 100644
@@ -6875,7 +6875,7 @@ void __init sched_init_smp(void)
 
 	lock_cpu_hotplug();
 	arch_init_sched_domains(&cpu_online_map);
-	cpus_andnot(non_isolated_cpus, cpu_online_map, cpu_isolated_map);
+	cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);
 	if (cpus_empty(non_isolated_cpus))
 		cpu_set(smp_processor_id(), non_isolated_cpus);
 	unlock_cpu_hotplug();
#7 lore raw
Quoted 14 lines · On Sun, 24 Dec 2006 23:52:51 -0600 Nathan Lynch <[email protected]> wrote:
Quoted 6 lines

At the end of kernel/cpu.c::cpu_up() both cpus are set as present, possible and online. The problem is that in kernel/sched.c::find_idlest_group() p->cpus_allowed is always 1 (it should be 3). I tried to put a dump_stack() or a printk(mask) in set_cpu_mask() but it crashes badly when mask is not 3, ie. anything different from khelper or kthread, so I couldn't know what sets the wrong cpumask.

Does this fix it?

kernel/sched.c +0 -0
index b515e3c..3c8b1c5 100644

kernel/sched.c void __init sched_init_smp(void) · line 6881

Quoted 8 lines
kernel/sched.c +1 -1
@@ -6875,7 +6875,7 @@ void __init sched_init_smp(void)
 
 	lock_cpu_hotplug();
 	arch_init_sched_domains(&cpu_online_map);
-	cpus_andnot(non_isolated_cpus, cpu_online_map, cpu_isolated_map);
+	cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);
 	if (cpus_empty(non_isolated_cpus))
 		cpu_set(smp_processor_id(), non_isolated_cpus);
 	unlock_cpu_hotplug();

Yes, it does. I also tested if tasks are migrated to/off cpu1 when I enable/disable it and when I boot with or without maxcpus=1. It seems to work correctly in all cases. Thank you.

--
Giuliano.

#8 lore raw
In reply to Nathan Lynch

[I resend this msg because I didn't receive it back from the lppc ml]

Quoted 14 lines · On Sun, 24 Dec 2006 23:52:51 -0600 Nathan Lynch <[email protected]> wrote:
Quoted 6 lines

At the end of kernel/cpu.c::cpu_up() both cpus are set as present, possible and online. The problem is that in kernel/sched.c::find_idlest_group() p->cpus_allowed is always 1 (it should be 3). I tried to put a dump_stack() or a printk(mask) in set_cpu_mask() but it crashes badly when mask is not 3, ie. anything different from khelper or kthread, so I couldn't know what sets the wrong cpumask.

Does this fix it?

kernel/sched.c +0 -0
index b515e3c..3c8b1c5 100644

kernel/sched.c void __init sched_init_smp(void) · line 6881

Quoted 8 lines
kernel/sched.c +1 -1
@@ -6875,7 +6875,7 @@ void __init sched_init_smp(void)
 
 	lock_cpu_hotplug();
 	arch_init_sched_domains(&cpu_online_map);
-	cpus_andnot(non_isolated_cpus, cpu_online_map, cpu_isolated_map);
+	cpus_andnot(non_isolated_cpus, cpu_possible_map, cpu_isolated_map);
 	if (cpus_empty(non_isolated_cpus))
 		cpu_set(smp_processor_id(), non_isolated_cpus);
 	unlock_cpu_hotplug();

Yes, it does. I also tested if tasks are migrated to/off cpu1 when I enable/disable it and when I boot with or without maxcpus=1. It seems to work correctly in all cases. Thank you.

--
Giuliano.