Skip to contentSkip to conversation

Xen kbdfront, Xen platform PCI and grant table initialization

BUG Wei Liu 2 participants 3 messages Jan 28, 2014

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

Konrad, David and Boris

I discovered a bug. If you disable Xen platform PCI device and have xen-kbdfront compiled in the kernel, you won't be able to boot the guest.

The cause is that Xen platform PCI initializes grant table. After that xen-kbdfront kicks in. Everything works fine.

If you disable Xen platform PCI device, the initialization of grant table is later than initialization of xen-kbdfront. In that case when xen-kbdfront wants to make use of grant table it triggers BUG_ON in grant-table.c. After enabling Xen platform PCI device, everything works fine.

The fix would be moving the initialization of grant table before xen-kbdfront.

Wei.

---8<---
(No sign of grant table initialization before this point)

[    3.813406] input: Xen Virtual Keyboard as /devices/virtual/input/input1
[    3.829622] input: Xen Virtual Pointer as /devices/virtual/input/input2
[    3.846052] ------------[ cut here ]------------
[    3.849948] kernel BUG at drivers/xen/grant-table.c:1192!
[    3.849948] invalid opcode: 0000 [#1] SMP 
[    3.849948] Modules linked in:
[    3.849948] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.10.28-stable-for-h16 #19
[    3.849948] Hardware name: Xen HVM domU, BIOS 4.4-unstable 11/26/2013
[    3.849948] task: ffff88003da62750 ti: ffff88003da82000 task.ti: ffff88003da82000
[    3.849948] RIP: 0010:[<ffffffff81331ff7>]  [<ffffffff81331ff7>] get_free_entries+0x39/0x21a
[    3.849948] RSP: 0000:ffff88003da83c88  EFLAGS: 00010046
[    3.849948] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000
[    3.849948] RDX: 0000000000000000 RSI: 0000000000000296 RDI: ffffffff81ea5d78
[    3.849948] RBP: 000000000003c12c R08: 0000000000000000 R09: 0000000000000000
[    3.849948] R10: 0000000000000000 R11: ffff88003c12e800 R12: 0000000000000000
[    3.849948] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[    3.849948] FS:  0000000000000000(0000) GS:ffff88003a620000(0000) knlGS:0000000000000000
[    3.849948] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    3.849948] CR2: 0000000000000000 CR3: 0000000002c0c000 CR4: 00000000000006e0
[    3.849948] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    3.849948] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    3.849948] Stack:
[    3.849948]  ffff88003c12e800 ffff88003c1448a8 0000000000000000 ffffffff815cc40f
[    3.849948]  ffffffff818c6920 ffff88003c12e800 ffff88003c144800 0000000000000296
[    3.849948]  0000000000000292 0000000000000000 000000000003c12c 0000000000000000
[    3.849948] Call Trace:
[    3.849948]  [<ffffffff815cc40f>] ? mousedev_create+0x1ea/0x24c
[    3.849948]  [<ffffffff8133224b>] ? gnttab_grant_foreign_access+0x1a/0x46
[    3.849948]  [<ffffffff815ceefe>] ? xenkbd_connect_backend+0x64/0x22e
[    3.849948]  [<ffffffff815cf37a>] ? xenkbd_probe+0x27c/0x2be
[    3.849948]  [<ffffffff813378ca>] ? xenbus_dev_probe+0x56/0xb8
[    3.849948]  [<ffffffff81376e2a>] ? driver_probe_device+0x1b3/0x1b3
[    3.849948]  [<ffffffff81376d09>] ? driver_probe_device+0x92/0x1b3
[    3.849948]  [<ffffffff81376e7d>] ? __driver_attach+0x53/0x73
[    3.849948]  [<ffffffff813755b4>] ? bus_for_each_dev+0x4b/0x7c
[    3.849948]  [<ffffffff8137651d>] ? bus_add_driver+0xd5/0x1f4
[    3.849948]  [<ffffffff813773b0>] ? driver_register+0x89/0x101
[    3.849948]  [<ffffffff81338cc9>] ? xenbus_register_frontend+0x1f/0x39
[    3.849948]  [<ffffffff81d32e0b>] ? atkbd_init+0x23/0x23
[    3.849948]  [<ffffffff8100209f>] ? do_one_initcall+0x75/0x10a
[    3.849948]  [<ffffffff81cebe78>] ? kernel_init_freeable+0x139/0x1ca
[    3.849948]  [<ffffffff81ceb723>] ? do_early_param+0x83/0x83
[    3.849948]  [<ffffffff8172b24c>] ? rest_init+0x70/0x70
[    3.849948]  [<ffffffff8172b252>] ? kernel_init+0x6/0xd3
[    3.849948]  [<ffffffff8174cb3c>] ? ret_from_fork+0x7c/0xb0
[    3.849948]  [<ffffffff8172b24c>] ? rest_init+0x70/0x70
[    3.849948] Code: c7 78 5d ea 81 48 83 ec 48 e8 15 58 41 00 48 89 44 24 38 8b 05 97 3d b7 00 39 d8 0f 83 8d 01 00 00 8b 0d 91 3d b7 00 85 c9 75 02 <0f> 0b 44 8d 6c 19 ff 31 d2 44 8b 25 81 3d b7 00 41 29 c5 44 89 
[    3.849948] RIP  [<ffffffff81331ff7>] get_free_entries+0x39/0x21a
[    3.849948]  RSP <ffff88003da83c88>
[    3.849948] ---[ end trace bb00725567f6ff1c ]---
[    4.582819] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
author
#1 lore raw

NM, this is already fixed in xen tip!

Thanks!
Wei

#2 lore raw
Quoted 1 line · Wei Liu

NM, this is already fixed in xen tip!

And already in Linux as well :-)

Quoted 3 lines

Thanks!
Wei