All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	qemu-devel@nongnu.org, "Alexandre Ratchov" <alex@caoua.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Jan Kiszka" <jan.kiszka@web.de>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
	qemu-ppc@nongnu.org, "Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	qemu-arm@nongnu.org, "Alistair Francis" <alistair@alistair23.me>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Christian Schoenebeck" <qemu_oss@crudebyte.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Dr. David Alan Gilbert" <dave@treblig.org>
Subject: Re: [PATCH v3 19/35] audio: register and unregister vmstate with AudioState
Date: Thu, 30 Oct 2025 12:37:34 -0400	[thread overview]
Message-ID: <aQOUTmDMzvKePrIW@x1.local> (raw)
In-Reply-To: <adbf6cd9-72b0-4ce9-93a6-4f83338ca8a3@linaro.org>

On Wed, Oct 29, 2025 at 10:42:00PM +0100, Philippe Mathieu-Daudé wrote:
> On 29/10/25 20:00, Marc-André Lureau wrote:
> > Hi
> > 
> > On Wed, Oct 29, 2025 at 5:51 PM Philippe Mathieu-Daudé
> > <philmd@linaro.org> wrote:
> > > 
> > > On 27/10/25 16:10, marcandre.lureau@redhat.com wrote:
> > > > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > > 
> > > > Proper lifecycle management with QOM state.
> > > > 
> > > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > > ---
> > > >    audio/audio.c | 7 ++++++-
> > > >    1 file changed, 6 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/audio/audio.c b/audio/audio.c
> > > > index 4c3c3fd52f..853930bb48 100644
> > > > --- a/audio/audio.c
> > > > +++ b/audio/audio.c
> > > > @@ -1614,6 +1614,8 @@ static void audio_vm_change_state_handler (void *opaque, bool running,
> > > >        audio_reset_timer (s);
> > > >    }
> > > > 
> > > > +static const VMStateDescription vmstate_audio;
> > > > +
> > > >    static void audio_state_init(Object *obj)
> > > >    {
> > > >        AudioState *s = AUDIO_STATE(obj);
> > > > @@ -1625,6 +1627,8 @@ static void audio_state_init(Object *obj)
> > > > 
> > > >        s->vmse = qemu_add_vm_change_state_handler(audio_vm_change_state_handler, s);
> > > >        assert(s->vmse != NULL);
> > > > +
> > > > +    vmstate_register_any(NULL, &vmstate_audio, s);
> > > 
> > > Please avoid legacy APIs:
> > > 
> > > /**
> > >    * vmstate_register_any() - legacy function to register state
> > >    * serialisation description and let the function choose the id
> > >    *
> > >    * New code shouldn't be using this function as QOM-ified devices have
> > >    * dc->vmsd to store the serialisation description.
> > >    *
> > >    * Returns: 0 on success, -1 on failure
> > >    */
> > > 
> > 
> > qdev/Device have vmsd, but not plain Object (or legacy code without object).
> 
> Hmm right. Cc'ing Peter & Fabiano.

Thanks, yeah this looks fine when it was already there.

When looking at it, what's interesting is vmstate_audio is actually empty..

Explanation in da77adbaf61, since 2021.  Maybe we could drop it completely
at some point as I know we start to deprecate machines over 6(?)  years.
But I don't know when is proper.

We also hit similar issue with TAP device where there was a demand to add
compat properties to TAP however it was not a qdev, hence it cannot use
compat properties mechanism..  I wonder if these devices will be (at some
point) be converted to be type device.

-- 
Peter Xu



  parent reply	other threads:[~2025-10-30 16:39 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 15:10 [PATCH v3 00/35] Audio clean-ups marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 01/35] qdev: add qdev_find_default_bus() marcandre.lureau
2025-10-29 13:58   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 02/35] hw/audio: look up the default bus from the device class marcandre.lureau
2025-10-29 14:01   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 03/35] audio: rename audio_define->audio_add_audiodev() marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 04/35] hw/audio: use better naming for -audio model handling code marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 05/35] hw/audio/virtio-snd-pci: remove custom model callback marcandre.lureau
2025-10-29 21:44   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 06/35] hw/audio: simplify 'hda' audio init code marcandre.lureau
2025-10-29 21:46   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 07/35] hw/audio: generalize audio_model.init() marcandre.lureau
2025-10-29 21:47   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 08/35] hw/audio: drop audio_model.isa marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 09/35] audio: start making AudioState a QOM Object marcandre.lureau
2025-10-27 16:26   ` BALATON Zoltan
2025-10-28 12:34     ` Marc-André Lureau
2025-10-29 13:38       ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 10/35] audio: register backends in /audiodevs container marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 11/35] audio: use /audiodevs QOM container marcandre.lureau
2025-10-29 21:47   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 12/35] audio/paaudio: remove needless return value marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 13/35] audio/dsound: simplify init() marcandre.lureau
2025-10-29 13:42   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 14/35] audio/dsound: report init error via **errp marcandre.lureau
2025-10-29 13:43   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 15/35] audio: simplify audio_driver_init() marcandre.lureau
2025-10-29 21:50   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 16/35] audio: move period tick initialization marcandre.lureau
2025-10-29 13:44   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 17/35] audio: drop needless error message marcandre.lureau
2025-10-29 13:40   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 18/35] audio: keep vmstate handle with AudioState marcandre.lureau
2025-10-29 13:46   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 19/35] audio: register and unregister vmstate " marcandre.lureau
2025-10-29 13:48   ` Philippe Mathieu-Daudé
2025-10-29 19:00     ` Marc-André Lureau
2025-10-29 21:42       ` Philippe Mathieu-Daudé
2025-10-30 16:30         ` Philippe Mathieu-Daudé
2025-10-30 16:31         ` Philippe Mathieu-Daudé
2025-10-30 16:37         ` Peter Xu [this message]
2025-10-27 15:10 ` [PATCH v3 20/35] audio: initialize card_head during object init marcandre.lureau
2025-10-29 13:48   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 21/35] audio: remove some needless headers marcandre.lureau
2025-10-29 13:48   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 22/35] audio: remove AUDIO_HOST_ENDIANNESS marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 23/35] audio: introduce AUD_set_volume_{in,out}_lr() marcandre.lureau
2025-10-29 21:53   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 24/35] audio/replay: fix type punning marcandre.lureau
2025-10-29 21:51   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 25/35] audio: move internal APIs to audio_int.h marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 26/35] audio: rename AudioState -> AudioBackend marcandre.lureau
2025-10-29 13:49   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 27/35] audio: remove QEMUSoundCard marcandre.lureau
2025-10-30 16:43   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 28/35] audio/dbus: use a helper function to set the backend dbus server marcandre.lureau
2025-10-30 16:38   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 29/35] audio: move audio.h under include/qemu/ marcandre.lureau
2025-10-30 16:39   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 30/35] audio: remove dependency on spice header marcandre.lureau
2025-10-29 13:51   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 31/35] audio: cleanup, use bool for booleans marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 32/35] audio: move capture API to own header marcandre.lureau
2025-10-30 16:40   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 33/35] audio: drop needless audio_driver "descr" field marcandre.lureau
2025-10-29 13:51   ` Philippe Mathieu-Daudé
2025-10-27 15:10 ` [PATCH v3 34/35] audio: Remove pointless local variables marcandre.lureau
2025-10-27 15:10 ` [PATCH v3 35/35] audio: Rename @endianness argument as @big_endian for clarity marcandre.lureau
2025-10-30 13:43 ` [PATCH v3 00/35] Audio clean-ups Marc-André Lureau

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=aQOUTmDMzvKePrIW@x1.local \
    --to=peterx@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex@caoua.org \
    --cc=alistair@alistair23.me \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=dave@treblig.org \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=hpoussin@reactos.org \
    --cc=huth@tuxfamily.org \
    --cc=jan.kiszka@web.de \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=manos.pitsidianakis@linaro.org \
    --cc=marcandre.lureau@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu_oss@crudebyte.com \
    --cc=vr_qemu@t-online.de \
    --cc=wangyanan55@huawei.com \
    --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 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.