All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH] libxl: fix pci device re-assigning after domain reboot
Date: Thu, 27 Jun 2019 10:28:34 +0200	[thread overview]
Message-ID: <20190627082834.ge2gr3lljjnomug5@MacBook-Air-de-Roger.local> (raw)
In-Reply-To: <20190626133726.29896-1-jgross@suse.com>

On Wed, Jun 26, 2019 at 03:37:26PM +0200, Juergen Gross wrote:
> 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@suse.com>
> Tested-by: Chao Gao <chao.gao@intel.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks!

> ---
>  tools/libxl/libxl_device.c   | 24 +++++++++++++++++++-----
>  tools/libxl/libxl_internal.h |  2 ++
>  tools/libxl/libxl_pci.c      | 35 ++++++++++++++++++++++++++---------
>  3 files changed, 47 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
> index db6c0203b7..a2569102ee 100644
> --- a/tools/libxl/libxl_device.c
> +++ b/tools/libxl/libxl_device.c
> @@ -2026,6 +2026,7 @@ void *libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt,
>      char *libxl_path;
>      char **dir = NULL;
>      unsigned int ndirs = 0;
> +    unsigned int ndevs = 0;

I think you could reduce the scope of ndevs...

>      int rc;
>  
>      *num = 0;
> @@ -2037,21 +2038,34 @@ void *libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt,
>      dir = libxl__xs_directory(gc, XBT_NULL, libxl_path, &ndirs);
>  
>      if (dir && ndirs) {

... by declaring it here.

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

  reply	other threads:[~2019-06-27  8:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 13:37 [Xen-devel] [PATCH] libxl: fix pci device re-assigning after domain reboot Juergen Gross
2019-06-27  8:28 ` Roger Pau Monné [this message]
2019-07-10 18:44   ` Ian Jackson
2019-07-23 20:57     ` 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=20190627082834.ge2gr3lljjnomug5@MacBook-Air-de-Roger.local \
    --to=roger.pau@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.