Message ID | 1500979706-69496-1-git-send-email-chao.gao@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 25/07/17 11:48, Chao Gao wrote: > This reverts commit 89df98b77d28136c4d7aade13a1c8bc154d2919f, which > incurs Xen crash when loading VF driver. The reason seems that > pci_get_pdev() can't be called when interrupt is disabled. I don't have a > quick solution to fix this; therefore revert this patch to let common cases > work well. As to the corner case I intended to fix, I will propose another > solution later. > > Below is the call trace of Xen crash: > (XEN) Xen BUG at spinlock.c:47 > (XEN) ----[ Xen-4.10-unstable x86_64 debug=y Tainted: C ]---- > (XEN) CPU: 2 > (XEN) RIP: e008:[<ffff82d08023513c>] spinlock.c#check_lock+0x3c/0x40 > (XEN) RFLAGS: 0000000000010046 CONTEXT: hypervisor (d0v2) > (XEN) rax: 0000000000000000 rbx: ffff82d08043b9c8 rcx: 0000000000000001 > (XEN) rdx: 0000000000000000 rsi: 0000000000000000 rdi: ffff82d08043b9ce > (XEN) rbp: ffff83043c47fa50 rsp: ffff83043c47fa50 r8: 0000000000000000 > (XEN) r9: 0000000000000000 r10: 0000000000000000 r11: 0000ffff0000ffff > (XEN) r12: 0000000000000001 r13: 0000000000000000 r14: 0000000000000072 > (XEN) r15: ffff83043c006c00 cr0: 0000000080050033 cr4: 00000000003526e0 > (XEN) cr3: 000000081b39a000 cr2: ffff88016c058548 > (XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008 > (XEN) Xen code around <ffff82d08023513c> (spinlock.c#check_lock+0x3c/0x40): > (XEN) 98 83 f2 01 39 d0 75 02 <0f> 0b 5d c3 55 48 89 e5 f0 ff 05 a1 f6 1e 00 5d > (XEN) Xen stack trace from rsp=ffff83043c47fa50: > (XEN) ffff83043c47fa68 ffff82d080235234 0000000000000005 ffff83043c47fa78 > (XEN) ffff82d080251df3 ffff83043c47fab8 ffff82d080251e80 ffff83043c47fac8 > (XEN) ffff83043c422580 ffff83042e973cd0 0000000000000005 ffff83042e9609e0 > (XEN) 0000000000000072 ffff83043c47fae8 ffff82d08025795a ffff83043c47fb18 > (XEN) ffff83043c47fc18 ffff83043c47fc18 ffff83042e9609e0 ffff83043c47fba8 > (XEN) ffff82d080259be1 ffff83043c47fb10 ffff82d08023516b 0000000000000246 > (XEN) ffff83043c47fb28 0000000000000206 0000000000000002 ffff83043c47fb58 > (XEN) ffff82d080290e38 ffff83042e973cd0 ffff83043c532000 ffff83043c532000 > (XEN) ffff83042e973db0 ffff83043c47fb68 ffff82d080354dd0 ffff83043c47fc18 > (XEN) ffff82d080274e07 0000000000000040 ffff83042e9609e0 ffff83043c47fc18 > (XEN) ffff83043c47fc18 0000000000000072 ffff83043c006c00 ffff83043c47fbb8 > (XEN) ffff82d0802526f7 ffff83043c47fc08 ffff82d080273c17 ffff83043ff99d90 > (XEN) ffff83043c006c00 ffff83043c47fc08 ffff83043c006c00 ffff83042e9609e0 > (XEN) ffff83043c47fc18 0000000000000072 ffff83043c006c00 ffff83043c47fc48 > (XEN) ffff82d0802754d1 00000000feeff00c 00000fff000041ca 0000000000000002 > (XEN) ffff83042e9609e0 ffff83042e973cd0 0000000000000002 ffff83043c47fc88 > (XEN) ffff82d0802755a8 ffff83043c47fc70 0000000000000246 ffff83043c532000 > (XEN) 000000000000006c ffff83043c006c00 0000000000000000 ffff83043c47fd28 > (XEN) ffff82d080279b4f ffff83043c532000 ffff83043c47fe00 ffff83043c47fcd8 > (XEN) ffff83042e973d20 ffff83043c47fcf0 ffff830400000325 0000000000000246 > (XEN) Xen call trace: > (XEN) [<ffff82d08023513c>] spinlock.c#check_lock+0x3c/0x40 > (XEN) [<ffff82d080235234>] _spin_is_locked+0x11/0x4d > (XEN) [<ffff82d080251df3>] pcidevs_locked+0x10/0x17 > (XEN) [<ffff82d080251e80>] pci_get_pdev+0x2f/0xfd > (XEN) [<ffff82d08025795a>] acpi_find_matched_drhd_unit+0x4d/0x11a > (XEN) [<ffff82d080259be1>] msi_msg_write_remap_rte+0x2f/0x749 > (XEN) [<ffff82d0802526f7>] iommu_update_ire_from_msi+0x36/0x38 > (XEN) [<ffff82d080273c17>] msi.c#write_msi_msg+0x3f/0x188 > (XEN) [<ffff82d0802754d1>] __setup_msi_irq+0x3a/0x5c > (XEN) [<ffff82d0802755a8>] setup_msi_irq+0xb5/0xf7 > (XEN) [<ffff82d080279b4f>] map_domain_pirq+0x445/0x653 > (XEN) [<ffff82d08027aa99>] allocate_and_map_msi_pirq+0x10d/0x184 > (XEN) [<ffff82d080291258>] physdev_map_pirq+0x1f8/0x26b > (XEN) [<ffff82d0802919a6>] do_physdev_op+0x595/0x110f > (XEN) [<ffff82d080352db0>] pv_hypercall+0x1ef/0x42c > (XEN) [<ffff82d080356606>] entry.o#test_all_events+0/0x30 > (XEN) > (XEN) > (XEN) **************************************** > (XEN) Panic on CPU 2: > (XEN) Xen BUG at spinlock.c:47 > (XEN) **************************************** > (XEN) > (XEN) Reboot in five seconds... > > Signed-off-by: Chao Gao <chao.gao@intel.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 8a3e240..82040dd 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -218,17 +218,8 @@ struct acpi_drhd_unit *acpi_find_matched_drhd_unit(const struct pci_dev *pdev) } else if ( pdev->info.is_virtfn ) { - const struct pci_dev *physfn; - bus = pdev->info.physfn.bus; - /* - * Use 0 as 'devfn' to search VT-d unit when the physical function - * is an Extended Function. - */ - pcidevs_lock(); - physfn = pci_get_pdev(pdev->seg, bus, pdev->info.physfn.devfn); - devfn = (physfn && physfn->info.is_extfn) ? 0 : pdev->info.physfn.devfn; - pcidevs_unlock(); + devfn = PCI_SLOT(pdev->info.physfn.devfn) ? 0 : pdev->info.physfn.devfn; } else {
This reverts commit 89df98b77d28136c4d7aade13a1c8bc154d2919f, which incurs Xen crash when loading VF driver. The reason seems that pci_get_pdev() can't be called when interrupt is disabled. I don't have a quick solution to fix this; therefore revert this patch to let common cases work well. As to the corner case I intended to fix, I will propose another solution later. Below is the call trace of Xen crash: (XEN) Xen BUG at spinlock.c:47 (XEN) ----[ Xen-4.10-unstable x86_64 debug=y Tainted: C ]---- (XEN) CPU: 2 (XEN) RIP: e008:[<ffff82d08023513c>] spinlock.c#check_lock+0x3c/0x40 (XEN) RFLAGS: 0000000000010046 CONTEXT: hypervisor (d0v2) (XEN) rax: 0000000000000000 rbx: ffff82d08043b9c8 rcx: 0000000000000001 (XEN) rdx: 0000000000000000 rsi: 0000000000000000 rdi: ffff82d08043b9ce (XEN) rbp: ffff83043c47fa50 rsp: ffff83043c47fa50 r8: 0000000000000000 (XEN) r9: 0000000000000000 r10: 0000000000000000 r11: 0000ffff0000ffff (XEN) r12: 0000000000000001 r13: 0000000000000000 r14: 0000000000000072 (XEN) r15: ffff83043c006c00 cr0: 0000000080050033 cr4: 00000000003526e0 (XEN) cr3: 000000081b39a000 cr2: ffff88016c058548 (XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: e010 cs: e008 (XEN) Xen code around <ffff82d08023513c> (spinlock.c#check_lock+0x3c/0x40): (XEN) 98 83 f2 01 39 d0 75 02 <0f> 0b 5d c3 55 48 89 e5 f0 ff 05 a1 f6 1e 00 5d (XEN) Xen stack trace from rsp=ffff83043c47fa50: (XEN) ffff83043c47fa68 ffff82d080235234 0000000000000005 ffff83043c47fa78 (XEN) ffff82d080251df3 ffff83043c47fab8 ffff82d080251e80 ffff83043c47fac8 (XEN) ffff83043c422580 ffff83042e973cd0 0000000000000005 ffff83042e9609e0 (XEN) 0000000000000072 ffff83043c47fae8 ffff82d08025795a ffff83043c47fb18 (XEN) ffff83043c47fc18 ffff83043c47fc18 ffff83042e9609e0 ffff83043c47fba8 (XEN) ffff82d080259be1 ffff83043c47fb10 ffff82d08023516b 0000000000000246 (XEN) ffff83043c47fb28 0000000000000206 0000000000000002 ffff83043c47fb58 (XEN) ffff82d080290e38 ffff83042e973cd0 ffff83043c532000 ffff83043c532000 (XEN) ffff83042e973db0 ffff83043c47fb68 ffff82d080354dd0 ffff83043c47fc18 (XEN) ffff82d080274e07 0000000000000040 ffff83042e9609e0 ffff83043c47fc18 (XEN) ffff83043c47fc18 0000000000000072 ffff83043c006c00 ffff83043c47fbb8 (XEN) ffff82d0802526f7 ffff83043c47fc08 ffff82d080273c17 ffff83043ff99d90 (XEN) ffff83043c006c00 ffff83043c47fc08 ffff83043c006c00 ffff83042e9609e0 (XEN) ffff83043c47fc18 0000000000000072 ffff83043c006c00 ffff83043c47fc48 (XEN) ffff82d0802754d1 00000000feeff00c 00000fff000041ca 0000000000000002 (XEN) ffff83042e9609e0 ffff83042e973cd0 0000000000000002 ffff83043c47fc88 (XEN) ffff82d0802755a8 ffff83043c47fc70 0000000000000246 ffff83043c532000 (XEN) 000000000000006c ffff83043c006c00 0000000000000000 ffff83043c47fd28 (XEN) ffff82d080279b4f ffff83043c532000 ffff83043c47fe00 ffff83043c47fcd8 (XEN) ffff83042e973d20 ffff83043c47fcf0 ffff830400000325 0000000000000246 (XEN) Xen call trace: (XEN) [<ffff82d08023513c>] spinlock.c#check_lock+0x3c/0x40 (XEN) [<ffff82d080235234>] _spin_is_locked+0x11/0x4d (XEN) [<ffff82d080251df3>] pcidevs_locked+0x10/0x17 (XEN) [<ffff82d080251e80>] pci_get_pdev+0x2f/0xfd (XEN) [<ffff82d08025795a>] acpi_find_matched_drhd_unit+0x4d/0x11a (XEN) [<ffff82d080259be1>] msi_msg_write_remap_rte+0x2f/0x749 (XEN) [<ffff82d0802526f7>] iommu_update_ire_from_msi+0x36/0x38 (XEN) [<ffff82d080273c17>] msi.c#write_msi_msg+0x3f/0x188 (XEN) [<ffff82d0802754d1>] __setup_msi_irq+0x3a/0x5c (XEN) [<ffff82d0802755a8>] setup_msi_irq+0xb5/0xf7 (XEN) [<ffff82d080279b4f>] map_domain_pirq+0x445/0x653 (XEN) [<ffff82d08027aa99>] allocate_and_map_msi_pirq+0x10d/0x184 (XEN) [<ffff82d080291258>] physdev_map_pirq+0x1f8/0x26b (XEN) [<ffff82d0802919a6>] do_physdev_op+0x595/0x110f (XEN) [<ffff82d080352db0>] pv_hypercall+0x1ef/0x42c (XEN) [<ffff82d080356606>] entry.o#test_all_events+0/0x30 (XEN) (XEN) (XEN) **************************************** (XEN) Panic on CPU 2: (XEN) Xen BUG at spinlock.c:47 (XEN) **************************************** (XEN) (XEN) Reboot in five seconds... Signed-off-by: Chao Gao <chao.gao@intel.com> --- xen/drivers/passthrough/vtd/dmar.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)