qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: yong.huang@smartx.com
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Hyman Huang" <yong.huang@smartx.com>,
	dengpc12@chinatelecom.cn
Subject: [RFC 0/3] Support live migration for qemu-vdagent chardev
Date: Fri, 21 Mar 2025 11:38:10 +0800	[thread overview]
Message-ID: <cover.1742527956.git.yong.huang@smartx.com> (raw)

From: Hyman Huang <yong.huang@smartx.com>

Our goal is to migrate VMs that are configured with qemu-vdagent-typed
chardev while allowing the agent to continue working without having
to restart the service in guest.

Let's justify which fields should be taken into account for struct
VDAgentChardev.

struct VDAgentChardev {
    Chardev parent;

    /* config */
    bool mouse;
    bool clipboard;

    /* guest vdagent */
    uint32_t caps;
    VDIChunkHeader chunk;
    uint32_t chunksize;
    uint8_t *msgbuf;
    uint32_t msgsize;
    uint8_t *xbuf;
    uint32_t xoff, xsize;
    Buffer outbuf;

    /* mouse */
    DeviceState mouse_dev;
    uint32_t mouse_x;
    uint32_t mouse_y;
    uint32_t mouse_btn;
    uint32_t mouse_display;
    QemuInputHandlerState *mouse_hs;

    /* clipboard */
    QemuClipboardPeer cbpeer;
    uint32_t last_serial[QEMU_CLIPBOARD_SELECTION__COUNT];
    uint32_t cbpending[QEMU_CLIPBOARD_SELECTION__COUNT];
};

parent:
No dynamic information is generated. skip migrating.

mouse, clipboard:
The mouse and clipboard should be set up identically on both sides.
Skip migrating.

caps:
Store the negotiated caps between the client and the guest.
Should migrate.

chunk, ... outbuf:
The spice agent protocol's message transportation between the client
and the guest is implemented using all of these fields, however the
message loss can be tolerated by guests because the issue may occur
in the real world as well.
Could skip migrating.

mouse_dev, ... mouse_hs:
The mouse state can be reset after a live migration since the agent
working inside the guest does not heavily depend on them.
Could skip migrating

cbpeer:
Since the cbpeer would lose the data it references to if the qemu
clipboard data was not migrated, this field can also be initialized
after live migration.
Could skip migrating

last_serial, cbpending:
It is necessary for the agent to function after live migration.
Should migrate.

For the last_serial, saving & loading its value to make ensure the
client receives the most recent clipboard data from the guest after
live migration.

For the cbpending, saving & loading its value aims to inform the
guest that the clipboard has been released and is now empty in
case that the guest acts strangely while supposing that the
requested data can be properly retrieved.

To summarize, all we need to do is migrate the caps, last_serial
and cbpendings fields of the struct VDAgentChardev,

Please review, thanks

Yong

Hyman Huang (3):
  vdagent: Wrap vdagent_register_to_qemu_clipboard function
  vdagent: Set up mouse and clipboard after live migration
  vdagent: Drop blocker to support migration

 ui/trace-events |   1 +
 ui/vdagent.c    | 102 +++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 85 insertions(+), 18 deletions(-)

-- 
2.27.0



             reply	other threads:[~2025-03-21  3:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21  3:38 yong.huang [this message]
2025-03-21  3:38 ` [RFC 1/3] vdagent: Wrap vdagent_register_to_qemu_clipboard function yong.huang
2025-03-21  3:38 ` [RFC 2/3] vdagent: Set up mouse and clipboard after live migration yong.huang
2025-03-21  3:38 ` [RFC 3/3] vdagent: Drop blocker to support migration yong.huang
2025-03-21  6:41 ` [RFC 0/3] Support live migration for qemu-vdagent chardev Marc-André Lureau
2025-03-21  7:29   ` Yong Huang

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=cover.1742527956.git.yong.huang@smartx.com \
    --to=yong.huang@smartx.com \
    --cc=dengpc12@chinatelecom.cn \
    --cc=marcandre.lureau@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 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).