All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Cc: xen-devel@lists.xenproject.org,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [Xen-devel] [PATCH v8 3/4] libxl: attach PCI device to qemu only after setting pciback/pcifront
Date: Mon, 30 Sep 2019 16:11:49 +0100	[thread overview]
Message-ID: <20190930151149.GE1163@perard.uk.xensource.com> (raw)
In-Reply-To: <66a544b7e292dfe227349ffcc75a0136ca27afb1.1569680095.git-series.marmarek@invisiblethingslab.com>

On Sat, Sep 28, 2019 at 04:20:36PM +0200, Marek Marczykowski-Górecki wrote:
> When qemu is running in stubdomain, handling "pci-ins" command will fail
> if pcifront is not initialized already. Fix this by sending such command
> only after confirming that pciback/front is running.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> Changes in v2:
> - Fixed code style since previous version.
> Changes in v8:
> - rebase on staging
> - rework for async api

The patch looks good, I only have coding style comments. With those
addressed:
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>


> diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
> index ac597a5..ba0287d 100644
> --- a/tools/libxl/libxl_pci.c
> +++ b/tools/libxl/libxl_pci.c
> @@ -1487,6 +1490,10 @@ static int libxl_pcidev_assignable(libxl_ctx *ctx, libxl_device_pci *pcidev)
>      return i != num;
>  }
>  
> +static void device_pci_add_stubdom_wait(libxl__egc *egc,
> +    pci_add_state *pas, int rc);
> +static void device_pci_add_stubdom_ready(libxl__egc *egc,
> +    libxl__ev_devstate* ds, int rc);

s/* ds/ *ds/

>  static void device_pci_add_stubdom_done(libxl__egc *egc,
>      pci_add_state *, int rc);
>  static void device_pci_add_done(libxl__egc *egc,
> @@ -1575,6 +1583,41 @@ out:
>      device_pci_add_done(egc, pas, rc); /* must be last */
>  }
>  
> +static void device_pci_add_stubdom_wait(libxl__egc *egc,
> +                                        pci_add_state *pas,
> +                                        int rc)
> +{
> +    libxl__ao_device *aodev = pas->aodev;
> +    STATE_AO_GC(aodev->ao);
> +    libxl_ctx *ctx = libxl__gc_owner(gc);
> +    int stubdomid = libxl_get_stubdom_id(ctx, pas->domid);

You can use `CTX' instead of declaring a local `ctx'

> +    char *state_path;
> +
> +    if (rc) goto out;
> +
> +    /* Wait for the device actually being connected, otherwise device model
> +     * running there will fail to find the device. */
> +    state_path = libxl__sprintf(gc, "%s/backend/pci/%d/0/state",
> +            libxl__xs_get_dompath(gc, 0), stubdomid);

I think you could use libxl__domain_device_backend_path(gc, 0,
stubdomid, 0, LIBXL__DEVICE_KIND_PCI) here instead.
Or at least "GCSPRINTF(" instead of "libxl__sprintf(gc, "

> +    rc = libxl__ev_devstate_wait(aodev->ao, &pas->pciback_ds,

You can use `ao' instead of `aodev->ao'. `ao' is decleared by
STATE_AO_GC().

> +            device_pci_add_stubdom_ready,
> +            state_path, XenbusStateConnected,
> +            LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000);

Thanks,

-- 
Anthony PERARD

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

  reply	other threads:[~2019-09-30 15:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-28 14:20 [Xen-devel] [PATCH v8 0/4] Fix PCI passthrough for HVM with stubdomain Marek Marczykowski-Górecki
2019-09-28 14:20 ` [Xen-devel] [PATCH v8 1/4] libxl: fix cold plugged PCI device " Marek Marczykowski-Górecki
2019-09-30 14:33   ` Anthony PERARD
2019-10-02 15:43   ` Ian Jackson
2019-10-02 15:54     ` Jürgen Groß
2019-10-04 16:03       ` Ian Jackson
2019-09-28 14:20 ` [Xen-devel] [PATCH v8 2/4] libxl: do not attach xen-pciback to HVM domain, if stubdomain is in use Marek Marczykowski-Górecki
2019-10-04 16:00   ` Ian Jackson
2019-09-28 14:20 ` [Xen-devel] [PATCH v8 3/4] libxl: attach PCI device to qemu only after setting pciback/pcifront Marek Marczykowski-Górecki
2019-09-30 15:11   ` Anthony PERARD [this message]
2019-10-01  4:24     ` [Xen-devel] [PATCH v8.1 " Marek Marczykowski-Górecki
2019-09-28 14:20 ` [Xen-devel] [PATCH v8 4/4] libxl: don't try to manipulate json config for stubdomain Marek Marczykowski-Górecki

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=20190930151149.GE1163@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=marmarek@invisiblethingslab.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.