[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] PVH Dom0 Intel IOMMU issues



On Mon, Apr 17, 2017 at 09:38:54AM +0100, Roger Pau Monné wrote:
>On Mon, Apr 17, 2017 at 09:03:12AM +0800, Chao Gao wrote:
>> On Mon, Apr 17, 2017 at 08:47:48AM +0100, Roger Pau Monné wrote:
>> >On Mon, Apr 17, 2017 at 07:32:45AM +0800, Chao Gao wrote:
>> >> On Fri, Apr 14, 2017 at 04:34:41PM +0100, Roger Pau Monné wrote:
>> >> >Hello,
>> >> >
>> >> >Although PVHv2 Dom0 is not yet finished, I've been trying the current 
>> >> >code on
>> >> >different hardware, and found that with pre-Haswell Intel hardware PVHv2 
>> >> >Dom0
>> >> >completely freezes the box when calling iommu_hwdom_init in 
>> >> >dom0_construct_pvh.
>> >> >OTOH the same doesn't happen when using a newer CPU (ie: haswell or 
>> >> >newer).
>> >> >
>> >> >I'm not able to debug that in any meaningful way because the box seems 
>> >> >to lock
>> >> >up completely, even the watchdog NMI stops working. Here is the boot 
>> >> >log, up to
>> >> >the point where it freezes:
>> >> 
>> >> I try "dom0=pvh" with my skylake. An assertion failed. Is it a software 
>> >> bug?
>> >> 
>
>It seems like we are not properly adding/accounting the vIO APICs, but I cannot
>really see how. I have another patch for you to try below.
>
>Thanks, Roger.
>
>---8<---
>       diff --git a/xen/arch/x86/hvm/vioapic.c b/xen/arch/x86/hvm/vioapic.c
>index 527ac2aadd..40075e2756 100644
>--- a/xen/arch/x86/hvm/vioapic.c
>+++ b/xen/arch/x86/hvm/vioapic.c
>@@ -610,11 +610,15 @@ int vioapic_init(struct domain *d)
>            xzalloc_array(struct hvm_vioapic *, nr_vioapics)) == NULL) )
>         return -ENOMEM;
> 
>+    printk("Adding %u vIO APICs\n", nr_vioapics);
>+
>     for ( i = 0; i < nr_vioapics; i++ )
>     {
>         unsigned int nr_pins = is_hardware_domain(d) ? nr_ioapic_entries[i] :
>             ARRAY_SIZE(domain_vioapic(d, 0)->domU.redirtbl);
> 
>+        printk("vIO APIC %u has %u pins\n", i, nr_pins);
>+
>         if ( (domain_vioapic(d, i) =
>               xmalloc_bytes(hvm_vioapic_size(nr_pins))) == NULL )
>         {
>@@ -623,8 +627,12 @@ int vioapic_init(struct domain *d)
>         }
>         domain_vioapic(d, i)->nr_pins = nr_pins;
>         nr_gsis += nr_pins;
>+        printk("nr_gsis: %u\n", nr_gsis);
>     }
> 
>+    printk("domain nr_gsis: %u vioapic gsis: %u nr_irqs_gsi: %u highest_gsi: 
>%u\n",
>+           hvm_domain_irq(d)->nr_gsis, nr_gsis, nr_irqs_gsi, highest_gsi());
>+
>     ASSERT(hvm_domain_irq(d)->nr_gsis == nr_gsis);
> 
>     d->arch.hvm_domain.nr_vioapics = nr_vioapics;
>

Please Cc or To me.  Is there some holes in all physical IOAPICs gsi ranges?

with the above patch,

