From: Hans de Goede <hdegoede@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Amit Shah" <amit.shah@redhat.com>,
"Alon Levy" <alevy@redhat.com>,
"Marc-André Lureau" <mlureau@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Hans de Goede" <hdegoede@redhat.com>
Subject: [Qemu-devel] [PATCH 7/8] spice-qemu-char: Register interface on post load
Date: Thu, 14 Mar 2013 17:36:56 +0100 [thread overview]
Message-ID: <1363279017-3894-8-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1363279017-3894-1-git-send-email-hdegoede@redhat.com>
From: Alon Levy <alevy@redhat.com>
The target has not seen the guest_connected event via
spice_chr_guest_open or spice_chr_write, and so spice server wrongly
assumes there is no agent active, while the client continues to send
motion events only by the agent channel, which the server ignores. The
net effect is that the mouse is static in the guest.
By registering the interface on post load spice server will pass on the
agent messages fixing the mouse behavior after migration.
RHBZ #725965
HdG: Port to new chardev code and test
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
spice-qemu-char.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 530d9a6..bdbe59e 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -2,6 +2,7 @@
#include "trace.h"
#include "ui/qemu-spice.h"
#include "char/char.h"
+#include "migration/vmstate.h"
#include <spice.h>
#include <spice-experimental.h>
#include <spice/protocol.h>
@@ -16,6 +17,8 @@ typedef struct SpiceCharDriver {
bool blocked;
const uint8_t *datapos;
int datalen;
+ uint32_t guest_open;
+ QEMUTimer *post_load_timer;
QLIST_ENTRY(SpiceCharDriver) next;
} SpiceCharDriver;
@@ -116,6 +119,8 @@ static SpiceCharDeviceInterface vmc_interface = {
static void vmc_register_interface(SpiceCharDriver *scd)
{
+ scd->guest_open = 1;
+
if (scd->active) {
return;
}
@@ -127,6 +132,8 @@ static void vmc_register_interface(SpiceCharDriver *scd)
static void vmc_unregister_interface(SpiceCharDriver *scd)
{
+ scd->guest_open = 0;
+
if (!scd->active) {
return;
}
@@ -211,6 +218,35 @@ static void spice_chr_guest_close(struct CharDriverState *chr)
vmc_unregister_interface(s);
}
+static void spice_chr_post_load_cb(void *opaque)
+{
+ SpiceCharDriver *s = opaque;
+
+ if (s->chr && s->guest_open)
+ spice_chr_guest_open(s->chr);
+}
+
+static int spice_chr_post_load(void *opaque, int version_id)
+{
+ SpiceCharDriver *s = opaque;
+
+ if (s->chr && s->guest_open)
+ qemu_mod_timer(s->post_load_timer, 1);
+
+ return 0;
+}
+
+static VMStateDescription spice_chr_vmstate = {
+ .name = "spice-chr",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .post_load = spice_chr_post_load,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(guest_open, SpiceCharDriver),
+ VMSTATE_END_OF_LIST()
+ },
+};
+
static void spice_chr_close(struct CharDriverState *chr)
{
SpiceCharDriver *s = chr->opaque;
@@ -218,6 +254,10 @@ static void spice_chr_close(struct CharDriverState *chr)
vmc_unregister_interface(s);
QLIST_REMOVE(s, next);
+ qemu_del_timer(s->post_load_timer);
+ qemu_free_timer(s->post_load_timer);
+ vmstate_unregister(NULL, &spice_chr_vmstate, s);
+
g_free((char *)s->sin.subtype);
#if SPICE_SERVER_VERSION >= 0x000c02
g_free((char *)s->sin.portname);
@@ -252,6 +292,8 @@ static CharDriverState *chr_open(const char *subtype)
s->chr = chr;
s->active = false;
s->sin.subtype = g_strdup(subtype);
+ s->post_load_timer = qemu_new_timer_ns(vm_clock,
+ spice_chr_post_load_cb, s);
chr->opaque = s;
chr->chr_write = spice_chr_write;
chr->chr_add_watch = spice_chr_add_watch;
@@ -259,6 +301,8 @@ static CharDriverState *chr_open(const char *subtype)
chr->chr_guest_open = spice_chr_guest_open;
chr->chr_guest_close = spice_chr_guest_close;
+ vmstate_register(NULL, -1, &spice_chr_vmstate, s);
+
QLIST_INSERT_HEAD(&spice_chars, s, next);
return chr;
--
1.8.1.4
next prev parent reply other threads:[~2013-03-14 16:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 16:36 [Qemu-devel] Spice / usb-redir chardev flowcontrol patches v2 Hans de Goede
2013-03-14 16:36 ` [Qemu-devel] [PATCH 1/8] virtio-console: Also throttle when less was written then requested Hans de Goede
2013-03-14 16:36 ` [Qemu-devel] [PATCH 2/8] virtio-console: Remove any pending watches on close Hans de Goede
2013-03-18 12:16 ` Amit Shah
2013-03-14 16:36 ` [Qemu-devel] [PATCH 3/8] spice-qemu-char: Remove #ifdef-ed code for old spice-server compat Hans de Goede
2013-03-14 16:36 ` [Qemu-devel] [PATCH 4/8] spice-qemu-char: Add watch support Hans de Goede
2013-03-14 16:36 ` [Qemu-devel] [PATCH 5/8] spice-qemu-char: Remove intermediate buffer Hans de Goede
2013-03-14 16:36 ` [Qemu-devel] [PATCH 6/8] spice-qemu-char: Move spice_chr_close down Hans de Goede
2013-03-14 16:36 ` Hans de Goede [this message]
2013-03-19 7:05 ` [Qemu-devel] [PATCH 7/8] spice-qemu-char: Register interface on post load Gerd Hoffmann
2013-03-19 9:15 ` Alon Levy
2013-03-19 9:28 ` Gerd Hoffmann
2013-03-14 16:36 ` [Qemu-devel] [PATCH 8/8] usb-redir: Add flow control support Hans de Goede
2013-03-19 12:40 ` Gerd Hoffmann
2013-03-19 13:54 ` Hans de Goede
2013-03-18 12:21 ` [Qemu-devel] Spice / usb-redir chardev flowcontrol patches v2 Amit Shah
2013-03-19 7:07 ` Gerd Hoffmann
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=1363279017-3894-8-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=alevy@redhat.com \
--cc=amit.shah@redhat.com \
--cc=kraxel@redhat.com \
--cc=mlureau@redhat.com \
--cc=qemu-devel@nongnu.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.