From: Anthony PERARD <anthony.perard@citrix.com>
To: Jason Andryuk <jandryuk@gmail.com>
Cc: <xen-devel@lists.xenproject.org>, Jan Beulich <jbeulich@suse.com>,
"Paul Durrant" <paul@xen.org>, Wei Liu <wl@xen.org>,
Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH v4] libxl/PCI: Fix PV hotplug & stubdom coldplug
Date: Thu, 13 Jan 2022 10:39:26 +0000 [thread overview]
Message-ID: <YeABXp55XWTVd7rL@perard> (raw)
In-Reply-To: <20220113040142.20503-1-jandryuk@gmail.com>
On Wed, Jan 12, 2022 at 11:01:42PM -0500, Jason Andryuk wrote:
> commit 0fdb48ffe7a1 "libxl: Make sure devices added by pci-attach are
> reflected in the config" broken PCI hotplug (xl pci-attach) for PV
> domains when it moved libxl__create_pci_backend() later in the function.
>
> This also broke HVM + stubdom PCI passthrough coldplug. For that, the
> PCI devices are hotplugged to a running PV stubdom, and then the QEMU
> QMP device_add commands are made to QEMU inside the stubdom.
>
> A running PV domain calls libxl__wait_for_backend(). With the current
> placement of libxl__create_pci_backend(), the path does not exist and
> the call immediately fails:
> libxl: error: libxl_device.c:1388:libxl__wait_for_backend: Backend /local/domain/0/backend/pci/43/0 does not exist
> libxl: error: libxl_pci.c:1764:device_pci_add_done: Domain 42:libxl__device_pci_add failed for PCI device 0:2:0.0 (rc -3)
> libxl: error: libxl_create.c:1857:domcreate_attach_devices: Domain 42:unable to add pci devices
>
> The wait is only relevant when:
> 1) The domain is PV
> 3) The domain is running
> 2) The backend is already present
>
> 1) xen-pcifront is only used for PV. It does not load for HVM domains
> where QEMU is used.
>
> 2) If the domain is not running (starting), then the frontend state will
> be Initialising. xen-pciback waits for the frontend to transition to
> at Initialised before attempting to connect. So a wait for a
> non-running domain is not applicable as the backend will not
> transition to Connected.
>
> 3) For presence, num_devs is already used to determine if the backend
> needs to be created. Re-use num_devs to determine if the backend
> wait is necessary. The wait is necessary to avoid racing with
> another PCI attachment reconfiguring the front/back or changing to
> some other state like closing. If we are creating the backend, then
> we don't have to worry about the state since it is being created.
>
> Fixes: 0fdb48ffe7a1 ("libxl: Make sure devices added by pci-attach are
> reflected in the config")
>
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
That patch is probably good enough for now, even if there is probably need to
rework the function with regards to issue raised in
https://lore.kernel.org/xen-devel/24859.43747.87671.739214@mariner.uk.xensource.com/
in the thread.
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Thanks,
--
Anthony PERARD
prev parent reply other threads:[~2022-01-13 10:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-13 4:01 [PATCH v4] libxl/PCI: Fix PV hotplug & stubdom coldplug Jason Andryuk
2022-01-13 8:30 ` Durrant, Paul
2022-01-13 10:39 ` Anthony PERARD [this message]
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=YeABXp55XWTVd7rL@perard \
--to=anthony.perard@citrix.com \
--cc=jandryuk@gmail.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=paul@xen.org \
--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.