]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/xen: fix XenStore watch delivery to guest
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 17 Oct 2023 12:34:18 +0000 (13:34 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Mon, 6 Nov 2023 10:03:45 +0000 (10:03 +0000)
commit4a5780f52095f1daf23618dc6198a2a1665ea505
treef5b0ecccaa56144731ab0ad2d0bfca73920c3ddc
parent3de75ed352411899dbc9222e82fe164890c77e78
hw/xen: fix XenStore watch delivery to guest

When fire_watch_cb() found the response buffer empty, it would call
deliver_watch() to generate the XS_WATCH_EVENT message in the response
buffer and send an event channel notification to the guest… without
actually *copying* the response buffer into the ring. So there was
nothing for the guest to see. The pending response didn't actually get
processed into the ring until the guest next triggered some activity
from its side.

Add the missing call to put_rsp().

It might have been slightly nicer to call xen_xenstore_event() here,
which would *almost* have worked. Except for the fact that it calls
xen_be_evtchn_pending() to check that it really does have an event
pending (and clear the eventfd for next time). And under Xen it's
defined that setting that fd to O_NONBLOCK isn't guaranteed to work,
so the emu implementation follows suit.

This fixes Xen device hot-unplug.

Cc: qemu-stable@nongnu.org
Fixes: 0254c4d19df ("hw/xen: Add xenstore wire implementation and implementation stubs")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
hw/i386/kvm/xen_xenstore.c