All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
	devel@lists.libvirt.org, "Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [RFC 02/10] qom: Add basic object property deprecation hint support
Date: Mon, 5 Jan 2026 17:06:31 +0800	[thread overview]
Message-ID: <aVt/F6qjR+UMfXrO@intel.com> (raw)
In-Reply-To: <20260102130601.0697deeb@imammedo-mac>

On Fri, Jan 02, 2026 at 01:06:01PM +0100, Igor Mammedov wrote:
> Date: Fri, 2 Jan 2026 13:06:01 +0100
> From: Igor Mammedov <imammedo@redhat.com>
> Subject: Re: [RFC 02/10] qom: Add basic object property deprecation hint
>  support
> X-Mailer: Claws Mail 3.11.1-67-g0d58c6-dirty (GTK+ 2.24.21;
>  x86_64-apple-darwin14.0.0)
> 
> On Wed,  3 Dec 2025 01:04:54 +0800
> Zhao Liu <zhao1.liu@intel.com> wrote:
> 
> > Now the common (but a bit fragmented) way to mark a property deprecated
> > is to add the warning in its accssors.
> > 
> > But this is pretty inconvenient for such qdev properties, which are
> > defined via DEFINE_PROP_* macros in the Property array. For qdev
> > properties, their accessors are provided by pre-defined PropertyInfo, so
> > that it's possible to modify PropertyInfo for a single "deprecated"
> > property.
> > 
> > Then it's necessary to introduce property flags to mark some properties
> > as deprecated, and to check the property flags when set the property,
> > thereby to print a deprecation warning.
> > 
> > This not only benefits traditional qdev properties but also helps the
> > deprecation of generic objects.
> > 
> > Note, internal attempt (except the compat case) should not trigger the
> > deprecation warning but external user should see the deprecation
> > information. Whether to perform deprecation checks based on property
> > flags is controlled by the newly added "check" argument in
> > object_property_try_add_full().
> 
> I'd split deprecation warning out for this patch,
> i.e. make this one "add per object instance flags",
> and take care of deprecation stuff on top,

Yeah, will do.

> Also, API likely would need set/get/clear calls to operate on object flags.

I see, for dynamic flags ("user set" - you mentioned), these APIs are
necessary. Will add something like object_property_[set|get|clear]_flags.

> > In subsequent work, the "check" option will be enabled for specific
> > external property setting paths.
> > 
> > Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> > ---
> >  include/qom/object.h | 72 ++++++++++++++++++++++++++++++++++++++++++++
> >  qom/object.c         | 72 +++++++++++++++++++++++++++++++++++---------
> >  2 files changed, 130 insertions(+), 14 deletions(-)
> > 
> > diff --git a/include/qom/object.h b/include/qom/object.h
> > index 3f807a03f5aa..8f4c2f44d835 100644
> > --- a/include/qom/object.h
> > +++ b/include/qom/object.h
> > @@ -86,6 +86,12 @@ typedef void (ObjectPropertyRelease)(Object *obj,
> >   */
> >  typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop);
> >  
> > +typedef enum ObjectPropertyFlags {
> > +    OBJECT_PROPERTY_NO_FLAGS     =                             0,
> > +    OBJECT_PROPERTY_DEPRECATED   =                        1 << 0,
> 
> maybe use BIT() instead of manual shift?

Sure, will do.

> addidtionally given you are going to distinguish external vs internal,
> perhaps add flags 'default' and 'user set',
> I think the both could be used to cleanup cpu flags handling where we rely on
> setting/checking  magic numbers to figure out where value comes from.

Good idea.

I think a "user set" flag is enough. Considerring a property may be set
multiple timers. In object_property_set_full(), we could add the "user
set" flag for external setting and clear that flag for internal setting,
then property's set accessor could know whether the value is from user
or not.

> > +    OBJECT_PROPERTY_FULL_FLAGS   =    OBJECT_PROPERTY_DEPRECATED,
> > +} ObjectPropertyFlags;
> > +
> >  struct ObjectProperty
> >  {
> >      char *name;
> > @@ -98,6 +104,7 @@ struct ObjectProperty
> >      ObjectPropertyInit *init;
> >      void *opaque;
> >      QObject *defval;
> > +    uint8_t flags;
> >  };
> >  
> >  /**
> > @@ -1090,6 +1097,41 @@ ObjectProperty *object_property_try_add(Object *obj, const char *name,
> >                                          ObjectPropertyRelease *release,
> >                                          void *opaque, Error **errp);
> >  
> > +/**
> > + * object_property_try_add_full:
> 
> what's the reason for adding _full flavour over just modifying existing API?

I was previously concerned about making too many changes to other parts,
but after re-checking, directly extending the current object_property_try_add()
is better — there's not too many changes. Thanks for the reminder.

Regards,
Zhao



  reply	other threads:[~2026-01-05  8:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 17:04 [RFC 00/10] qom: Support marking object properties as deprecated Zhao Liu
2025-12-02 17:04 ` [RFC 01/10] qom: Rename ObjectPropertyFlags to ObjectPropertyAccessorFlags Zhao Liu
2026-01-02 12:12   ` Igor Mammedov
2026-01-05  7:54     ` Zhao Liu
2026-01-05 12:28       ` Igor Mammedov
2026-01-06  2:14         ` Zhao Liu
2025-12-02 17:04 ` [RFC 02/10] qom: Add basic object property deprecation hint support Zhao Liu
2026-01-02 12:06   ` Igor Mammedov
2026-01-05  9:06     ` Zhao Liu [this message]
2025-12-02 17:04 ` [RFC 03/10] qom: Check property deprecation flag for global property Zhao Liu
2025-12-02 17:04 ` [RFC 04/10] qom: Check property deprecation flag for properities from qdict Zhao Liu
2025-12-02 17:04 ` [RFC 05/10] system/vl: Check property deprecation flag for properities of accelerator Zhao Liu
2025-12-02 17:04 ` [RFC 06/10] qom/qom-hmp-cmd: Check property deprecation flag for "qom-set" command Zhao Liu
2025-12-02 17:04 ` [RFC 07/10] hw/core/qdev-properties: Allow to mark qdev property as deprecated Zhao Liu
2026-01-02 12:27   ` Igor Mammedov
2026-01-05  8:34     ` Zhao Liu
2025-12-02 17:05 ` [RFC 08/10] target/i386: Deprecate fill-mtrr-mask property Zhao Liu
2025-12-02 17:05 ` [RFC 09/10] target/i386: Deprecate cpuid-0xb property Zhao Liu
2025-12-02 17:05 ` [RFC 10/10] hw/intc/ioapic: Deprecate version property Zhao Liu

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=aVt/F6qjR+UMfXrO@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=berrange@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=eduardo@habkost.net \
    --cc=imammedo@redhat.com \
    --cc=mark.caveayland@nutanix.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.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.