(XEN) [   14.262237] Dom0 has maximum 1448 PIRQs
(XEN) [   14.264413] Adding 9 vIO APICs
(XEN) [   14.265827] vIO APIC 0 has 24 pins
(XEN) [   14.267256] nr_gsis: 24
(XEN) [   14.268673] vIO APIC 1 has 8 pins
(XEN) [   14.270175] nr_gsis: 32
(XEN) [   14.271589] vIO APIC 2 has 8 pins
(XEN) [   14.273011] nr_gsis: 40
(XEN) [   14.274434] vIO APIC 3 has 8 pins
(XEN) [   14.275864] nr_gsis: 48
(XEN) [   14.277283] vIO APIC 4 has 8 pins
(XEN) [   14.278709] nr_gsis: 56
(XEN) [   14.280127] vIO APIC 5 has 8 pins
(XEN) [   14.281561] nr_gsis: 64
(XEN) [   14.282986] vIO APIC 6 has 8 pins
(XEN) [   14.284417] nr_gsis: 72
(XEN) [   14.285837] vIO APIC 7 has 8 pins
(XEN) [   14.287262] nr_gsis: 80
(XEN) [   14.288683] vIO APIC 8 has 8 pins
(XEN) [   14.290114] nr_gsis: 88
(XEN) [   14.291538] domain nr_gsis: 104 vioapic gsis: 88 nr_irqs_gsi: 104 
highest_gsi: 103
(XEN) [   14.294417] Assertion 'hvm_domain_irq(d)->nr_gsis == nr_gsis' failed 
at vioapic.c:608
(XEN) [   14.297282] ----[ Xen-4.9-unstable  x86_64  debug=y   Not tainted ]----
(XEN) [   14.298743] CPU:    0
(XEN) [   14.300161] RIP:    e008:[<ffff82d0802ef7ab>] vioapic_init+0x186/0x1dd
(XEN) [   14.301633] RFLAGS: 0000000000010287   CONTEXT: hypervisor
(XEN) [   14.303094] rax: ffff830837c7ea00   rbx: 0000000000000009   rcx: 
0000000000000000
(XEN) [   14.305976] rdx: ffff82d080457fff   rsi: 000000000000000a   rdi: 
ffff82d08044d6b8
(XEN) [   14.308851] rbp: ffff82d080457d28   rsp: ffff82d080457ce8   r8:  
ffff83083e000000
(XEN) [   14.311781] r9:  0000000000000006   r10: 00000000000472d2   r11: 
0000000000000006
(XEN) [   14.314654] r12: 0000000000000008   r13: ffff830837d2e000   r14: 
0000000000000058
(XEN) [   14.317528] r15: ffff830837c7eb20   cr0: 000000008005003b   cr4: 
00000000003526e0
(XEN) [   14.320403] cr3: 000000006f84c000   cr2: 0000000000000000
(XEN) [   14.321855] ds: 0000   es: 0000   fs: 0000   gs: 0000   ss: 0000   cs: 
e008
(XEN) [   14.324734] Xen code around <ffff82d0802ef7ab> 
(vioapic_init+0x186/0x1dd):
(XEN) [   14.327591]  00 00 44 3b 70 40 74 02 <0f> 0b 8b 45 cc 41 89 85 b0 02 
00 00 4c 89 ef e8
(XEN) [   14.330458] Xen stack trace from rsp=ffff82d080457ce8:
(XEN) [   14.331908]    ffff82d08029e7de 0000000937c7e010 ffff82d080457d08 
ffff830837d2e000
(XEN) [   14.334790]    0000000000000068 0000000000000001 0000000000000000 
0000000000000000
(XEN) [   14.337661]    ffff82d080457d48 ffff82d0802de276 ffff830837d2e000 
0000000000000000
(XEN) [   14.340526]    ffff82d080457d78 ffff82d08026d593 ffff82d080457d78 
ffff830837d2e000
(XEN) [   14.343402]    000000000000001f 0000000000000007 ffff82d080457de8 
ffff82d080205226
(XEN) [   14.346270]    ffff82d0804380e0 0000000000000004 ffff82d080457eb4 
0000000000000000
(XEN) [   14.349202]    ffff82d080457dc8 f7fa32231fcbfbff 000001212c100800 
00000000000000e0
(XEN) [   14.352071]    ffff830838543850 00000000000000e0 ffff82d08043b780 
000000000000006f
(XEN) [   14.354944]    ffff82d080457f08 ffff82d0803ee1be 000000000028fe80 
000000000000015c
(XEN) [   14.357815]    00000000000001df 0000000200000000 0000000000000002 
0000000000000002
(XEN) [   14.360683]    0000000000000002 0000000000000001 0000000000000001 
0000000000000001
(XEN) [   14.363674]    0000000000000001 0000000000000000 ffff82d080429a90 
0000000000000017
(XEN) [   14.366548]    0000001075ec7000 00000000013b7000 0000000001080000 
0000000000000000
(XEN) [   14.369412]    ffff830000000002 ffff830000097c60 ffff830000097ee0 
ffff830000097fb0
(XEN) [   14.372287]    0000000000000000 0000001100000000 0000000800000000 
000000010000006e
(XEN) [   14.375164]    0000000000000003 00000000000002f8 0000000000000000 
0000000000000000
(XEN) [   14.378035]    00000000000000e8 0000000068924a50 000000006c5b8a28 
000000006c5b8a40
(XEN) [   14.380900]    0000000000000000 ffff82d0802000f3 0000000000000000 
0000000000000000
(XEN) [   14.383764]    0000000000000000 0000000000000000 0000000000000000 
0000000000000000
(XEN) [   14.386673]    0000000000000000 0000000000000000 0000000000000000 
0000000000000000
(XEN) [   14.389535] Xen call trace:
(XEN) [   14.390952]    [<ffff82d0802ef7ab>] vioapic_init+0x186/0x1dd
(XEN) [   14.392408]    [<ffff82d0802de276>] hvm_domain_initialise+0x268/0x365
(XEN) [   14.393875]    [<ffff82d08026d593>] arch_domain_create+0x4b0/0x6ac
(XEN) [   14.395339]    [<ffff82d080205226>] domain_create+0x3d8/0x593
(XEN) [   14.396798]    [<ffff82d0803ee1be>] __start_xen+0x20fa/0x24c3
(XEN) [   14.398255]    [<ffff82d0802000f3>] __high_start+0x53/0x58
(XEN) [   14.399708] 
(XEN) [   14.697858] 
(XEN) [   14.700994] ****************************************
(XEN) [   14.707623] Panic on CPU 0:
(XEN) [   14.712067] Assertion 'hvm_domain_irq(d)->nr_gsis == nr_gsis' failed 
at vioapic.c:608
(XEN) [   14.722814] ****************************************
(XEN) [   14.729433] 
(XEN) [   14.732571] Reboot in five seconds...
(XEN) [   19.739647] Resetting with ACPI MEMORY or I/O RESET_REG.

Thanks
Chao

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.