Guest kernel crashes when booting a NUMA guest without explicitly specifying cpus= in -numa option
Public bug reported:
Target: x86_64-softmmu
Qemu Command line: [root@hs22 qemu-1.0-rc2]# ./x86_64-softmmu/qemu- system-x86_64 -smp sockets=2,cores=4,threads=2 -numa node,nodeid=0,mem=4g -numa node,nodeid=1,mem=1g -cpu core2duo -m 5g /home/bharata/f15-lvm -nographic --enable-kvm -net nic,macaddr=54:52:00:46:26:84,model=e1000 -net tap,script=/etc/qemu- if,ifname=vnet0
Qemu version: 1.0-rc2
When guest is started with -numa option without explicitly specifying the cpus=, guest kernel crashes as below:
[ 0.252159] divide error: 0000 [#1] SMP [ 0.252970] last sysfs file: [ 0.252970] CPU 1 [ 0.252970] Modules linked in: [ 0.252970] [ 0.252970] Pid: 2, comm: kthreadd Not tainted 2.6.38.6-26.rc1.fc15.x86_64 #1 Bochs Bochs [ 0.252970] RIP: 0010:[<ffffffff8104f4d4>] [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP: 0000:ffff88011767fc60 EFLAGS: 00010046 [ 0.252970] RAX: 0000000000000000 RBX: ffff88015d6ad300 RCX: 0000000000000000 [ 0.252970] RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000000 [ 0.252970] RBP: ffff88011767fd10 R08: 0000000000000100 R09: ffff88015d6ad338 [ 0.252970] R10: 0000000000013840 R11: 0000000000800711 R12: 0000000000000000 [ 0.252970] R13: ffff88015fc0f810 R14: 0000000000000001 R15: 0000000000000000 [ 0.252970] FS: 0000000000000000(0000) GS:ffff88015fc00000(0000) knlGS:0000000000000000 [ 0.252970] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.252970] CR2: 00000000ffffffff CR3: 0000000001a03000 CR4: 00000000000006e0 [ 0.252970] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.252970] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 0.252970] Process kthreadd (pid: 2, threadinfo ffff88011767e000, task ffff88015d671720) [ 0.252970] Stack: [ 0.252970] ffffffff81475873 ffffffff81a02140 ffff88011767fce0 ffffffff8106c5a3 [ 0.252970] ffff88015d6ad318 000000010000000e 0000000000013840 0000000000013840 [ 0.252970] ffff88015d6ad318 0000007d00000001 ffff880100000000 ffff88015d6d81e8 [ 0.252970] Call Trace: [ 0.252970] [<ffffffff81475873>] ? _raw_spin_lock_irq+0x1c/0x1e [ 0.252970] [<ffffffff8106c5a3>] ? alloc_pid+0x2e6/0x335 [ 0.252970] [<ffffffff81048960>] select_task_rq+0x16/0x46 [ 0.252970] [<ffffffff8104e29a>] wake_up_new_task+0x3a/0xde [ 0.252970] [<ffffffff810546ce>] do_fork+0x1f1/0x2bf [ 0.252970] [<ffffffff8100804e>] ? load_TLS+0x10/0x14 [ 0.252970] [<ffffffff81008714>] ? __switch_to+0xc6/0x220 [ 0.252970] [<ffffffff81010c1a>] kernel_thread+0x75/0x77 [ 0.252970] [<ffffffff8106eacf>] ? kthread+0x0/0x8c [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] [<ffffffff8106ee93>] kthreadd+0xe7/0x124 [ 0.252970] [<ffffffff8100a9e4>] kernel_thread_helper+0x4/0x10 [ 0.252970] [<ffffffff8106edac>] ? kthreadd+0x0/0x124 [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] Code: 01 45 c0 8b 8d 78 ff ff ff 48 8b 75 90 89 cf e8 4a 28 ff ff 3b 05 bd 89 ae 00 89 c1 7c c5 48 8b 45 c0 8b 4b 08 31 d2 48 c1 e0 0a [ 0.252970] f7 f1 45 85 e4 75 08 48 3b 45 b0 72 08 eb 0d 48 89 45 b8 eb [ 0.252970] RIP [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP <ffff88011767fc60>
When cpus= is specified for each node explicitly, guest boots fine.
** Affects: qemu
Importance: Undecided
Status: New
Signature · 73 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/891525 Title: Guest kernel crashes when booting a NUMA guest without explicitly specifying cpus= in -numa option Status in QEMU: New Bug description: Target: x86_64-softmmu Qemu Command line: [root@hs22 qemu-1.0-rc2]# ./x86_64-softmmu/qemu- system-x86_64 -smp sockets=2,cores=4,threads=2 -numa node,nodeid=0,mem=4g -numa node,nodeid=1,mem=1g -cpu core2duo -m 5g /home/bharata/f15-lvm -nographic --enable-kvm -net nic,macaddr=54:52:00:46:26:84,model=e1000 -net tap,script=/etc/qemu- if,ifname=vnet0 Qemu version: 1.0-rc2 When guest is started with -numa option without explicitly specifying the cpus=, guest kernel crashes as below: [ 0.252159] divide error: 0000 [#1] SMP [ 0.252970] last sysfs file: [ 0.252970] CPU 1 [ 0.252970] Modules linked in: [ 0.252970] [ 0.252970] Pid: 2, comm: kthreadd Not tainted 2.6.38.6-26.rc1.fc15.x86_64 #1 Bochs Bochs [ 0.252970] RIP: 0010:[<ffffffff8104f4d4>] [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP: 0000:ffff88011767fc60 EFLAGS: 00010046 [ 0.252970] RAX: 0000000000000000 RBX: ffff88015d6ad300 RCX: 0000000000000000 [ 0.252970] RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000000 [ 0.252970] RBP: ffff88011767fd10 R08: 0000000000000100 R09: ffff88015d6ad338 [ 0.252970] R10: 0000000000013840 R11: 0000000000800711 R12: 0000000000000000 [ 0.252970] R13: ffff88015fc0f810 R14: 0000000000000001 R15: 0000000000000000 [ 0.252970] FS: 0000000000000000(0000) GS:ffff88015fc00000(0000) knlGS:0000000000000000 [ 0.252970] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.252970] CR2: 00000000ffffffff CR3: 0000000001a03000 CR4: 00000000000006e0 [ 0.252970] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.252970] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 0.252970] Process kthreadd (pid: 2, threadinfo ffff88011767e000, task ffff88015d671720) [ 0.252970] Stack: [ 0.252970] ffffffff81475873 ffffffff81a02140 ffff88011767fce0 ffffffff8106c5a3 [ 0.252970] ffff88015d6ad318 000000010000000e 0000000000013840 0000000000013840 [ 0.252970] ffff88015d6ad318 0000007d00000001 ffff880100000000 ffff88015d6d81e8 [ 0.252970] Call Trace: [ 0.252970] [<ffffffff81475873>] ? _raw_spin_lock_irq+0x1c/0x1e [ 0.252970] [<ffffffff8106c5a3>] ? alloc_pid+0x2e6/0x335 [ 0.252970] [<ffffffff81048960>] select_task_rq+0x16/0x46 [ 0.252970] [<ffffffff8104e29a>] wake_up_new_task+0x3a/0xde [ 0.252970] [<ffffffff810546ce>] do_fork+0x1f1/0x2bf [ 0.252970] [<ffffffff8100804e>] ? load_TLS+0x10/0x14 [ 0.252970] [<ffffffff81008714>] ? __switch_to+0xc6/0x220 [ 0.252970] [<ffffffff81010c1a>] kernel_thread+0x75/0x77 [ 0.252970] [<ffffffff8106eacf>] ? kthread+0x0/0x8c [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] [<ffffffff8106ee93>] kthreadd+0xe7/0x124 [ 0.252970] [<ffffffff8100a9e4>] kernel_thread_helper+0x4/0x10 [ 0.252970] [<ffffffff8106edac>] ? kthreadd+0x0/0x124 [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] Code: 01 45 c0 8b 8d 78 ff ff ff 48 8b 75 90 89 cf e8 4a 28 ff ff 3b 05 bd 89 ae 00 89 c1 7c c5 48 8b 45 c0 8b 4b 08 31 d2 48 c1 e0 0a [ 0.252970] f7 f1 45 85 e4 75 08 48 3b 45 b0 72 08 eb 0d 48 89 45 b8 eb [ 0.252970] RIP [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP <ffff88011767fc60> When cpus= is specified for each node explicitly, guest boots fine. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/891525/+subscriptions
The reason for guest kernel crash is because qemu enumerates the VCPUs in a round robin fashion between the nodes. As per this comment from vl.c, guest kernel is supposed to handle this:
/* assigning the VCPUs round-robin is easier to implement, guest OSes
* must cope with this anyway, because there are BIOSes out there in
* real machines which also use this scheme.
*/
I am not sure if this would be considered a bug in the guest kernel, but I have verifed that enumerating the VCPUs in a serial manner between nodes fixes the problem for me. I am not aware of the history behind round robin assignment nor do I understand the full implications of changing it, but here is a potential patch that fixes the problem for me.
---
Fix VCPU enumeration between nodes
From: Bharata B Rao <[email protected]>
Currently VCPUs are assigned to nodes in round robin manner. This is seen to break guest kernel for x86_64-softmmu. Hence assign VCPUs serially between nodes.
---
vl.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
vl.c +10 -5
@@ -3307,13 +3307,18 @@ int main(int argc, char **argv, char **envp)if (node_cpumask[i] !=0 )break ; } -/* assigning the VCPUs round-robin is easier to implement, guest OSes -* must cope with this anyway, because there are BIOSes out there in -* real machines which also use this scheme. -*/ +/* Assign VCPUs to nodes in serial manner */ if (i == nb_numa_nodes) { +int cpus_per_node = smp_cpus / nb_numa_nodes; +for (i =0 ; i < smp_cpus; i++) { - node_cpumask[i % nb_numa_nodes] |=1 << i; +int nodeid = i / cpus_per_node; + +/* Extra VCPUs goto Node 0 */ +if (nodeid >= nb_numa_nodes) { + nodeid =0 ; + } + node_cpumask[nodeid] |=1 << i; } } }
Is this still an issue with the latest version of QEMU?
** Changed in: qemu
Status: New => Incomplete
Signature · 73 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/891525 Title: Guest kernel crashes when booting a NUMA guest without explicitly specifying cpus= in -numa option Status in QEMU: Incomplete Bug description: Target: x86_64-softmmu Qemu Command line: [root@hs22 qemu-1.0-rc2]# ./x86_64-softmmu/qemu- system-x86_64 -smp sockets=2,cores=4,threads=2 -numa node,nodeid=0,mem=4g -numa node,nodeid=1,mem=1g -cpu core2duo -m 5g /home/bharata/f15-lvm -nographic --enable-kvm -net nic,macaddr=54:52:00:46:26:84,model=e1000 -net tap,script=/etc/qemu- if,ifname=vnet0 Qemu version: 1.0-rc2 When guest is started with -numa option without explicitly specifying the cpus=, guest kernel crashes as below: [ 0.252159] divide error: 0000 [#1] SMP [ 0.252970] last sysfs file: [ 0.252970] CPU 1 [ 0.252970] Modules linked in: [ 0.252970] [ 0.252970] Pid: 2, comm: kthreadd Not tainted 2.6.38.6-26.rc1.fc15.x86_64 #1 Bochs Bochs [ 0.252970] RIP: 0010:[<ffffffff8104f4d4>] [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP: 0000:ffff88011767fc60 EFLAGS: 00010046 [ 0.252970] RAX: 0000000000000000 RBX: ffff88015d6ad300 RCX: 0000000000000000 [ 0.252970] RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000000 [ 0.252970] RBP: ffff88011767fd10 R08: 0000000000000100 R09: ffff88015d6ad338 [ 0.252970] R10: 0000000000013840 R11: 0000000000800711 R12: 0000000000000000 [ 0.252970] R13: ffff88015fc0f810 R14: 0000000000000001 R15: 0000000000000000 [ 0.252970] FS: 0000000000000000(0000) GS:ffff88015fc00000(0000) knlGS:0000000000000000 [ 0.252970] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.252970] CR2: 00000000ffffffff CR3: 0000000001a03000 CR4: 00000000000006e0 [ 0.252970] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.252970] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 0.252970] Process kthreadd (pid: 2, threadinfo ffff88011767e000, task ffff88015d671720) [ 0.252970] Stack: [ 0.252970] ffffffff81475873 ffffffff81a02140 ffff88011767fce0 ffffffff8106c5a3 [ 0.252970] ffff88015d6ad318 000000010000000e 0000000000013840 0000000000013840 [ 0.252970] ffff88015d6ad318 0000007d00000001 ffff880100000000 ffff88015d6d81e8 [ 0.252970] Call Trace: [ 0.252970] [<ffffffff81475873>] ? _raw_spin_lock_irq+0x1c/0x1e [ 0.252970] [<ffffffff8106c5a3>] ? alloc_pid+0x2e6/0x335 [ 0.252970] [<ffffffff81048960>] select_task_rq+0x16/0x46 [ 0.252970] [<ffffffff8104e29a>] wake_up_new_task+0x3a/0xde [ 0.252970] [<ffffffff810546ce>] do_fork+0x1f1/0x2bf [ 0.252970] [<ffffffff8100804e>] ? load_TLS+0x10/0x14 [ 0.252970] [<ffffffff81008714>] ? __switch_to+0xc6/0x220 [ 0.252970] [<ffffffff81010c1a>] kernel_thread+0x75/0x77 [ 0.252970] [<ffffffff8106eacf>] ? kthread+0x0/0x8c [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] [<ffffffff8106ee93>] kthreadd+0xe7/0x124 [ 0.252970] [<ffffffff8100a9e4>] kernel_thread_helper+0x4/0x10 [ 0.252970] [<ffffffff8106edac>] ? kthreadd+0x0/0x124 [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] Code: 01 45 c0 8b 8d 78 ff ff ff 48 8b 75 90 89 cf e8 4a 28 ff ff 3b 05 bd 89 ae 00 89 c1 7c c5 48 8b 45 c0 8b 4b 08 31 d2 48 c1 e0 0a [ 0.252970] f7 f1 45 85 e4 75 08 48 3b 45 b0 72 08 eb 0d 48 89 45 b8 eb [ 0.252970] RIP [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP <ffff88011767fc60> When cpus= is specified for each node explicitly, guest boots fine. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/891525/+subscriptions
[Expired for QEMU because there has been no activity for 60 days.]
** Changed in: qemu
Status: Incomplete => Expired
Signature · 73 lines
You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/891525 Title: Guest kernel crashes when booting a NUMA guest without explicitly specifying cpus= in -numa option Status in QEMU: Expired Bug description: Target: x86_64-softmmu Qemu Command line: [root@hs22 qemu-1.0-rc2]# ./x86_64-softmmu/qemu- system-x86_64 -smp sockets=2,cores=4,threads=2 -numa node,nodeid=0,mem=4g -numa node,nodeid=1,mem=1g -cpu core2duo -m 5g /home/bharata/f15-lvm -nographic --enable-kvm -net nic,macaddr=54:52:00:46:26:84,model=e1000 -net tap,script=/etc/qemu- if,ifname=vnet0 Qemu version: 1.0-rc2 When guest is started with -numa option without explicitly specifying the cpus=, guest kernel crashes as below: [ 0.252159] divide error: 0000 [#1] SMP [ 0.252970] last sysfs file: [ 0.252970] CPU 1 [ 0.252970] Modules linked in: [ 0.252970] [ 0.252970] Pid: 2, comm: kthreadd Not tainted 2.6.38.6-26.rc1.fc15.x86_64 #1 Bochs Bochs [ 0.252970] RIP: 0010:[<ffffffff8104f4d4>] [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP: 0000:ffff88011767fc60 EFLAGS: 00010046 [ 0.252970] RAX: 0000000000000000 RBX: ffff88015d6ad300 RCX: 0000000000000000 [ 0.252970] RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000000 [ 0.252970] RBP: ffff88011767fd10 R08: 0000000000000100 R09: ffff88015d6ad338 [ 0.252970] R10: 0000000000013840 R11: 0000000000800711 R12: 0000000000000000 [ 0.252970] R13: ffff88015fc0f810 R14: 0000000000000001 R15: 0000000000000000 [ 0.252970] FS: 0000000000000000(0000) GS:ffff88015fc00000(0000) knlGS:0000000000000000 [ 0.252970] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 0.252970] CR2: 00000000ffffffff CR3: 0000000001a03000 CR4: 00000000000006e0 [ 0.252970] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 0.252970] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 0.252970] Process kthreadd (pid: 2, threadinfo ffff88011767e000, task ffff88015d671720) [ 0.252970] Stack: [ 0.252970] ffffffff81475873 ffffffff81a02140 ffff88011767fce0 ffffffff8106c5a3 [ 0.252970] ffff88015d6ad318 000000010000000e 0000000000013840 0000000000013840 [ 0.252970] ffff88015d6ad318 0000007d00000001 ffff880100000000 ffff88015d6d81e8 [ 0.252970] Call Trace: [ 0.252970] [<ffffffff81475873>] ? _raw_spin_lock_irq+0x1c/0x1e [ 0.252970] [<ffffffff8106c5a3>] ? alloc_pid+0x2e6/0x335 [ 0.252970] [<ffffffff81048960>] select_task_rq+0x16/0x46 [ 0.252970] [<ffffffff8104e29a>] wake_up_new_task+0x3a/0xde [ 0.252970] [<ffffffff810546ce>] do_fork+0x1f1/0x2bf [ 0.252970] [<ffffffff8100804e>] ? load_TLS+0x10/0x14 [ 0.252970] [<ffffffff81008714>] ? __switch_to+0xc6/0x220 [ 0.252970] [<ffffffff81010c1a>] kernel_thread+0x75/0x77 [ 0.252970] [<ffffffff8106eacf>] ? kthread+0x0/0x8c [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] [<ffffffff8106ee93>] kthreadd+0xe7/0x124 [ 0.252970] [<ffffffff8100a9e4>] kernel_thread_helper+0x4/0x10 [ 0.252970] [<ffffffff8106edac>] ? kthreadd+0x0/0x124 [ 0.252970] [<ffffffff8100a9e0>] ? kernel_thread_helper+0x0/0x10 [ 0.252970] Code: 01 45 c0 8b 8d 78 ff ff ff 48 8b 75 90 89 cf e8 4a 28 ff ff 3b 05 bd 89 ae 00 89 c1 7c c5 48 8b 45 c0 8b 4b 08 31 d2 48 c1 e0 0a [ 0.252970] f7 f1 45 85 e4 75 08 48 3b 45 b0 72 08 eb 0d 48 89 45 b8 eb [ 0.252970] RIP [<ffffffff8104f4d4>] select_task_rq_fair+0x44a/0x571 [ 0.252970] RSP <ffff88011767fc60> When cpus= is specified for each node explicitly, guest boots fine. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/891525/+subscriptions