qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Martin Kletzander <mkletzan@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
	qemu-rust@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Subject: Re: [PATCH 1/2] rust: Add antoher variant for impl_vmstate_struct! macro
Date: Mon, 4 Aug 2025 14:04:22 +0200	[thread overview]
Message-ID: <aJChxtjDENrCEk3x@wheatley.k8r.cz> (raw)
In-Reply-To: <CABgObfaivWp1v55KHjBK1Ba8fDgo3Lr+wF5HkHrvOz62Z_gLoQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3782 bytes --]

On Mon, Aug 04, 2025 at 12:08:15PM +0200, Paolo Bonzini wrote:
>Il lun 4 ago 2025, 10:56 Martin Kletzander <mkletzan@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
>> >>
>> >>
>>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-08-04 12:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 14:59 [PATCH 0/2] Few fixes I found when building QEMU with Rust Martin Kletzander
2025-08-01 14:59 ` [PATCH 1/2] rust: Add antoher variant for impl_vmstate_struct! macro Martin Kletzander
2025-08-01 21:44   ` Paolo Bonzini
2025-08-04  8:56     ` Martin Kletzander
2025-08-04 10:08       ` Paolo Bonzini
2025-08-04 12:04         ` Martin Kletzander [this message]
2025-08-04 13:06           ` Paolo Bonzini
2025-08-01 14:59 ` [PATCH 2/2] tests/qemu-iotests: Indent expected error messages Martin Kletzander
2025-08-01 15:48   ` Daniel P. Berrangé
2025-08-01 19:09     ` Fabiano Rosas
2025-08-04  8:20       ` Martin Kletzander
2025-08-04 11:33       ` Kevin Wolf
2025-08-06  6:54         ` Dr. Werner Fink
2025-08-11  9:05           ` Martin Kletzander
2025-08-12 15:35             ` Kevin Wolf

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=aJChxtjDENrCEk3x@wheatley.k8r.cz \
    --to=mkletzan@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-rust@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).