WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] issue in unplug qemu PCI devices

To: "Stefano Stabellini" <stefano.stabellini@xxxxxxxxxxxxx>, "Edwin Zhai" <edwin.zhai@xxxxxxxxx>
Subject: Re: [Xen-devel] issue in unplug qemu PCI devices
From: "Ky Srinivasan" <ksrinivasan@xxxxxxxxxx>
Date: Fri, 12 Feb 2010 14:57:30 -0700
Cc: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxxx>
Delivery-date: Fri, 12 Feb 2010 13:58:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1002121606100.1147@kaball-desktop>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4B7515D9.7060407@xxxxxxxxx> <alpine.DEB.2.00.1002121606100.1147@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

>>> On 2/12/2010 at 12:14 PM, in message
<alpine.DEB.2.00.1002121606100.1147@kaball-desktop>, Stefano Stabellini
<stefano.stabellini@xxxxxxxxxxxxx> wrote: 
> On Fri, 12 Feb 2010, Zhai, Edwin wrote:
>> IOEMU change set e7911109 uses Magic ioport (0x10) protocol for 
>> negotating with guest PV drivers during startup, and allowing PV drivers 
>> to disable hardware emulations thus preventing guest from seeing the 
>> same device through two paths.
>> 
>> But when I tried PV drivers in xen upstream, this unplug logic never 
>> succeed. PV driver uses following io sequence to interact with 
>> platform_pci device in qemu:
>> 1. inw 0x10
>> 2. inb 0x12
>> 3. outw(0x12, 0xbeef)
>> 4. outl(0x10,0xdead)
>> 
>> But I only saw 1&2 happened in xen io instruction 
>> emulation(x86_emulate), while 3&4 seemed to lost so the unplug will 
>> never happen.
Looks like in 3&4 have the parameters reversed - the first parameter I think 
should be the value and the second parameter should be the port.

Regards,

K. Y


>> 
>> Are you aware of this issue? Or some suggestion for debugging?
>> 
>> BTW, the unplug logic itself has some issues also:
>> 1. Pass-through NICs are also unplugged, although them have different 
>> path with vnif and emulated NIC.
>> 2. Unplug happens as long as inserting the xen_platform_pci module 
>> regardless of existence of PVed device in the config file. End user 
>> likely to unplug all the PCI device by accident.
>> 3. Inserting xen_platform_pci module would unplug all the devices, which 
>> is not reasonable. E.g. end user only has vbd driver, but all NICs are 
>> also unplugged.
>> 
> 
> You are right, that is a bug and this patch should fix it.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> 
> ---
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index d7c516e..01eff8d 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -826,7 +826,8 @@ void pci_unplug_netifs(void)
>             dev = bus->devices[x];
>             if (dev &&
>                 dev->config[0xa] == 0 &&
> -               dev->config[0xb] == 2) {
> +               dev->config[0xb] == 2 &&
> +               test_pci_slot(x >> 3) != 1) {
>                 /* Found a netif.  Remove it from the bus.  Note that
>                    we don't free it here, since there could still be
>                    references to it floating around.  There are only
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel