On Mon, Aug 04, 2025 at 12:08:15PM +0200, Paolo Bonzini wrote:
Il lun 4 ago 2025, 10:56 Martin Kletzander <mklet...@redhat.com> ha scritto:*BUT* of course I had to rebase the patches on top of current rust-next on Friday and there were some of your commits from Thursday which I now see actually fix all what I tried fixing before as well. I tried finding the previous commit on which I saw all the issues and after some rebuilding I could not. So it is now not even broken on rust-next. This way I completely wasted your time, but at least learned something that's happening in the code. Sorry for that.Uh no you didn't. It was broken.
But it is not now, neither master, nor rust-next, nor anything I tried from the reflog, which makes me suspicious about what I was developing this on. I distinctly remember the `$vmsd.get()` call in the macro which I presume was causing the copying due to VMStateDescription automatically implementing the Copy trait due to the bindgen invocation. But that's nowhere to be found, including git log --walk-reflog and manually searching various history trees. And I doubted that you rewrote the history of the rust-next branch. Neither do I remember changing the macro until I found out that other in code changes did not help to fix it. After some time I now managed to find it. It was the previous version of a commit 4cb0670e12c4, and that is nowhere to be found in rust-next at the moment, I guess fixes were incorporated while rebasing the branch on current master. That was a wild ride, but I'm glad it all works (apart from the bash version indentation) on rust-next. I'll try to read up on what's next to help with, if anything. Have a nice day, Martin
Paolo Martin>Paolo > > rust/qemu-api/src/vmstate.rs | 11 +++++++++++ >> rust/qemu-api/tests/vmstate_tests.rs | 1 + >> 2 files changed, 12 insertions(+) >> >> diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/ vmstate.rs >> index b5c6b764fbba..716e52afe740 100644 >> --- a/rust/qemu-api/src/vmstate.rs >> +++ b/rust/qemu-api/src/vmstate.rs >> @@ -449,6 +449,17 @@ macro_rules! vmstate_validate { >> /// description of the struct. >> #[macro_export] >> macro_rules! impl_vmstate_struct { >> + ($type:ty, $(&)?$vmsd:ident) => { >> + unsafe impl $crate::vmstate::VMState for $type { >> + const BASE: $crate::bindings::VMStateField = >> + $crate::bindings::VMStateField { >> + vmsd: $vmsd.as_ref(), >> + size: ::core::mem::size_of::<$type>(), >> + flags: $crate::bindings::VMStateFlags::VMS_STRUCT, >> + ..$crate::zeroable::Zeroable::ZERO >> + }; >> + } >> + }; >> ($type:ty, $vmsd:expr) => { >> unsafe impl $crate::vmstate::VMState for $type { >> const BASE: $crate::bindings::VMStateField = { >> diff --git a/rust/qemu-api/tests/vmstate_tests.rs b/rust/qemu-api/tests/ >> vmstate_tests.rs >> index 2c0670ba0eed..7d3180e6c2ea 100644 >> --- a/rust/qemu-api/tests/vmstate_tests.rs >> +++ b/rust/qemu-api/tests/vmstate_tests.rs >> @@ -320,6 +320,7 @@ fn test_vmstate_struct_varray_uint8_wrapper() { >> b"arr_a_wrap\0" >> ); >> assert_eq!(foo_fields[5].num_offset, 228); >> + assert_eq!(foo_fields[5].vmsd, VMSTATE_FOOA.as_ref()); >> assert!(unsafe { foo_fields[5].field_exists.unwrap()(foo_b_p, 0) }); >> >> // The last VMStateField in VMSTATE_FOOB. >> -- >> 2.50.1 >> >>
signature.asc
Description: PGP signature