All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Peter Krempa <pkrempa@redhat.com>
Cc: "Yang Zhong" <yang.zhong@intel.com>,
	"Jean-Philippe Brucker" <jean-philippe@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	libvir-list@redhat.com, qemu-devel@nongnu.org,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Ani Sinha" <ani@anisinha.ca>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v4 2/4] hw/i386: Attach CPUs to machine
Date: Mon, 7 Feb 2022 12:22:22 +0100	[thread overview]
Message-ID: <20220207122222.58903ec7@redhat.com> (raw)
In-Reply-To: <YgDoKlkP9Isdjnv8@angien.pipo.sk>

On Mon, 7 Feb 2022 10:36:42 +0100
Peter Krempa <pkrempa@redhat.com> wrote:

> On Mon, Feb 07, 2022 at 10:18:43 +0100, Igor Mammedov wrote:
> > On Mon, 7 Feb 2022 09:14:37 +0100
> > Igor Mammedov <imammedo@redhat.com> wrote:
> >   
> > > On Sat,  5 Feb 2022 13:45:24 +0100
> > > Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> > >   
> > > > Previously CPUs were exposed in the QOM tree at a path
> > > > 
> > > >   /machine/unattached/device[nn]
> > > > 
> > > > where the 'nn' of the first CPU is usually zero, but can
> > > > vary depending on what devices were already created.
> > > > 
> > > > With this change the CPUs are now at
> > > > 
> > > >   /machine/cpu[nn]
> > > > 
> > > > where the 'nn' of the first CPU is always zero.    
> > > 
> > > Could you add to commit message the reason behind the change?  
> > 
> > regardless, it looks like unwarranted movement to me
> > prompted by livirt accessing/expecting a QOM patch which is
> > not stable ABI. I'd rather get it fixed on libvirt side.
> > 
> > If libvirt needs for some reason access a CPU instance,
> > it should use @query-hotpluggable-cpus to get a list of CPUs
> > (which includes QOM path of already present CPUs) instead of
> > hard-codding some 'well-known' path as there is no any guarantee 
> > that it will stay stable whatsoever.  
> 
> I don't disagree with you about the use of hardcoded path, but the way
> of using @query-hotpluggable-cpus is not really aligning well for how
> it's being used.
>
> To shed a bit more light, libvirt uses the following hardcoded path
> 
> #define QOM_CPU_PATH  "/machine/unattached/device[0]"
> 
> in code which is used to query CPU flags. That code doesn't care at all
> which cpus are present but wants to get any of them. So yes, calling
> query-hotpluggable-cpus is possible but a bit pointless.

Even though query-hotpluggable-cpus is cumbersome
it still lets you avoid hardcodding QOM path and let you
get away with keeping "_400 QMP calls" probing while
something better comes along.


> In general the code probing cpu flags via qom-get is very cumbersome as
> it ends up doing ~400 QMP calls at startup of a VM in cases when we deem
> it necessary to probe the cpu fully.
> 
> It would be much better (And would sidestep the issue altoghether) if we
> had a more sane interface to probe all cpu flags in one go, and ideally
> the argument specifying the cpu being optional.
> 
> Libvirt can do the adjustment, but for now IMO the path to the first cpu
> (/machine/unattached/device[0]) became de-facto ABI by the virtue that
> it was used by libvirt and if I remember correctly it was suggested by
> the folks dealing with the CPU when the code was added originally.
I would've argued against that back then as well,
there weren't any guarantee and I wouldn't like precedent of
QOM abuse becoming de-facto ABI.
Note: this patch breaks this so called ABI as well and introduces
yet another harcodded path without any stability guarantee whatsoever.

> 
> Even if we change it in libvirt right away, changing qemu will break
> forward compatibility. While we don't guarantee it, it still creates
> user grief.
> 



  parent reply	other threads:[~2022-02-07 11:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 12:45 [PATCH v4 0/4] hw/i386: QOM-attach CPUs/SGX-EPC objects to their parents Philippe Mathieu-Daudé via
2022-02-05 12:45 ` [PATCH v4 1/4] tests/qtest/acpi: Temporary allow VIOT table changes Philippe Mathieu-Daudé via
2022-02-05 12:45 ` [PATCH v4 2/4] hw/i386: Attach CPUs to machine Philippe Mathieu-Daudé via
2022-02-07  8:14   ` Igor Mammedov
2022-02-07  9:18     ` Igor Mammedov
2022-02-07  9:36       ` Peter Krempa
2022-02-07  9:41         ` Peter Krempa
2022-02-07 11:20           ` Ani Sinha
2022-02-07 11:28             ` Peter Krempa
2022-02-07 11:37               ` Ani Sinha
2022-02-07 10:06         ` Daniel P. Berrangé
2022-02-07 11:22         ` Igor Mammedov [this message]
2022-02-07 11:48           ` Daniel P. Berrangé
2022-02-07 13:17             ` Igor Mammedov
2022-02-07 13:51             ` Peter Maydell
2022-02-05 12:45 ` [PATCH v4 3/4] tests/qtest/acpi: Update VIOT table blob Philippe Mathieu-Daudé via
2022-02-05 12:45 ` [PATCH v4 4/4] hw/i386/sgx: Attach SGX-EPC objects to machine Philippe Mathieu-Daudé via
2022-02-07  8:37   ` Igor Mammedov
2022-02-07  8:47     ` Philippe Mathieu-Daudé via
2022-02-14  6:58     ` Yang Zhong
2022-02-14  8:21       ` Igor Mammedov
2022-02-14 10:30         ` Daniel P. Berrangé
2022-02-16  9:01           ` Igor Mammedov
2022-02-14  7:27     ` Yang Zhong
2022-02-05 16:24 ` [PATCH v4 0/4] hw/i386: QOM-attach CPUs/SGX-EPC objects to their parents Philippe Mathieu-Daudé via

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=20220207122222.58903ec7@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=f4bug@amsat.org \
    --cc=jean-philippe@linaro.org \
    --cc=libvir-list@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yang.zhong@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.