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

Re: [Xen-devel] PCI Passthrough bug with x86 HVM



On 26.06.19 14:21, Chao Gao wrote:
On Wed, Jun 26, 2019 at 08:17:50AM +0200, Juergen Gross wrote:
On 24.06.19 20:47, Stefano Stabellini wrote:
+ xen-devel

On Mon, 24 Jun 2019, Stefano Stabellini wrote:
Hi all,

I might have found a bug with PCI passthrough to a Linux HVM guest on
x86 with Xen 4.12. It is not easy for me to get access, and especially
change components, on this particular system, and I don't have access to
other x86 boxes at the moment, so apologies for the partial information
report. The setup is as follow:

- two PCI devices have been assigned to a HVM guest, everything is fine
- reboot the guest from inside, i.e. `reboot' in Linux
- after the reboot completes, only one device is assigned

Before the reboot, I see all the appropriate xenstore entries for both
devices. Everything is fine. After the reboot, I can only see the
xenstore entries of one device. It is as if the other device
"disappeared" without throwing any errors.

Have you seen this before? Do you know if it has been fixed in staging?
I noticed this fix which seems to be very relevant:

https://lists.xenproject.org/archives/html/xen-devel/2018-11/msg01616.html

but it is already included in 4.12.

Stefano, could you please try the attached patch? It is only compile
tested for now.


Juergen

From ea95dcdfc60a895cc43baf34c8e0fb088e10008d Mon Sep 17 00:00:00 2001
From: Juergen Gross <jgross@xxxxxxxx>
To: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wl@xxxxxxx>
Date: Wed, 26 Jun 2019 08:15:28 +0200
Subject: [PATCH] libxl: fix pci device re-assigning after domain reboot

After a reboot of a guest only the first pci device configuration will
be retrieved from Xenstore resulting in loss of any further assigned
passed through pci devices.

The main reason is that all passed through pci devices reside under a
common root device "0" in Xenstore. So when the device list is rebuilt
from Xenstore after a reboot the sub-devices below that root device
need to be selected instead of using the root device number as a
selector.

Fix that by adding a new member to struct libxl_device_type which when
set is used to get the number of devices. Add such a member for pci to
get the correct number of pci devices instead of implying it from the
number of pci root devices (which will always be 1).

While at it fix the type of libxl__device_pci_from_xs_be() to match
the one of the .from_xenstore member of struct libxl_device_type. This
fixes a latent bug checking the return value of a function returning
void.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Tested-by: Chao Gao <chao.gao@xxxxxxxxx>

Thanks!


Note that I just tested it on RELEASE-4.12.0, not staging.

I also found USB device would miss across reboot. Is there someone
willing to fix it too?

I'll have a look.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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