xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Hanweidong <hanweidong@huawei.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Yanqiangjun <yanqiangjun@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	Wangzhenguo <wangzhenguo@huawei.com>,
	Yangxiaowei <xiaowei.yang@huawei.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	Anthony Perard <anthony.perard@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: GPU passthrough issue when VM is configured with 4G memory
Date: Thu, 7 Mar 2013 10:16:16 +0000	[thread overview]
Message-ID: <513868F0.6020104@eu.citrix.com> (raw)
In-Reply-To: <FAB5C136CA8BEA4DBEA2F641E3F536384A8A67D5@szxeml538-mbx.china.huawei.com>

On 07/03/13 07:51, Hanweidong wrote:
>> -----Original Message-----
>> From: George Dunlap [mailto:george.dunlap@eu.citrix.com]
>> Sent: 2013年3月6日 20:43
>> To: Hanweidong
>> Cc: Gonglei (Arei); xen-devel@lists.xen.org; Yangxiaowei; Yanqiangjun;
>> Luonengjun; Wangzhenguo
>> Subject: Re: [Xen-devel] GPU passthrough issue when VM is configured
>> with 4G memory
>>
>> On 06/03/13 11:38, Hanweidong wrote:
>>>> -----Original Message-----
>>>> From: dunlapg@gmail.com [mailto:dunlapg@gmail.com] On Behalf Of
>> George
>>>> Dunlap
>>>> Sent: 2013年3月5日 20:59
>>>> To: Gonglei (Arei)
>>>> Cc: xen-devel@lists.xen.org; Yangxiaowei; Yanqiangjun; Luonengjun;
>>>> Wangzhenguo; Hanweidong
>>>> Subject: Re: [Xen-devel] GPU passthrough issue when VM is configured
>>>> with 4G memory
>>>>
>>>> On Mon, Mar 4, 2013 at 8:10 AM, Gonglei (Arei)
>> <arei.gonglei@huawei.com>
>>>> wrote:
>>>>> Hi,all
>>>>>
>>>>> I have tried to passthrough GPU card(Nvidia quadro 4000) on the
>>>> latest Xen
>>>>> unstable version (QEMU is using Qemu-upsteam-unstable, not
>>>> traditional
>>>>> Qemu). This issue as below:
>>>>>
>>>>>        Windows7 64-bit guest will blue screen when GPU passthrough
>>>> configure
>>>>> 4g memory,blue screen code is 50, and SUSE 11 64-bit guest will
>>>> always stay
>>>>> at the grub screen.  I noticed that it will relocate RAM that
>>>> overlaps PCI
>>>>> space in pci_setup()(tools/hvmloader/pci.c). If VM memory is
>>>> configured with
>>>>> 3G, it won't cause relocate RAM that overlaps PCI space in
>>>> pci_setup(), and
>>>>> GPU pass-through is no problem. So it seems this issue is related
>> to
>>>>> "relocate RAM" in pci_setup().
>>>> So one issue XenServer found with passing through GPUs is that there
>>>> are bugs in some PCI bridges that completely break VT-d.  The issue
>>>> was that if the *guest* physical address space overlapped the *host*
>>>> physical address of a different device, that the PCI bridges would
>>>> send traffic from the passed-through card intended for the guest to
>>>> another card instead.  The work-around was to make the hole in the
>>>> guest MMIO space the same size as the host MMIO hole.  I'm not sure
>> if
>>>> that made it upstream or not -- let me check...
>>>>
>>> Hi George,
>>>
>>> Could you post your patch and let us have a try with it? Thanks!
>> So the patch got checked in, but there still may be some more work if
>> you want to use it. :-)
>>
>> The patch modifies xc_hvm_build_args structure to include a field
>> called
>> "mmio_size". If this is set to zero, it will default to
>> HVM_BELOW_4G_MMIO_LENGTH; otherwise, it will be the size of the default
>> MMIO hole set during the build process. The guest BIOS may modify this
>> at boot time to make it bigger, but it doesn't make it smaller.
>>
>> Since this was designed for xapi, however, which calls libxc directly,
>> we didn't add any options to xend / xl / libxl to set this option.
>>
>> The easiest way to test it probably is just to hard-code
>> HVM_BELOW_4G_MMIO_LENGTH to a new value (from the description, setting
>> it to 1GiB should be sufficient).
>>
>> Then if you want to use it in production, you probably want to either:
>> 1. Try it with the latest version of XCP (which I think has an option
>> you can set)
>> 2. Implement a config option for xl that allows you to set the MMIO
>> hole
>> size.
>>
>> #2 should be a relatively straightforward matter of "plumbing", and
>> would be a welcome contribution. :-)
>>
>> If you do implement #2, it might be nice to have an option of
>> "mmio_hole_size=host", which will set the guest mmio hole to the same
>> size as the host. That's what we implemented for XenServer, to make
>> sure
>> there would never be any collisions.
>>
> We rooted caused this issue: in pci_setup, it relocates pci_mem_start from 
> 0xF0000000 to 0XE0000000 because GPU has big more MMIO, but in QEMU, 
> xen_ram_init directly uses the macro HVM_BELOW_4G_RAM_END and 
> HVM_BELOW_4G_MMIO_LENGTH, doesn't do corresponding relocation like pci_setup
> does.
>
> We tried to hardcod HVM_BELOW_4G_RAM_END to 0XE0000000, GPU pass-through
> Worked.

