All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] hpet: do not overwrite properties on post_load
Date: Mon, 17 Feb 2025 16:44:15 +0800	[thread overview]
Message-ID: <Z7L2338isu0OBprC@intel.com> (raw)
In-Reply-To: <CABgObfanbj8bxibKOVfk3erKMx8o6_ar-X7OqEKhxnde3iyCNA@mail.gmail.com>

On Mon, Feb 17, 2025 at 09:02:24AM +0100, Paolo Bonzini wrote:
> Date: Mon, 17 Feb 2025 09:02:24 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: Re: [PATCH v2] hpet: do not overwrite properties on post_load
> 
> Il lun 17 feb 2025, 07:35 Zhao Liu <zhao1.liu@intel.com> ha scritto:
> 
> > > @@ -347,14 +330,13 @@ static const VMStateDescription vmstate_hpet = {
> > >      .version_id = 2,
> > >      .minimum_version_id = 1,
> > >      .pre_save = hpet_pre_save,
> > > -    .pre_load = hpet_pre_load,
> > >      .post_load = hpet_post_load,
> > >      .fields = (const VMStateField[]) {
> > >          VMSTATE_UINT64(config, HPETState),
> > >          VMSTATE_UINT64(isr, HPETState),
> > >          VMSTATE_UINT64(hpet_counter, HPETState),
> > > -        VMSTATE_UINT8_V(num_timers, HPETState, 2),
> > > -        VMSTATE_VALIDATE("num_timers in range",
> > hpet_validate_num_timers),
> > > +        VMSTATE_UINT8_V(num_timers_save, HPETState, 2),
> >
> > This change is safe since it doesn't change the vmstate layout so that
> > there's no need for bumping up the version.
> >
> > But I still have the question as the comment in v1 [*]. User doesn't
> > have any way to modify the number of timers, why not just replace this
> > vmstate field with "VMSTATE_UNUSED_V(2, 1)"?
> >
> 
> Because I didn't want to bump the version; your suggestion is indeed
> simpler but it would break migration to past versions of QEMU, which check
> that num_timers is in range. VMSTATE_UNUSED would write a zero.

Yes, this way needs to tweak num_timers in post_load.

> For Rust, I think it's easier to place the check in the post_load callback
> BTW.

Yes, I agree. Will honor this change on Rust side.

Well, pls let me add my r/b tag as well,

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>



      reply	other threads:[~2025-02-17  8:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-16  9:28 [PATCH v2] hpet: do not overwrite properties on post_load Paolo Bonzini
2025-02-17  6:55 ` Zhao Liu
2025-02-17  8:02   ` Paolo Bonzini
2025-02-17  8:44     ` Zhao Liu [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=Z7L2338isu0OBprC@intel.com \
    --to=zhao1.liu@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.