Subject: Regression in virtio_net causing kernel BUG when running under VirtualBox (bisected)

From: Thomas Müller <[email-masked]>
Date: Sat, 27 Mar 2010 15:32:39 +0100

Hello,

I'm running Linux under VirtualBox 3.1.6 with a single virtual CPU
without any third party drivers.

Commit 9ab86bbcf8be755256f0a5e994e0b38af6b4d399
(virtio_net: Defer skb allocation in receive path)
caused a regression which results in a kernel bug and subsequent
hang at every boot.

I have attached the complete output during boot.

Please CC me on reply as I'm not subscribed to the mailing lists.

Best regards,
Thomas

------------[ cut here ]------------
kernel BUG at include/linux/scatterlist.h:65!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/devices/virtual/tty/tty56/uevent
CPU 0
Pid: 299, comm: modprobe Not tainted 2.6.33-rc5-00614-g9ab86bb #15 /VirtualBox
RIP: 0010:[<ffffffffa0026271>]  [<ffffffffa0026271>] sg_set_buf+0x46/0x74 [virtio_net]
RSP: 0000:ffff88007a615bd8  EFLAGS: 00010286
RAX: ffffea0001ac86b0 RBX: ffff88007a615c18 RCX: 0000000087654321
RDX: 0000000000000246 RSI: ffff88007a6fa2b0 RDI: ffff88007a6fa2b0
RBP: ffff88007a615bf8 R08: 0000000000000020 R09: 0000000000000640
R10: ffff88007a615c08 R11: ffff88007d098000 R12: ffff88007a6fa2b0
R13: 000000000000000a R14: 0000160000000000 R15: ffff88007a615c98
FS:  00007f9d6b27c700(0000) GS:ffff880004a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fec3fcd72c0 CR3: 000000007a43c000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 299, threadinfo ffff88007a614000, task ffff88007b8b2470)
Stack:
 ffff88007a615bf8 ffff88007a6fa280 ffff88007a615c18 ffff88007b980880
<0> ffff88007a615c88 ffffffffa0026a08 ffff88007a615c18 ffffffff8107d5c1
<0> ffff88007a615c48 0000000000000246 0000000000000010 ffff88007b980000
Call Trace:
 [<ffffffffa0026a08>] add_recvbuf_small+0x66/0xac [virtio_net]
 [<ffffffff8107d5c1>] ? trace_hardirqs_on+0xd/0xf
 [<ffffffff81454932>] ? mutex_unlock+0xe/0x10
 [<ffffffff813ccae6>] ? __rtnl_unlock+0x15/0x17
 [<ffffffffa0026b55>] try_fill_recv+0x107/0x155 [virtio_net]
 [<ffffffff813ccacf>] ? rtnl_unlock+0xe/0x10
 [<ffffffffa0026f6b>] virtnet_probe+0x3c8/0x46f [virtio_net]
 [<ffffffffa0026151>] ? skb_recv_done+0x0/0x3f [virtio_net]
 [<ffffffffa002610d>] ? skb_xmit_done+0x0/0x44 [virtio_net]
 [<ffffffffa000007c>] ? add_status+0x32/0x3a [virtio]
 [<ffffffffa00002df>] virtio_dev_probe+0xb7/0xdb [virtio]
 [<ffffffff812e30a3>] driver_probe_device+0xed/0x21a
 [<ffffffff812e322d>] __driver_attach+0x5d/0x81
 [<ffffffff812e31d0>] ? __driver_attach+0x0/0x81
 [<ffffffff812e2507>] bus_for_each_dev+0x59/0x8e
 [<ffffffff812e2e2a>] driver_attach+0x1e/0x20
 [<ffffffff812e2a4a>] bus_add_driver+0xd8/0x242
 [<ffffffff812e3534>] driver_register+0x9e/0x10f
 [<ffffffffa000b000>] ? init+0x0/0x12 [virtio_net]
 [<ffffffffa0000441>] register_virtio_driver+0x27/0x2a [virtio]
 [<ffffffffa000b010>] init+0x10/0x12 [virtio_net]
 [<ffffffff8100207d>] do_one_initcall+0x72/0x18a
 [<ffffffff8108b116>] sys_init_module+0xd8/0x23a
 [<ffffffff81009bf2>] system_call_fastpath+0x16/0x1b
Code: 49 89 f4 e8 f2 ce 00 e1 48 c1 e8 0c 48 b9 00 00 00 00 00 ea ff ff 48 8b 53 08 48 6b c0 38 48
01 c8 b9 21 43 65 87 48 39 0b 74 04 <0f> 0b eb fe f6 c2 01 74 04 0f 0b eb fe 83 e2 03 41 81 e4 ff 0f
RIP  [<ffffffffa0026271>] sg_set_buf+0x46/0x74 [virtio_net]
 RSP <ffff88007a615bd8>
---[ end trace 0110e718da6da1ad ]---