I'm not super familiar with the HVM qemu / guest BIOS stuff, but it
sounds like that's a bug in pass-through that needs to be sorted out.
Anthony, can you comment?

-George

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

  reply	other threads:[~2013-03-07 10:16 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04  8:10 GPU passthrough issue when VM is configured with 4G memory Gonglei (Arei)
2013-03-05  9:50 ` Pasi Kärkkäinen
2013-03-05 12:44   ` Hanweidong
2013-03-05 13:20     ` Pasi Kärkkäinen
2013-03-05 14:21       ` Matthias
2013-03-05 14:27         ` Pasi Kärkkäinen
2013-03-05 14:41           ` Matthias
2013-03-06 11:35       ` Hanweidong
2013-03-05 12:59 ` George Dunlap
2013-03-06 11:38   ` Hanweidong
2013-03-06 12:43     ` George Dunlap
2013-03-06 14:04       ` Pasi Kärkkäinen
2013-03-06 19:45         ` Konrad Rzeszutek Wilk
2013-03-07  7:51       ` Hanweidong
2013-03-07 10:16         ` George Dunlap [this message]
2013-03-12  5:45           ` Hanweidong
2013-03-12 10:39             ` George Dunlap
2013-03-13 13:23               ` Hanweidong
2013-03-16 23:41                 ` youenn.gestin
2013-03-17 17:32                   ` Pasi Kärkkäinen
2013-03-18 22:43                     ` youenn.gestin
2013-03-19  7:28                       ` David TECHER
2013-03-18 12:02                 ` Stefano Stabellini
2013-03-18 15:40                   ` Hao, Xudong
2013-03-19  0:34                   ` Hanweidong
2013-03-26  9:37                   ` Hanweidong
2013-04-15 21:22                     ` Pasi Kärkkäinen
2013-04-16  0:44                       ` David TECHER
2013-04-16  3:54                         ` Pasi Kärkkäinen
2013-04-16  9:21                           ` David TECHER
2013-04-16 12:45                             ` Hanweidong
2013-04-16 12:37                       ` George Dunlap
2013-04-16 12:46                         ` Ian Campbell
2013-04-25  3:46                     ` Hanweidong
2013-04-25  8:12                       ` Hao, Xudong
2013-04-25 14:23                         ` Hanweidong
2013-04-25 10:29                       ` George Dunlap
2013-04-25 14:24                         ` Hanweidong
2013-05-09 16:49                           ` Pasi Kärkkäinen
2013-05-17  7:10                             ` Hanweidong
2013-05-17  7:37                               ` Gordan Bobic
2013-05-20  8:20                               ` Pasi Kärkkäinen
2013-05-20 11:29                               ` George Dunlap
2013-05-20 13:00                                 ` Stefano Stabellini
2013-05-20 18:43                                 ` Gordan Bobic
2013-05-21  4:09                                   ` Hanweidong
2013-05-22 15:17                                     ` Gordan Bobic
2013-05-22 18:11                                       ` Andrew Bobulsky
2013-05-22 18:41                                         ` Gordan Bobic
2013-05-23 14:38                                       ` Hanweidong
2013-05-29 16:18                       ` Stefano Stabellini
2013-05-30  1:29                         ` Hanweidong
2013-05-30 10:27                           ` GPU passthrough issue when VM is configured with 4G memoryo Stefano Stabellini
2013-05-30 10:45                             ` Hanweidong
2013-06-03 13:11                         ` GPU passthrough issue when VM is configured with 4G memory Konrad Rzeszutek Wilk
2013-06-03 15:14                           ` Stefano Stabellini
2013-09-26 20:09                         ` GPU passthrough issue when VM is configured with 4G memory / Xen 4.4 Pasi Kärkkäinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513868F0.6020104@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=arei.gonglei@huawei.com \
    --cc=hanweidong@huawei.com \
    --cc=luonengjun@huawei.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wangzhenguo@huawei.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xiaowei.yang@huawei.com \
    --cc=yanqiangjun@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).