* [PULL 0/1] xen queue @ 2023-03-23 10:01 Anthony PERARD via 2023-03-23 10:02 ` [PULL 1/1] accel/xen: Fix DM state change notification in dm_restrict mode Anthony PERARD via 2023-03-24 13:47 ` [PULL 0/1] xen queue Anthony PERARD via 0 siblings, 2 replies; 4+ messages in thread From: Anthony PERARD via @ 2023-03-23 10:01 UTC (permalink / raw) To: qemu-devel; +Cc: Anthony PERARD The following changes since commit 60ca584b8af0de525656f959991a440f8c191f12: Merge tag 'pull-for-8.0-220323-1' of https://gitlab.com/stsquad/qemu into staging (2023-03-22 17:58:12 +0000) are available in the Git repository at: https://xenbits.xen.org/git-http/people/aperard/qemu-dm.git tags/pull-xen-20230323 for you to fetch changes up to f75e4f2234e7339c16c1dba048bf131a2a948f84: accel/xen: Fix DM state change notification in dm_restrict mode (2023-03-23 09:56:54 +0000) ---------------------------------------------------------------- Xen queue - fix guest creation when -xen-domid-restrict is used ---------------------------------------------------------------- David Woodhouse (1): accel/xen: Fix DM state change notification in dm_restrict mode accel/xen/xen-all.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/1] accel/xen: Fix DM state change notification in dm_restrict mode 2023-03-23 10:01 [PULL 0/1] xen queue Anthony PERARD via @ 2023-03-23 10:02 ` Anthony PERARD via 2023-03-24 13:47 ` [PULL 0/1] xen queue Anthony PERARD via 1 sibling, 0 replies; 4+ messages in thread From: Anthony PERARD via @ 2023-03-23 10:02 UTC (permalink / raw) To: qemu-devel; +Cc: David Woodhouse, Anthony PERARD From: David Woodhouse <dwmw@amazon.co.uk> When dm_restrict is set, QEMU isn't permitted to update the XenStore node to indicate its running status. Previously, the xs_write() call would fail but the failure was ignored. However, in refactoring to allow for emulated XenStore operations, a new call to xs_open() was added. That one didn't fail gracefully, causing a fatal error when running in dm_restrict mode. Partially revert the offending patch, removing the additional call to xs_open() because the global 'xenstore' variable is still available; it just needs to be used with qemu_xen_xs_write() now instead of directly with the xs_write() libxenstore function. Also make the whole thing conditional on !xen_domid_restrict. There's no point even registering the state change handler to attempt to update the XenStore node when we know it's destined to fail. Fixes: ba2a92db1ff6 ("hw/xen: Add xenstore operations to allow redirection to internal emulation") Reported-by: Jason Andryuk <jandryuk@gmail.com> Co-developed-by: Jason Andryuk <jandryuk@gmail.com> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org> Tested-by: Jason Andryuk <jandryuk@gmail.com> Message-Id: <1f141995bb61af32c2867ef5559e253f39b0949c.camel@infradead.org> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- accel/xen/xen-all.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 00221e23c5..5ff0cb8bd9 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -32,28 +32,13 @@ xendevicemodel_handle *xen_dmod; static void xenstore_record_dm_state(const char *state) { - struct xs_handle *xs; char path[50]; - /* We now have everything we need to set the xenstore entry. */ - xs = xs_open(0); - if (xs == NULL) { - fprintf(stderr, "Could not contact XenStore\n"); - exit(1); - } - snprintf(path, sizeof (path), "device-model/%u/state", xen_domid); - /* - * This call may fail when running restricted so don't make it fatal in - * that case. Toolstacks should instead use QMP to listen for state changes. - */ - if (!xs_write(xs, XBT_NULL, path, state, strlen(state)) && - !xen_domid_restrict) { + if (!qemu_xen_xs_write(xenstore, XBT_NULL, path, state, strlen(state))) { error_report("error recording dm state"); exit(1); } - - xs_close(xs); } @@ -111,7 +96,15 @@ static int xen_init(MachineState *ms) xc_interface_close(xen_xc); return -1; } - qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); + + /* + * The XenStore write would fail when running restricted so don't attempt + * it in that case. Toolstacks should instead use QMP to listen for state + * changes. + */ + if (!xen_domid_restrict) { + qemu_add_vm_change_state_handler(xen_change_state_handler, NULL); + } /* * opt out of system RAM being allocated by generic code */ -- Anthony PERARD ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/1] xen queue 2023-03-23 10:01 [PULL 0/1] xen queue Anthony PERARD via 2023-03-23 10:02 ` [PULL 1/1] accel/xen: Fix DM state change notification in dm_restrict mode Anthony PERARD via @ 2023-03-24 13:47 ` Anthony PERARD via 2023-03-24 14:44 ` Peter Maydell 1 sibling, 1 reply; 4+ messages in thread From: Anthony PERARD via @ 2023-03-24 13:47 UTC (permalink / raw) To: peter.maydell; +Cc: qemu-devel On Thu, Mar 23, 2023 at 10:01:59AM +0000, Anthony PERARD wrote: > The following changes since commit 60ca584b8af0de525656f959991a440f8c191f12: > > Merge tag 'pull-for-8.0-220323-1' of https://gitlab.com/stsquad/qemu into staging (2023-03-22 17:58:12 +0000) > > are available in the Git repository at: > > https://xenbits.xen.org/git-http/people/aperard/qemu-dm.git tags/pull-xen-20230323 > > for you to fetch changes up to f75e4f2234e7339c16c1dba048bf131a2a948f84: > > accel/xen: Fix DM state change notification in dm_restrict mode (2023-03-23 09:56:54 +0000) > > ---------------------------------------------------------------- > Xen queue > > - fix guest creation when -xen-domid-restrict is used Hi Peter, I'd like to cancel this pull request. I've got another patch to add to it. Is that fine? If I don't have any reply, I'll create a new PR later today and consider this one cancel. Cheers, -- Anthony PERARD ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PULL 0/1] xen queue 2023-03-24 13:47 ` [PULL 0/1] xen queue Anthony PERARD via @ 2023-03-24 14:44 ` Peter Maydell 0 siblings, 0 replies; 4+ messages in thread From: Peter Maydell @ 2023-03-24 14:44 UTC (permalink / raw) To: Anthony PERARD; +Cc: qemu-devel On Fri, 24 Mar 2023 at 13:47, Anthony PERARD <anthony.perard@citrix.com> wrote: > > On Thu, Mar 23, 2023 at 10:01:59AM +0000, Anthony PERARD wrote: > > The following changes since commit 60ca584b8af0de525656f959991a440f8c191f12: > > > > Merge tag 'pull-for-8.0-220323-1' of https://gitlab.com/stsquad/qemu into staging (2023-03-22 17:58:12 +0000) > > > > are available in the Git repository at: > > > > https://xenbits.xen.org/git-http/people/aperard/qemu-dm.git tags/pull-xen-20230323 > > > > for you to fetch changes up to f75e4f2234e7339c16c1dba048bf131a2a948f84: > > > > accel/xen: Fix DM state change notification in dm_restrict mode (2023-03-23 09:56:54 +0000) > > > > ---------------------------------------------------------------- > > Xen queue > > > > - fix guest creation when -xen-domid-restrict is used > > Hi Peter, > > I'd like to cancel this pull request. I've got another patch to add to > it. Is that fine? If I don't have any reply, I'll create a new PR later > today and consider this one cancel. That's fine. I had been holding off on it until I could combine it with another, to save on the CI resources... -- PMM ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-24 15:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-03-23 10:01 [PULL 0/1] xen queue Anthony PERARD via 2023-03-23 10:02 ` [PULL 1/1] accel/xen: Fix DM state change notification in dm_restrict mode Anthony PERARD via 2023-03-24 13:47 ` [PULL 0/1] xen queue Anthony PERARD via 2023-03-24 14:44 ` Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).