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

Re: [Xen-devel] GPU passthrough issue when VM is configured with 4G memory




> -----Original Message-----
> From: Hao, Xudong [mailto:xudong.hao@xxxxxxxxx]
> Sent: 2013年4月25日 16:13
> To: Hanweidong; Stefano Stabellini
> Cc: George Dunlap; Yanqiangjun; Luonengjun; Wangzhenguo; Yangxiaowei;
> Gonglei (Arei); Anthony Perard; xen-devel@xxxxxxxxxxxxx; Zhang, Xiantao
> Subject: RE: [Xen-devel] GPU passthrough issue when VM is configured
> with 4G memory
> 
> > > > > In addition, we found QEMU uses hardcode 0xe0000000 in
> pc_init1()
> > > as
> > > > below.
> > > > > Should keep these places handle the consistent mmio hole or not?
> > > > >
> > > > >     if (ram_size >= 0xe0000000 ) {
> > > > >         above_4g_mem_size = ram_size - 0xe0000000;
> > > > >         below_4g_mem_size = 0xe0000000;
> > > > >     } else {
> > > > >         above_4g_mem_size = 0;
> > > > >         below_4g_mem_size = ram_size;
> > > > >     }
> > > >
> > > > The guys at Intel sent a couple of patches recently to fix this
> issue:
> > > >
> > > > http://marc.info/?l=xen-devel&m=136150317011027
> > > > http://marc.info/?l=qemu-devel&m=136177475215360&w=2
> > > >
> > > > Do they solve your problem?
> > >
> > > These two patches didn't solve our problem.
> > >
> >
> > I debugged this issue with above two patches. I want to share some
> > information and discuss solution here. This issue is actually caused
> by that a
> > VM has a large pci hole (mmio size) which results in QEMU sets memory
> > regions inconsistently with hvmloader (QEMU uses hardcode 0xe0000000
> in
> > pc_init1 and xen_ram_init). I created a virtual device with 1GB mmio
> size to
> > debug this issue. Firstly, QEMU set memory regions except pci hole
> region in
> > pc_init1() and xen_ram_init(), then hvmloader calculated
> pci_mem_start as
> > 0x80000000, and wrote it to TOM register, which triggered QEMU to
> update
> > pci hole region with 0x80000000 using i440fx_update_pci_mem_hole().
> Finally
> > the windows 7 VM (configured 8G) crashed with BSOD code 0x00000024.
> If I
> > hardcode in QEMU pc_init1 and xen_ram_init to match hvmloader's. Then
> the
> > problem was gone.
> >
> > Althrough above two patches will pass actual pci hole start address
> to QEMU,
> > but it's too late, QEMU pc_init1() and xen_ram_init() already set the
> other
> > memory regions, and obviously the pci hole might overlap with ram
> regions in
> > this case.
> 
> How about update ram region as well when pci memory hole updating?

will have a try to see what will happen.

> 
> > So I think hvmloader should setup pci devices and calculate pci hole
> > first, then QEMU can map memory regions correctly from the beginning.
> >
> 
> Every device may be different bar size, the start address of pci hole
> will be different by hvmloader calculating result, so it still need a
> channel to report this address to qemu.
> 

Yes, it needs a channel to tell qemu. It's best if the channel can pass the 
actual pci hole to QEMU before QEMU maps memory regions.

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

 


Rackspace

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