All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: luoyonggang@gmail.com, qemu-devel@nongnu.org,
	"Chao Liu" <chao.liu@processmission.com>,
	"Eric Blake" <eblake@redhat.com>,
	qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Brian Cain" <brian.cain@oss.qualcomm.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Daniel Henrique Barboza" <daniel.barboza@oss.qualcomm.com>,
	qemu-riscv@nongnu.org, "Laurent Vivier" <lvivier@redhat.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Song Gao" <17746591750@163.com>,
	"Philippe Mathieu-Daude" <philmd@mailo.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Weiwei Li" <liwei1518@gmail.com>,
	"Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH v3 01/10] machine: allow -M name to differ from QOM type
Date: Thu, 1 Oct 2026 09:01:06 +0100	[thread overview]
Message-ID: <ar4TQtKqfXX5Ul9O@redhat.com> (raw)
In-Reply-To: <74853ef8-7315-466a-99ac-41c8182f9b13@oss.qualcomm.com>

On Wed, Sep 30, 2026 at 09:23:50PM -0700, Pierrick Bouvier wrote:
> On 9/30/26 6:55 PM, Yonggang Luo wrote:
> > On Thu, Oct 1, 2026 at 2:19 AM Pierrick Bouvier
> > <pierrick.bouvier@oss.qualcomm.com> wrote:
> > > 
> > > On 9/26/26 1:15 AM, Yonggang Luo wrote:
> > > > - Add machine_class_set_name() so boards can keep a stable -M name
> > > >     when the QOM type is uniquified. machine_class_base_init still
> > > >     defaults the name to the QOM type without -machine.
> > > > - Document that MachineClass::name is the -M name, not the QOM type.
> > > > - Sort -M help by MachineClass::name so order matches the printed names
> > > >     when QOM types are prefixed (arm-virt-11.1-machine vs virt-11.1).
> > > > 
> > > > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> > > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > > > ---
> > > >    hw/core/machine.c        |  6 ++++++
> > > >    include/hw/core/boards.h | 12 +++++++++++-
> > > >    system/vl.c              |  8 +++-----
> > > >    3 files changed, 20 insertions(+), 6 deletions(-)
> > > > 
> > > 
> > > First, I'm not opposed to this series, and if anyone wants to pull this,
> > > I'm ok with that decision. It's just unclear for me what will be
> > > direction after this step.
> > > 
> > > If I understand correctly, the goal here is to allow to register
> > > multiple "virt" machines, while still having distinct QOM types behind
> > > the hood, which does no affect behavior of current binaries who have
> > > only a single "virt" type at most.
> > > 
> > > That said, if we project in the future where we have a binary with
> > > multiple of those "virt" machines, how will the current series help? The
> > > situation we'll have is distinct QOM types, that all answer to the name
> > > "virt", so we have no way to select them individually.
> > > 
> > > Slightly worse, find_machine() will just pick the first machine name
> > > virt, which is a non-deterministic order at the moment.
> > > https://gitlab.com/qemu-project/qemu/-/blob/master/system/vl.c?ref_type=heads#L846
> > 
> > That will handle it properly. For single-target binary qemu-system-$arch.exe,
> > this won't be an issue, as there is no conflict as they won't be compiled in.
> > For multi-target binary qemu-system.exe, we will choose the target through
> > -M $arch:$machine, and when no $arch is specified, the default to arch
> > to be "none",
> > so still won't be non-deterministic.
> > 
> 
> > "when no $arch is specified, the default to arch to be "none",so still >
> won't be non-deterministic.
> 
> That's my point, the current abstraction will create something ambiguous by
> design. When people will specify -M virt, without $arch:, a random machine
> will be selected. At least, maybe this series should ensure there is only
> one virt alias, or make it forbidden and uses unambiguous names only.

Yes, if there are multiple choices, we should not pick an arbitrary one
non-deterministically, we must require the user to narrow the choice
explicitly in some manner.

> "$arch:" is just a workaround to not add -target option, except that it
> comes with additional problems, creating inconsistent command lines.
> I already expressed my skepticism about the "machine prefix" based approach,
> being more in favor to strongly filter types per target with an unambiguous
> -target option. I'll accept the community's choice on this, but just wanted
> to see this explained before someone hits the pull button on this series, so
> they know what will come down the road.

