xen queue 2019-08-27
The following changes since commit dac03af5d5482ec7ee9c23db467bb7230b33c0d9:
Merge remote-tracking branch 'remotes/rth/tags/pull-axp-20190825' into staging (2019-08-27 10:00:51 +0100)
are available in the Git repository at:
https://xenbits.xen.org/git-http/people/aperard/qemu-dm.git tags/pull-xen-20190827
for you to fetch changes up to 705be570941b38cd1cbebc68f7f671ce7532ecb0:
xen-bus: Avoid rewriting identical values to xenstore (2019-08-27 14:18:28 +0100)
----------------------------------------------------------------
Xen queue
* Fixes for xen-bus and exit cleanup.
* Build fix.
----------------------------------------------------------------
Anthony PERARD (3):
xen: Fix ring.h header
xen-bus: Fix backend state transition on device reset
xen-bus: Avoid rewriting identical values to xenstore
Igor Druzhinin (1):
xen: cleanup IOREQ server on exit
hw/i386/xen/xen-hvm.c | 2 ++ hw/xen/xen-bus.c | 34 +++++++++++++++++++++++++++------- include/hw/xen/interface/io/ring.h | 13 +++++++------ 3 files changed, 36 insertions(+), 13 deletions(-)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
[Qemu-devel] [PULL 1/4] xen: Fix ring.h header
The xen_[rw]?mb() macros defined in ring.h can't be used and the fact that there are gated behind __XEN_INTERFACE_VERSION__ means that it needs to be defined somewhere. QEMU doesn't implement interfaces with the Xen hypervisor so defining __XEN_INTERFACE_VERSION__ is pointless. This leads to:
include/hw/xen/io/ring.h:47:5: error: "__XEN_INTERFACE_VERSION__"
is not defined, evaluates to 0 [-Werror=undef]
Cleanup ring.h. The xen_*mb() macros are already defined in xenctrl.h which is included in xen_common.h.
Message-Id: <[email protected]>
--- include/hw/xen/interface/io/ring.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
include/hw/xen/interface/io/ring.h +7 -6
@@ -33,6 +33,13 @@* - standard integers types (uint8_t, uint16_t, etc) * They are provided by stdint.h of the standard headers. * +* Before using the different macros, you need to provide the following +* macros: +* - xen_mb() a memory barrier +* - xen_rmb() a read memory barrier +* - xen_wmb() a write memory barrier +* Example of those can be found in xenctrl.h. +* * In addition, if you intend to use the FLEX macros, you also need to * provide the following, before invoking the FLEX macros: * - size_t
@@ -42,12 +49,6 @@* and grant_table.h from the Xen public headers. */ -#if __XEN_INTERFACE_VERSION__ <0x00030208 -#define xen_mb () mb() -#define xen_rmb () rmb() -#define xen_wmb () wmb() -#endif -typedef unsigned int RING_IDX ;/* Round a 32-bit unsigned constant down to the nearest power of two. */
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
[Qemu-devel] [PULL 2/4] xen: cleanup IOREQ server on exit
In reply to Anthony PERARDFrom: Igor Druzhinin <[email protected]>
Device model is supposed to destroy IOREQ server for itself.
Message-Id: <[email protected]>
--- hw/i386/xen/xen-hvm.c | 2 ++ 1 file changed, 2 insertions(+)
hw/i386/xen/xen-hvm.c +2 -0
@@ -1247,6 +1247,8 @@ static void xen_exit_notifier(Notifier *n, void *data) {XenIOState *state =container_of (n, XenIOState, exit); +xen_destroy_ioreq_server (xen_domid, state->ioservid); +xenevtchn_close (state->xce_handle);xs_daemon_close (state->xenstore); }
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
[Qemu-devel] [PULL 3/4] xen-bus: Fix backend state transition on device reset
In reply to Anthony PERARDWhen a frontend wants to reset its state and the backend one, it starts with setting "Closing", then waits for the backend (QEMU) to do the same.
But when QEMU is setting "Closing" to its state, it triggers an event (xenstore watch) that re-execute xen_device_backend_changed() and set the backend state to "Closed". QEMU should wait for the frontend to set "Closed" before doing the same.
Before setting "Closed" to the backend_state, we are also going to check if there is a frontend. If that the case, when the backend state is set to "Closing" the frontend should react and sets its state to "Closing" then "Closed". The backend should wait for that to happen.
Message-Id: <[email protected]>
--- hw/xen/xen-bus.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
hw/xen/xen-bus.c +20 -3
@@ -516,6 +516,23 @@ static void xen_device_backend_set_online(XenDevice *xendev, bool online)xen_device_backend_printf (xendev,"online" ,"%u" , online); } +/* +* Tell from the state whether the frontend is likely alive, +* i.e. it will react to a change of state of the backend. +*/ +static bool xen_device_state_is_active (enum xenbus_state state) +{ +switch (state) { +case XenbusStateInitWait: +case XenbusStateInitialised: +case XenbusStateConnected: +case XenbusStateClosing: +return true; +default : +return false; + } +} +static void xen_device_backend_changed (void *opaque) {XenDevice *xendev = opaque;
@@ -539,11 +556,11 @@ static void xen_device_backend_changed(void *opaque)/* * If the toolstack (or unplug request callback) has set the backend -* state to Closing, but there is no active frontend (i.e. the -* state is not Connected) then set the backend state to Closed. +* state to Closing, but there is no active frontend then set the +* backend state to Closed. */ if (xendev->backend_state == XenbusStateClosing && - xendev->frontend_state != XenbusStateConnected) { + !xen_device_state_is_active (state)) {xen_device_backend_set_state (xendev, XenbusStateClosed); }
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
[Qemu-devel] [PULL 4/4] xen-bus: Avoid rewriting identical values to xenstore
In reply to Anthony PERARDWhen QEMU receives a xenstore watch event suggesting that the "state" of the frontend changed, it records this in its own state but it also re-write the value back into xenstore even so there were no change. This triggers an unnecessary xenstore watch event which QEMU will process again (and maybe the frontend as well). Also QEMU could potentially write an already old value.
Message-Id: <[email protected]>
--- hw/xen/xen-bus.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
hw/xen/xen-bus.c +7 -4
@@ -698,7 +698,8 @@ int xen_device_frontend_scanf(XenDevice *xendev, const char *key, }static void xen_device_frontend_set_state (XenDevice *xendev, -enum xenbus_state state) +enum xenbus_state state, +bool publish) {const char *type =object_get_typename (OBJECT (xendev));
@@ -710,7 +711,9 @@ static void xen_device_frontend_set_state(XenDevice *xendev, xs_strstate(state)); xendev->frontend_state = state; -xen_device_frontend_printf (xendev,"state" ,"%u" , state); +if (publish) { +xen_device_frontend_printf (xendev,"state" ,"%u" , state); + } }static void xen_device_frontend_changed (void *opaque)
@@ -726,7 +729,7 @@ static void xen_device_frontend_changed(void *opaque) state = XenbusStateUnknown; } -xen_device_frontend_set_state (xendev, state); +xen_device_frontend_set_state (xendev, state, false); if (state == XenbusStateInitialising && xendev->backend_state == XenbusStateClosed &&
@@ -1169,7 +1172,7 @@ static void xen_device_realize(DeviceState *dev, Error **errp)xen_device_frontend_printf (xendev,"backend-id" ,"%u" , xenbus->backend_id); -xen_device_frontend_set_state (xendev, XenbusStateInitialising); +xen_device_frontend_set_state (xendev, XenbusStateInitialising, true); xendev->exit.notify = xen_device_exit;qemu_add_exit_notifier (&xendev->exit);
Signature · 7 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Peter Maydell
AppliedQuoted 13 lines · Anthony PERARD
The following changes since commit
dac03af5d5482ec7ee9c23db467bb7230b33c0d9:Merge remote-tracking branch 'remotes/rth/tags/pull-axp-20190825' into staging (2019-08-27 10:00:51 +0100)
are available in the Git repository at:
https://xenbits.xen.org/git-http/people/aperard/qemu-dm.git tags/pull-xen-20190827
for you to fetch changes up to
705be570941b38cd1cbebc68f7f671ce7532ecb0:xen-bus: Avoid rewriting identical values to xenstore (2019-08-27 14:18:28 +0100)
Quoted 7 lines
----------------------------------------------------------------
Xen queue* Fixes for xen-bus and exit cleanup.
* Build fix.----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.
-- PMM
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel