qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: Chen Miao <chenmiao@openatom.club>
Subject: Re: [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of!
Date: Wed, 29 Oct 2025 07:34:46 +0100	[thread overview]
Message-ID: <05b5eff7-ad25-428e-8468-8b71878aad2c@linaro.org> (raw)
In-Reply-To: <20251028173430.2180057-19-pbonzini@redhat.com>

On 10/28/25 18:34, Paolo Bonzini wrote:
> The common superclass for devices could have its own migration state;
> for it to be included in the subclass's VMState, ParentField<> must
> implement the VMState trait.
> 
> Reported-by: Chen Miao <chenmiao@openatom.club>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   roms/opensbi                  | 2 +-
>   rust/migration/src/vmstate.rs | 3 ++-
>   rust/qom/src/qom.rs           | 3 ++-
>   3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/roms/opensbi b/roms/opensbi
> index a32a9106911..43cace6c367 160000
> --- a/roms/opensbi
> +++ b/roms/opensbi
> @@ -1 +1 @@
> -Subproject commit a32a91069119e7a5aa31e6bc51d5e00860be3d80
> +Subproject commit 43cace6c3671e5172d0df0a8963e552bb04b7b20

Spurious subproject change.


r~

> diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs
> index 42e5df8d818..5a237c409ac 100644
> --- a/rust/migration/src/vmstate.rs
> +++ b/rust/migration/src/vmstate.rs
> @@ -268,7 +268,7 @@ macro_rules! impl_vmstate_transparent {
>       ($type:ty where $base:tt: VMState $($where:tt)*) => {
>           unsafe impl<$base> $crate::vmstate::VMState for $type where $base: $crate::vmstate::VMState $($where)* {
>               const BASE: $crate::vmstate::VMStateField = $crate::vmstate::VMStateField {
> -                size: mem::size_of::<$type>(),
> +                size: ::core::mem::size_of::<$type>(),
>                   ..<$base as $crate::vmstate::VMState>::BASE
>               };
>               const VARRAY_FLAG: $crate::bindings::VMStateFlags = <$base as $crate::vmstate::VMState>::VARRAY_FLAG;
> @@ -282,6 +282,7 @@ unsafe impl<$base> $crate::vmstate::VMState for $type where $base: $crate::vmsta
>   impl_vmstate_transparent!(std::cell::UnsafeCell<T> where T: VMState);
>   impl_vmstate_transparent!(std::pin::Pin<T> where T: VMState);
>   impl_vmstate_transparent!(common::Opaque<T> where T: VMState);
> +impl_vmstate_transparent!(std::mem::ManuallyDrop<T> where T: VMState);
>   
>   #[macro_export]
>   macro_rules! impl_vmstate_bitsized {
> diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs
> index 5808051cd77..84455cea79b 100644
> --- a/rust/qom/src/qom.rs
> +++ b/rust/qom/src/qom.rs
> @@ -102,7 +102,7 @@
>   };
>   
>   use common::Opaque;
> -use migration::impl_vmstate_pointer;
> +use migration::{impl_vmstate_pointer, impl_vmstate_transparent};
>   
>   use crate::bindings::{
>       self, object_class_dynamic_cast, object_dynamic_cast, object_get_class, object_get_typename,
> @@ -182,6 +182,7 @@ fn as_ref(&self) -> &$parent {
>   #[derive(Debug)]
>   #[repr(transparent)]
>   pub struct ParentField<T: ObjectType>(std::mem::ManuallyDrop<T>);
> +impl_vmstate_transparent!(ParentField<T> where T: VMState + ObjectType);
>   
>   impl<T: ObjectType> Deref for ParentField<T> {
>       type Target = T;



      reply	other threads:[~2025-10-29  6:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 17:34 [PULL 00/18] Miscellaneous changes for 2025-10-28 Paolo Bonzini
2025-10-28 17:34 ` [PULL 01/18] scripts: clean up meson-buildoptions.py Paolo Bonzini
2025-10-28 17:34 ` [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs Paolo Bonzini
2025-10-29  7:01   ` Zhao Liu
2025-10-30  2:19     ` Xiaoyao Li
2025-10-30  7:36   ` Michael Tokarev
2025-10-30  7:49     ` Xiaoyao Li
2025-10-30  8:03       ` Michael Tokarev
2025-10-28 17:34 ` [PULL 03/18] rcu: Unify force quiescent state Paolo Bonzini
2025-11-03 13:59   ` Regression with the "replay" test on target alpha (was: [PULL 03/18] rcu: Unify force quiescent state) Thomas Huth
2025-11-04  1:45     ` Regression with the "replay" test on target alpha Akihiko Odaki
2025-11-04  7:41       ` Thomas Huth
2025-11-04  8:08         ` Akihiko Odaki
2025-11-04  8:38           ` Thomas Huth
2025-11-04 12:18             ` Paolo Bonzini
2025-11-05  6:29               ` Akihiko Odaki
2025-11-07  7:41                 ` Thomas Huth
2025-11-07  7:49                   ` Paolo Bonzini
2025-10-28 17:34 ` [PULL 04/18] rust: remove useless glib_sys bindings Paolo Bonzini
2025-10-28 17:34 ` [PULL 05/18] rust: only leave leaf crates as workspace members Paolo Bonzini
2025-10-28 17:34 ` [PULL 06/18] qobject: make refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 07/18] char: rename CharBackend->CharFrontend Paolo Bonzini
2025-10-28 17:34 ` [PULL 08/18] accel/mshv: initialize thread name Paolo Bonzini
2025-10-28 17:34 ` [PULL 09/18] accel/mshv: use return value of handle_pio_str_read Paolo Bonzini
2025-10-28 17:34 ` [PULL 10/18] esp.c: fix esp_cdb_ready() FIFO wraparound limit calculation Paolo Bonzini
2025-10-29 11:42   ` Michael Tokarev
2025-10-28 17:34 ` [PULL 11/18] qtest/am53c974-test: add additional test for cmdfifo overflow Paolo Bonzini
2025-10-28 17:34 ` [PULL 12/18] rust/qemu-macros: Convert bit value to u8 within #[property] Paolo Bonzini
2025-10-28 17:34 ` [PULL 13/18] scsi: make SCSIRequest refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 14/18] qdev: Change PropertyInfo method print() to return malloc'ed string Paolo Bonzini
2025-10-28 17:34 ` [PULL 15/18] hw/i386/isapc.c: warn rather than reject modern x86 CPU models Paolo Bonzini
2025-10-28 17:34 ` [PULL 16/18] docs/about/deprecated.rst: document isapc deprecation for " Paolo Bonzini
2025-10-28 17:34 ` [PULL 17/18] target/i386: clear CPU_INTERRUPT_SIPI for all accelerators Paolo Bonzini
2025-10-28 17:34 ` [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of! Paolo Bonzini
2025-10-29  6:34   ` Richard Henderson [this message]

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=05b5eff7-ad25-428e-8468-8b71878aad2c@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=chenmiao@openatom.club \
    --cc=pbonzini@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).