Historically, QEMU do alot of things like this where we invented magic
syntax that needed custom parsing of the command line. Over time we
came to the conclusion this ad-hoc parsing was a bad idea, and we
should always explicitly model things, even if it is more verbose.

Thus I would not want to see "$target:$machine" as something that is
parsed into two pieces.

IOW, "aarch64-virt" would be OK as a unique name which treated as an
opaque string, but "aarch64:virt" as something split into "aarch64"
(target) and "virt" (machine) would be a bad idea.

An acceptable way of modelling the latter would be to use

  '-machine name=virt,target=aarch64'

or

  -machine virt -target aarch64

Inferring from the binary name would be acceptable too, as that can
be thought of a syntax sugar for "-target aarch64".

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-10-01  8:02 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26  8:15 [PATCH v3 00/10] machine: uniquify virt QOM names Yonggang Luo
2026-09-26  8:15 ` [PATCH v3 01/10] machine: allow -M name to differ from QOM type Yonggang Luo
2026-09-30  8:44   ` Zhao Liu
2026-09-30 18:19   ` Pierrick Bouvier
2026-10-01  1:55     ` Yonggang Luo
2026-10-01  4:23       ` Pierrick Bouvier
2026-10-01  8:01         ` Daniel P. Berrangé [this message]
2026-10-01  8:13           ` Yonggang Luo
2026-10-01  8:44             ` Philippe Mathieu-Daudé
2026-10-01 10:33               ` Yonggang Luo
2026-10-01 16:14               ` Yonggang Luo
2026-10-01 16:19                 ` Pierrick Bouvier
2026-10-01 17:40                   ` Daniel P. Berrangé
2026-10-01 18:08                     ` Pierrick Bouvier
2026-10-01 18:26                       ` Daniel P. Berrangé
2026-10-01 18:56                         ` Pierrick Bouvier
2026-10-02  2:00                           ` Yonggang Luo
2026-10-02 15:40                             ` Pierrick Bouvier
2026-10-02 16:32                               ` Daniel P. Berrangé
2026-10-02 16:43                                 ` Yonggang Luo
2026-10-02 16:52                                   ` Daniel P. Berrangé
2026-10-02 16:58                                     ` Yonggang Luo
2026-10-02 16:17                             ` Daniel P. Berrangé
2026-10-02 16:29                               ` Yonggang Luo
2026-10-02  3:10                           ` Yonggang Luo
2026-10-02 15:34                           ` Yonggang Luo
2026-10-02 16:14                           ` Daniel P. Berrangé
2026-10-02 16:27                             ` Yonggang Luo
2026-10-02 16:34                               ` Daniel P. Berrangé
2026-10-03 18:29                                 ` Yonggang Luo
2026-10-01  2:07     ` Yonggang Luo
2026-09-26  8:15 ` [PATCH v3 02/10] hw/riscv/virt: use unique QOM name Yonggang Luo
2026-09-30  8:44   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 03/10] hw/arm/virt: " Yonggang Luo
2026-09-30  8:44   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 04/10] hw/or1k/virt: " Yonggang Luo
2026-09-30  8:44   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 05/10] hw/hexagon/virt: " Yonggang Luo
2026-09-30  8:45   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 06/10] hw/loongarch/virt: " Yonggang Luo
2026-09-30  8:45   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 07/10] hw/m68k/virt: " Yonggang Luo
2026-09-30  8:45   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 08/10] hw/xtensa/virt: " Yonggang Luo
2026-09-30  8:46   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 09/10] qapi: return MachineInfo typename from query-machines Yonggang Luo
2026-09-28  6:44   ` Markus Armbruster
2026-09-30  8:46   ` Zhao Liu
2026-09-26  8:15 ` [PATCH v3 10/10] machine: match the versioned virt example to arm virt Yonggang Luo
2026-09-30  8:47   ` Zhao Liu
2026-09-30  2:50 ` [PATCH v3 00/10] machine: uniquify virt QOM names Yonggang Luo

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=ar4TQtKqfXX5Ul9O@redhat.com \
    --to=berrange@redhat.com \
    --cc=17746591750@163.com \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=chao.liu@processmission.com \
    --cc=daniel.barboza@oss.qualcomm.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=laurent@vivier.eu \
    --cc=liwei1518@gmail.com \
    --cc=luoyonggang@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@mailo.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=shorne@gmail.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.