From: Zhao Liu <zhao1.liu@intel.com>
To: "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>,
"Igor Mammedov" <imammedo@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: 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: [RFC 00/10] qom: Support marking object properties as deprecated
Date: Wed, 3 Dec 2025 01:04:52 +0800 [thread overview]
Message-ID: <20251202170502.3228625-1-zhao1.liu@intel.com> (raw)
Hi,
This RFC is the follow-up work of v2.6 & v2.7 machines' removal [*], and
tries to introduce a general way to provide deprecation hint for
external user.
Its core idea is to detect external property settings (as well as
specific internal property settings, such as the compat property).
I think deprecated properties and internal-only properties are quite
similar, as both require consideration of external property usage. But
the former only triggers a warning, while the latter stops all external
access attempts.
For simplicity, this RFC series only considers deprecated properties.
Brief Introduction
==================
Now the common (but a bit fragmented) way to mark a property deprecated
is to add the warning in its accssors, or just document the deprecation
in docs/about/deprecated.rst without any hint when someone touches that
property.
Ideally, it's better to provide some hints to external user when he
tries to set the property via command line or HMP.
But this is pretty inconvenient (even impossible) 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.
I think the most complex part is identifying the paths for property
settings (both external command-line options and internal specific
configurations). This series currently covers the following scenarios
(which I consider to be particularly important):
External cases:
1) External global properties:
* -global command line option.
* -cpu command line features.
* suger properties from object_compat_props[2]
2) External ("TYPE_USER_CREATABLE") object:
* -object command line used for external ("TYPE_USER_CREATABLE")
object.
3) External device:
* -device command line - parsed based on keyval or json.
4) External machine options:
* -machine command line - parsed based on keyval.
5) External accelerator options:
* -accel command line.
6) HMP command:
* "qom-set" command.
Internal cases:
1) internal global properties:
* compat properties from object_compat_props[0,1].
2) Internal machine options:
* Builtin default machine options string:
MachineClass::default_machine_opts - parsed based on keyval, too.
In fact, there are still some special device command lines that haven't
been considered yet. But I believe the remaining cases can be gradually
expanded?
If this approach is feasible, it's possible to further introduce an
"internal" flag to prevent external access to compat property.
[*]: hw/i386/pc: Remove deprecated 2.6 and 2.7 PC machines
https://lore.kernel.org/qemu-devel/20251202162835.3227894-1-zhao1.liu@intel.com/
Thanks and Best Regards,
Zhao
---
Zhao Liu (10):
qom: Rename ObjectPropertyFlags to ObjectPropertyAccessorFlags
qom: Add basic object property deprecation hint support
qom: Check property deprecation flag for global property
qom: Check property deprecation flag for properities from qdict
system/vl: Check property deprecation flag for properities of
accelerator
qom/qom-hmp-cmd: Check property deprecation flag for "qom-set" command
hw/core/qdev-properties: Allow to mark qdev property as deprecated
target/i386: Deprecate fill-mtrr-mask property
target/i386: Deprecate cpuid-0xb property
hw/intc/ioapic: Deprecate version property
docs/about/deprecated.rst | 31 +++++++++
hw/core/qdev-properties.c | 24 +++----
hw/intc/ioapic.c | 3 +-
include/hw/qdev-properties.h | 18 ++++++
include/qom/object.h | 120 +++++++++++++++++++++++++++++++----
qom/object.c | 101 ++++++++++++++++++++++-------
qom/object_interfaces.c | 2 +-
qom/qom-hmp-cmds.c | 2 +-
system/vl.c | 2 +-
target/i386/cpu.c | 4 +-
10 files changed, 253 insertions(+), 54 deletions(-)
--
2.34.1
next reply other threads:[~2025-12-02 16:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 17:04 Zhao Liu [this message]
2025-12-02 17:04 ` [RFC 01/10] qom: Rename ObjectPropertyFlags to ObjectPropertyAccessorFlags Zhao Liu
2025-12-02 17:04 ` [RFC 02/10] qom: Add basic object property deprecation hint support Zhao Liu
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
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=20251202170502.3228625-1-zhao1.liu@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 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).