dom0 as pvh boot problem
Hi
There is a problem with booting dom0 as pvh (xen-4.5rc3, kernel 3.18.0+).
After digging a bit into this it seems that the booting gets stuck upon enabling second IOMMU by writing to DMAR_GCMD_REG (See the attaches debug log). The boot process passes this stage if second iommu was not enabled.
I tried multiple iommu options on boot, but it did not help.
There is no problem booting baremetal linux with IOMMU enabled.
The difference I have noticed its the version of microcode that is shown in baremetal and Xen.
Baremetal linux shows microcode version as 0x710, Xen as 0x70d, not sure if its relevant.
Any advise on how to address this is appreciated.
baremetal cpuinfo:
processor : 7vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2609 0 @ 2.40GHz
stepping : 7
microcode : 0x710
cpu MHz : 1200.000
cache size : 10240 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
apicid : 38
initial apicid : 38
fpu : yesfpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
bogomips : 4789.44
clflush size : 64cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management
Signature · 1 line
Elena
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 12/22/14 3:45 PM >>>
There is a problem with booting dom0 as pvh (xen-4.5rc3, kernel 3.18.0+).
This is all bit confusing: How does the Dom0 type matter when Dom0 doesn't even get started?
Quoted 1 line
After digging a bit into this it seems that the booting gets stuck upon enabling second IOMMU by writing to
DMAR_GCMD_REG(See the attaches debug log).
I'm afraid the log doesn't tell too much, namely without knowing where exactly you added your debugging code.
Quoted 3 lines
The boot process passes this stage if second iommu was not enabled. I tried multiple iommu options on boot, but it did not help. There is no problem booting baremetal linux with IOMMU enabled.
Good to know, but what's more important - did any version of Xen ever boot on that box with the IOMMU enabled? If so, what are the differences to the non-working case?
Quoted 2 lines
The difference I have noticed its the version of microcode that is shown in baremetal and Xen. Baremetal linux shows microcode version as
0x710, Xen as0x70d, not sure if its relevant.
Microcode is a CPU thing, while the IOMMU is a chipset component. An unfixed CPU erratum of course can cause all kinds of problems, but a connection seems unlikely here. Nevertheless - why don't you just have Xen load the newer microcode during boot?
Jan
Quoted 4 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 12/22/14 3:45 PM >>>
There is a problem with booting dom0 as pvh (xen-4.5rc3, kernel 3.18.0+).
Hi Jan.
This is all bit confusing: How does the Dom0 type matter when Dom0 doesn't
Quoted 2 lines
even get started?
I guess I used misleading wording and wanted to make obvious that this happens only if dom0pvh is set.
Quoted 8 lines
Quoted 1 line
After digging a bit into this it seems that the booting gets stuck upon
enabling second IOMMU by writing to
DMAR_GCMD_REG(See the attaches debug log).I'm afraid the log doesn't tell too much, namely without knowing where exactly
you added your debugging code.
I will send another console log, with debugging.
The last successful command is the reading status register of second IOMMU unit:
<snip from iommu_enable_translation() in./xen/drivers/passthrough/vtd/iommu.c>
746: sts = dmar_readl(iommu->reg, DMAR_GSTS_REG);
747: dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);
</snip>
After dmar_writel for second iommu the machine hangs.
Quoted 8 lines
Quoted 3 lines
The boot process passes this stage if second iommu was not enabled. I tried multiple iommu options on boot, but it did not help. There is no problem booting baremetal linux with IOMMU enabled.
Good to know, but what's more important - did any version of Xen ever boot on that box with the IOMMU enabled? If so, what are the differences to the non-working case?
Yes, I tried to boot it as pv dom0 and it booted just fine, taking the same codepath for enabling two iommu units.
What was different is dom0pvh=1 for sure, I will have to double check if iommu info is the same.
Quoted 11 lines
Quoted 2 lines
The difference I have noticed its the version of microcode that is shown
in baremetal and Xen.
Quoted 1 line
Baremetal linux shows microcode version as
0x710, Xen as0x70d, not sureif its relevant.
Microcode is a CPU thing, while the IOMMU is a chipset component. An unfixed CPU erratum of course can cause all kinds of problems, but a connection seems unlikely here. Nevertheless - why don't you just have Xen load the newer microcode during boot?
Does not seem to be relevant now.
I was hoping for some advises on magic debugging techniques I could use in this case!
I will collect more data and will re-send.
Quoted 8 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Signature · 1 line
Elena
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>
The last successful command is the reading status register of second IOMMU unit:
<snip from
iommu_enable_translation()in./xen/drivers/passthrough/vtd/iommu.c>
Quoted 6 lines
746: sts =
dmar_readl(iommu->reg, DMAR_GSTS_REG);
747:dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);</snip>
After
dmar_writelfor second iommu the machine hangs.
That's rather odd - you say it doesn't even reach the IOMMU_WAIT_OP() right after that? That would suggest a fault or other abnormal condition raised by the translation enabling (i.e. some problem with the page tables, albeit that should then have been a problem for the first IOMMU already). Yet an eventual fault can't be delivered at that point due to interrupts being disabled. Perhaps the VT-d maintainers (now Cc-ed) have some suggestion as to what's going on or how to diagnose.
Jan
Jan Beulich wrote on 2015-01-05:
Quoted 15 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>
The last successful command is the reading status register of second IOMMU
unit:<snip from
iommu_enable_translation()in./xen/drivers/passthrough/vtd/iommu.c>Quoted 6 lines
746: sts =
dmar_readl(iommu->reg, DMAR_GSTS_REG); 747:dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);</snip>
After
dmar_writelfor second iommu the machine hangs.
Quoted 7 lines
That's rather odd - you say it doesn't even reach the
IOMMU_WAIT_OP()
right after that? That would suggest a fault or other abnormal
condition raised by the translation enabling (i.e. some problem with
the page tables, albeit that should then have been a problem for the first IOMMU already). Yet an eventual fault can't be delivered at that point due to
interrupts being disabled. Perhaps the VT-d maintainers (now Cc-ed)
have some suggestion as to what's going on or how to diagnose.
I am curious why pv dom0 boot fine. Will pvh dom0 share EPT table with VT-d? Maybe try with disable sharing to see whether helps.
Quoted 2 lines
Jan
Best regards,
Yang
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>
The last successful command is the reading status register of second IOMMU unit:
<snip from
iommu_enable_translation()in./xen/drivers/passthrough/vtd/iommu.c>746: sts =
dmar_readl(iommu->reg, DMAR_GSTS_REG);
747:dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);
Quoted 6 lines
Quoted 3 lines
</snip>
After
dmar_writelfor second iommu the machine hangs.That's rather odd - you say it doesn't even reach the
IOMMU_WAIT_OP()right after that?
Thats odd, last tests I did show that it does complete the write to the control register
of the second drhd, but I cannot say if it reaches IOMMU_WAIT_OP() as right after this write it hangs.
I tried to enable iommu's in reverse order with the same result.
Quoted 4 lines
That would suggest a fault or other abnormal condition
raised by the translation enabling (i.e. some problem with the page tables, albeit that should then have been a problem for the first IOMMU already).
I wonder if such problem can be diagnosed without interrupt. Maybe reflected in error logging event registers?
Yet an eventual fault can't be delivered at that point due to interrupts
Quoted 4 lines
being
disabled. Perhaps the VT-d maintainers (now Cc-ed) have some suggestion as to what's going on or how to diagnose.
I will try to figure out if machine hangs completely at this point. Also checking the PCI topology for this machine and how it gets enumerated, maybe it will shed some light.
Will report back soon.
Quoted 4 lines
Jan
Signature · 1 line
Elena
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 06.01.15 at 23:20, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>
The last successful command is the reading status register of second IOMMU unit:
<snip from
iommu_enable_translation()in./xen/drivers/passthrough/vtd/iommu.c>746: sts =
dmar_readl(iommu->reg, DMAR_GSTS_REG);
747:dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);Quoted 6 lines
Quoted 3 lines
</snip>
After
dmar_writelfor second iommu the machine hangs.That's rather odd - you say it doesn't even reach the
IOMMU_WAIT_OP()right after that?
Quoted 6 lines
Thats odd, last tests I did show that it does complete the write to the control register
of the second drhd, but I cannot say if it reachesIOMMU_WAIT_OP()as right after this write it hangs.I tried to enable iommu's in reverse order with the same result.
"The same" being it hanging on the second one being enabled, or no hanging on the one getting enabled first?
Quoted 7 lines
Quoted 4 lines
That would suggest a fault or other abnormal condition
raised by the translation enabling (i.e. some problem with the page tables, albeit that should then have been a problem for the first IOMMU already).I wonder if such problem can be diagnosed without interrupt. Maybe reflected in error logging event registers?
Sure - you'd need to poll those registers, which you can't if the CPU really hangs. Or maybe you could try to monitor the IOMMU state from another CPU...
Jan
Quoted 13 lines · Yang Z
Elena Ufimtseva wrote on 2015-01-07:
Quoted 9 lines
On Mon, Jan 5, 2015 at 7:53 AM, Zhang, Yang Z <[email protected]> wrote:
Jan Beulich wrote on 2015-01-05: >>>> Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>>> TheQuoted 2 lines
last successful command is the reading status register of second >>
IOMMU >> unit: >> >> <snip from
Quoted 24 lines
iommu_enable_translation()in >>Quoted 3 lines
./xen/drivers/passthrough/vtd/iommu.c> >> >> 746: sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); 747: >> dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE); >> >> </snip> >> >>After
Quoted 1 line
dmar_writelfor second iommu the machine hangs. > > That'srather odd
Quoted 15 lines
- you say it doesn't even reach the
IOMMU_WAIT_OP()> right after that?
That would suggest a fault or other abnormal > condition raised by the translation enabling (i.e. some problem with > the page tables, albeitthat should then have been a problem for the first IOMMU already). > Yet an eventual fault can't be delivered at that point due to > interrupts being disabled. Perhaps the VT-d maintainers (now Cc-ed) >have some suggestion as to what's going on or how to diagnose.
I am curious why pv dom0 boot fine. Will pvh dom0 share EPT table
with VT-d? Maybe try with disable sharing to see whether helps.Yes, it is interesting. I am working on pvh guest boot under pv dom0.
Hi Yang
Somehow I dropped the list from this conversation. Adding back.
Quoted 5 lines
We can start from this point. It is not very hard to find the difference on IOMMU setup when booting pvh dom0 and pv dom0. Also, have you seen any difference on IOMMU register on working and non-working case?
I compared the registers and I did not find any difference in pv or pvh case.
I did it for both iommus, before enabling each unit and after. They are the same.
If you would like, I can post the dumps.
As for the differences between setting up iommu, I will check and get back with this.
Thank you for your advice.
Quoted 25 lines
Quoted 6 lines
I tried booting with non shared EPTs, but with the same result.
Quoted 12 lines
> > Jan Best regards, YangBest regards,
Yang
Signature · 1 line
Elena
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 25 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 06.01.15 at 23:20, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Elena Ufimtseva <[email protected]> 01/02/15 7:32 PM >>>
The last successful command is the reading status register of second IOMMU unit:
<snip from
iommu_enable_translation()in./xen/drivers/passthrough/vtd/iommu.c>746: sts =
dmar_readl(iommu->reg, DMAR_GSTS_REG);
747:dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_TE);Quoted 6 lines
Quoted 3 lines
</snip>
After
dmar_writelfor second iommu the machine hangs.That's rather odd - you say it doesn't even reach the
IOMMU_WAIT_OP()right after that?Thats odd, last tests I did show that it does complete the write to the control register
of the second drhd, but I cannot say if it reachesIOMMU_WAIT_OP()as right after this write it hangs.
Quoted 4 lines
Quoted 1 line
I tried to enable iommu's in reverse order with the same result.
"The same" being it hanging on the second one being enabled, or no hanging on the one getting enabled first?
"The same" meant the same behaviour.
Does not matter if iommu#1 (numbered in the order of enumeration) enabled first or after iommu#0,
machine hangs after enabling translation by writing to comman reg. of iommu#1.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
That would suggest a fault or other abnormal condition
raised by the translation enabling (i.e. some problem with the page tables, albeit that should then have been a problem for the first IOMMU already).
Quoted 6 lines
Quoted 2 lines
I wonder if such problem can be diagnosed without interrupt. Maybe reflected in error logging event registers?
Sure - you'd need to poll those registers, which you can't if the CPU really hangs. Or maybe you could try to monitor the IOMMU state from another CPU...
Thanks Jan for advise.
Yes, I can do this, pin dom0 to one cpu and poll the registers from another.
Quoted 3 lines
Jan
Signature · 1 line
Elena