From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Zhao Liu <zhao1.liu@intel.com>
Cc: "Paolo Bonzini" <pbonzini@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>,
"Richard Henderson" <richard.henderson@linaro.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>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Zide Chen" <zide.chen@intel.com>,
"Dapeng Mi" <dapeng1.mi@linux.intel.com>,
qemu-devel@nongnu.org, devel@lists.libvirt.org
Subject: Re: [PATCH v2 00/21] qom: introduce property flags to track external user input
Date: Tue, 10 Feb 2026 15:41:22 +0000 [thread overview]
Message-ID: <aYtRooiYCc8LzUUJ@redhat.com> (raw)
In-Reply-To: <aYtOh9guoiQocdjk@intel.com>
On Tue, Feb 10, 2026 at 11:28:07PM +0800, Zhao Liu wrote:
> Hi Daniel,
>
> On Tue, Feb 10, 2026 at 10:12:38AM +0000, Daniel P. Berrangé wrote:
> > Date: Tue, 10 Feb 2026 10:12:38 +0000
> > From: "Daniel P. Berrangé" <berrange@redhat.com>
> > Subject: Re: [PATCH v2 00/21] qom: introduce property flags to track
> > external user input
> >
> > On Tue, Feb 10, 2026 at 11:23:27AM +0800, Zhao Liu wrote:
> > > Hi,
> > >
> > > This is the v2 trying to introduce property flags to detect user's
> > > property setting (from CLI/QMP/HMP). I dropped RFC tag since previous
> > > RFC v1 [1].
> >
> > This says what the series is proposing, but IMHO what is more important
> > here is explaining why this either desirable or appropriate to add as
> > general facility in QOM.
>
> Yes, sorry this cover letter I wrote is overly simplified.
>
> This series tries to control the property access against external user.
> USER_SET is the base to track external user's behavior, and DEPRECATED &
> INTERNAL flags provide different levels of access control.
>
> Though the DEPRECATED flag does not inherently restrict access, I think
> such a warning also serves as a form of control.
>
> The idea of restricting external access to properties is from previous
> discussions [*] about internal properties.
>
> [*]: How to mark internal properties:
> https://lore.kernel.org/qemu-devel/2f526570-7ab0-479c-967c-b3f95f9f19e3@redhat.com/
>
> Since that disscussion, currently all properties expected to be
> "internal" have an “x-” prefix — while this approach can work, it clearly
> confuses the original meaning of “x-”, which actually means "unstable".
>
> Therefore, I think the optimal approach is to provide the capability to
> restrict external access to the property — that is, to implement the
> "true" internal property.
>
> Based on this, it seems impossible to implement an internal property
> without tracking user input in the QOM?
So the main thing that pushes us into using QOM for internal properties
is the machine type compatibility code. eg where we bulk set stuff using
compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
That logic is all QOM based. Using QOM isn't our exclusive approach, as
we have machine types sometimes setting object fields directly. eg
static void pc_i440fx_machine_7_0_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
pc_i440fx_machine_7_1_options(m);
pcmc->enforce_amd_1tb_hole = false;
compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
}
but that only works for properties against the machine type, not compat
properties against devices, since we have no direct access to the other
classes/instances.
If we want to be able to control hardware compat, without exposing
something as a user facing tunable, then internal-only QOM props seems
inescapable.
I do still wonder if we genuinely need internal-only QOM props for
machine type compat ?
Whether using a public 'x-' prefixed property or an internal only
property, we're constrained by the need to retain the behaviour
semantics for as long as the machine type exists. I don't see an
internal only property giving us significantly more freedom here.
We can already rename a 'x-' property however we want with no
notice, as long as the machine type doesn't change behaviour.
> > The idea that code should take different action for a given fixed value,
> > based on whether the value was set by the user, or left on the default,
> > makes me very uncomfortable.
> >
> > There have been a number of situations where something that was initially
> > a boolean flag, actually needed to be a tri-state instead, to provide
> > semantics like "On", "Off", "Auto".
> >
> > This "user set" flag could support such behaviour indirectly, but since
> > "user set" is an internal concept we'd still be only exposing a boolean
> > externally, while using a tri-state internally. That does not give the
> > full flexibility of a tri-state, because internally if we wanted to
> > have the default to be "yes", it offers no way for the mgmt app to
> > put it back to "auto".
> >
> > For properties that are not booleans, it is much less obvious to me
> > whether we actually need a distinct "not set" concept at all.
>
> USER_SET primarily serves the INTERNAL and DEPRECATED flags. However,
> its another function is to indicates whether the external user has
> touched the property.
>
> But, Hmm, I think "auto" and USER_SET don't have conflict?
>
> IIUC, "auto" means the user requests that QEMU make the decision itself.
> However, just like my patch 19 cleanup of “lbr-fmt”, that property
> explicitly requires users to provide a valid value. Even we have "auto"
> for uint64, "auto" can't address this case.
I just meant "auto" as one possible "default" behaviour where a traditional
boolean was in use, not for all possible types. The right answer for a
default is contextually dependent.
For a uint64, a default value would involve some sentinal value, or it
could involve a pair of related properties. For example, we have
host-phys-bits=on
phys-bits=NNN
as a pair that work together, so you don't need a magic phys-bits value
to represent "use host value".
> Similarly, the x86 CPU's topology IDs (used for hotplug) - "thread-id"/
> "core-id"/"module-id"..., also require the user to set valid and accurate
> values; they cannot be replaced with "auto".
Again I wasn't suggestnig an "auto" value for every scenario, that was
just an example in a "bool" context. An ID value of "0" is a traditional
default for numeric values, which is fine assuming you don't need to
dinstinguish 0 as a valid value, from 0 as an invalid value needing user
input.
> I also think the ideal situation is not to distinguish between external
> and internal - however, exposing properties to external users makes code
> evolution painful...
I don't think it does. Code evolution is painful as long as the machine
type using the prop needs to exist with fixed semantics, whether it is
internal or public with x- prefix.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2026-02-10 15:41 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 3:23 [PATCH v2 00/21] qom: introduce property flags to track external user input Zhao Liu
2026-02-10 3:23 ` [PATCH v2 01/21] qom/object: use BIT macro for ObjectPropertyFlags Zhao Liu
2026-03-20 9:53 ` Thomas Huth
2026-02-10 3:23 ` [PATCH v2 02/21] qom/object: cache ObjectPropertyFlags in ObjectProperty Zhao Liu
2026-03-20 9:53 ` Thomas Huth
2026-02-10 3:23 ` [PATCH v2 03/21] qom/object: factor out object_class_property_try_add() Zhao Liu
2026-02-10 14:41 ` BALATON Zoltan
2026-02-11 7:14 ` Zhao Liu
2026-02-10 3:23 ` [PATCH v2 04/21] qom/object: add flags argument in object_{class_}property_try_add() Zhao Liu
2026-02-10 3:23 ` [PATCH v2 05/21] qom/object: rename object_{class_}property_try_add() to object_{class_}property_add_full() Zhao Liu
2026-02-10 3:23 ` [PATCH v2 06/21] qom/object: add helpers to set/get/clear property flags Zhao Liu
2026-02-10 3:23 ` [PATCH v2 07/21] qom/object: introduce user interaction flags for properties Zhao Liu
2026-02-10 9:49 ` Daniel P. Berrangé
2026-02-10 9:58 ` Daniel P. Berrangé
2026-02-11 8:19 ` Zhao Liu
2026-02-10 14:44 ` BALATON Zoltan
2026-02-11 7:22 ` Zhao Liu
2026-02-10 3:23 ` [PATCH v2 08/21] qom/object: add from_user argument in object_property_parse() Zhao Liu
2026-02-10 3:23 ` [PATCH v2 09/21] qom/object: mark global property set from CLI as USER_SET Zhao Liu
2026-02-10 3:23 ` [PATCH v2 10/21] qom/qom-hmp-cmd: mark properties set from HMP (non-JSON) "qom-set" " Zhao Liu
2026-02-10 3:23 ` [PATCH v2 11/21] qom/qom-qmp-cmd: mark properties set from QMP/HMP (JSON) " Zhao Liu
2026-02-10 3:23 ` [PATCH v2 12/21] qom/object_interfaces: mark properties set from qdict & keyval " Zhao Liu
2026-02-10 3:23 ` [PATCH v2 13/21] system/vl: mark property set in object_parse_property_opt() " Zhao Liu
2026-02-10 3:23 ` [PATCH v2 14/21] hw/core/qdev-properties: allow qdev properties accept flags Zhao Liu
2026-02-10 9:41 ` Peter Krempa
2026-02-11 7:10 ` Zhao Liu
2026-02-10 9:56 ` Daniel P. Berrangé
2026-02-11 7:30 ` Zhao Liu
2026-02-11 16:58 ` Daniel P. Berrangé
2026-02-12 15:25 ` Zhao Liu
2026-02-12 15:42 ` Daniel P. Berrangé
2026-03-09 13:34 ` Zhao Liu
2026-02-18 9:51 ` Igor Mammedov
2026-03-06 9:14 ` Markus Armbruster
2026-03-06 9:19 ` Daniel P. Berrangé
2026-03-06 9:30 ` Markus Armbruster
2026-03-09 13:52 ` Zhao Liu
2026-02-10 3:23 ` [PATCH v2 15/21] target/i386: deprecate fill-mtrr-mask property Zhao Liu
2026-02-10 3:23 ` [PATCH v2 16/21] target/i386: deprecate cpuid-0xb property Zhao Liu
2026-02-10 3:23 ` [PATCH v2 17/21] hw/intc/ioapic: deprecate version property Zhao Liu
2026-02-10 3:23 ` [PATCH v2 18/21] target/i386: mark x-consistent-cache property as internal-only Zhao Liu
2026-02-10 3:23 ` [PATCH v2 19/21] target/i386: remove redundant validation for lbr-fmt property Zhao Liu
2026-03-13 22:34 ` Chen, Zide
2026-02-10 3:23 ` [PATCH v2 20/21] target/i386: detect user provided lbr-fmt via property flag Zhao Liu
2026-03-13 22:36 ` Chen, Zide
2026-02-10 3:23 ` [PATCH v2 21/21] hw/core/qdev-properties: support valid default value for DEFINE_PROP_UINT64_CHECKMASK Zhao Liu
2026-03-13 22:36 ` Chen, Zide
2026-02-10 10:12 ` [PATCH v2 00/21] qom: introduce property flags to track external user input Daniel P. Berrangé
2026-02-10 10:44 ` Michael S. Tsirkin
2026-02-10 11:00 ` Daniel P. Berrangé
2026-02-10 15:00 ` BALATON Zoltan
2026-02-10 15:28 ` Zhao Liu
2026-02-10 15:16 ` BALATON Zoltan
2026-02-11 7:24 ` Zhao Liu
2026-02-11 11:28 ` BALATON Zoltan
2026-02-12 15:31 ` Zhao Liu
2026-02-12 15:56 ` BALATON Zoltan
2026-02-10 15:41 ` Daniel P. Berrangé [this message]
2026-02-11 7:06 ` Zhao Liu
2026-02-11 11:18 ` Daniel P. Berrangé
2026-03-11 13:05 ` Markus Armbruster
2026-03-11 13:14 ` Daniel P. Berrangé
2026-03-11 13:38 ` Peter Krempa
2026-03-16 15:43 ` Markus Armbruster
2026-03-16 16:05 ` BALATON Zoltan
2026-03-16 18:00 ` Markus Armbruster
2026-03-20 10:09 ` Daniel P. Berrangé
2026-03-23 15:37 ` 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=aYtRooiYCc8LzUUJ@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=dapeng1.mi@linux.intel.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=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=zhao1.liu@intel.com \
--cc=zide.chen@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.