From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-rust@nondevel.org, qemu-devel <qemu-devel@nongnu.org>,
Zhao Liu <zhao1.liu@intel.com>
Subject: Re: Rust high-level pre/post migration callbacks
Date: Mon, 8 Sep 2025 13:02:11 +0300 [thread overview]
Message-ID: <CAAjaMXaPM0qrCwrMY_n531R4d5X3h+GjRHKzjHLeY3FprT5_TA@mail.gmail.com> (raw)
In-Reply-To: <8076a298-1cd9-4c90-a64c-f65004753975@redhat.com>
Hi Paolo,
I'm not familiar with how migration works under the hood, but this
data transformation design looks very clean and neat to me.
On Sat, Sep 6, 2025 at 9:45 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Hi,
>
> based on the low-level sketch in Zhao and my presentation,
> I would like to propose this more high-level implementation
> of pre/post migration callbacks.
>
> Instead of dealing with pre/post callbacks, devices implement a
> snapshot/restore mechanism; this way, C code sees a simplified
> picture and does not have to deal with Rust concepts such as
> Mutex<>.
>
> Using it is very easy, you can just declare your state like:
>
> regs: Migratable<Mutex<MyDeviceRegisters>>
>
Hm it's a shame we cannot do this with a trait since it requires state
storage for migration_state.
A suggestion: we could declare a "mirror" struct to hold
`migration_state` with a Derive macro. This is what the `rkyv` crate
does with its `Archive` derive macro and trait
<https://docs.rs/rkyv/latest/rkyv/trait.Archive.html>
next prev parent reply other threads:[~2025-09-08 10:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-06 6:45 Rust high-level pre/post migration callbacks Paolo Bonzini
2025-09-07 14:35 ` Paolo Bonzini
2025-09-08 10:02 ` Manos Pitsidianakis [this message]
2025-09-08 10:19 ` Paolo Bonzini
2025-09-08 10:25 ` Manos Pitsidianakis
2025-09-10 8:19 ` Zhao Liu
2025-09-10 11:33 ` Paolo Bonzini
2025-09-10 16:24 ` Zhao Liu
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=CAAjaMXaPM0qrCwrMY_n531R4d5X3h+GjRHKzjHLeY3FprT5_TA@mail.gmail.com \
--to=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nondevel.org \
--cc=zhao1.liu@intel.com \
/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).