[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1] target/i386: Always set leaf 0x1f
From: |
Zhao Liu |
Subject: |
Re: [PATCH v1] target/i386: Always set leaf 0x1f |
Date: |
Fri, 2 Aug 2024 10:33:39 +0800 |
On Wed, Jul 31, 2024 at 07:30:44PM +0530, Manish wrote:
> Date: Wed, 31 Jul 2024 19:30:44 +0530
> From: Manish <manish.mishra@nutanix.com>
> Subject: Re: [PATCH v1] target/i386: Always set leaf 0x1f
>
>
> On 30/07/24 6:39 pm, Igor Mammedov wrote:
> > !-------------------------------------------------------------------|
> > CAUTION: External Email
> >
> > |-------------------------------------------------------------------!
> >
> > On Mon, 29 Jul 2024 19:42:39 +0700
> > Manish <manish.mishra@nutanix.com> wrote:
> >
> > > On 29/07/24 7:18 pm, Igor Mammedov wrote:
> > > > !-------------------------------------------------------------------|
> > > > CAUTION: External Email
> > > >
> > > > |-------------------------------------------------------------------!
> > > >
> > > > On Wed, 24 Jul 2024 23:00:13 +0800
> > > > Zhao Liu <zhao1.liu@intel.com> wrote:
> > > > > Hi Igor,
> > > > >
> > > > > On Wed, Jul 24, 2024 at 02:54:32PM +0200, Igor Mammedov wrote:
> > > > > > Date: Wed, 24 Jul 2024 14:54:32 +0200
> > > > > > From: Igor Mammedov <imammedo@redhat.com>
> > > > > > Subject: Re: [PATCH v1] target/i386: Always set leaf 0x1f
> > > > > > X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-redhat-linux-gnu)
> > > > > >
> > > > > > On Wed, 24 Jul 2024 12:13:28 +0100
> > > > > > John Levon <john.levon@nutanix.com> wrote:
> > > > > > > On Wed, Jul 24, 2024 at 03:59:29PM +0530, Manish wrote:
> > > > > > > > > > Leaf 0x1f is superset of 0xb, so it makes sense to set 0x1f
> > > > > > > > > > equivalent
> > > > > > > > > > to 0xb by default and workaround windows issue.>
> > > > > > > > > > This change adds a
> > > > > > > > > > new property 'cpuid-0x1f-enforce' to set leaf 0x1f
> > > > > > > > > > equivalent to 0xb in
> > > > > > > > > > case extended CPU topology is not configured and behave as
> > > > > > > > > > before otherwise.
> > > > > > > > > repeating question
> > > > > > > > > why we need to use extra property instead of just adding 0x1f
> > > > > > > > > leaf for CPU models
> > > > > > > > > that supposed to have it?
> > > > > > > > As i mentioned in earlier response. "Windows expects it only
> > > > > > > > when we have
> > > > > > > > set max cpuid level greater than or equal to 0x1f. I mean if it
> > > > > > > > is exposed
> > > > > > > > it should not be all zeros. SapphireRapids CPU definition
> > > > > > > > raised cpuid level
> > > > > > > > to 0x20, so we starting seeing it with SapphireRapids."
> > > > > > > >
> > > > > > > > Windows does not expect 0x1f to be present for any CPU model.
> > > > > > > > But if it is
> > > > > > > > exposed to the guest, it expects non-zero values.
> > > > > > > I think Igor is suggesting:
> > > > > > >
> > > > > > > - leave x86_cpu_expand_features() alone completely
> > > > > > yep, drop that if possible
> > > > > >
> > > > > > > - change the 0x1f handling to always report topology i.e.
> > > > > > > never report all
> > > > > > > zeroes
> > > > > > Do this but only for CPU models that have this leaf per spec,
> > > > > > to avoid live migration issues create a new version of CPU model,
> > > > > > so it would apply only for new version. This way older versions
> > > > > > and migration won't be affected.
> > > > > So that in the future every new Intel CPU model will need to always
> > > > > enable 0x1f. Sounds like an endless game. So my question is: at what
> > > > > point is it ok to consider defaulting to always enable 0x1f and just
> > > > > disable it for the old CPU model?
> > > > I have suggested to enable 0x1f leaf excluding:
> > > > * existing cpu models (versions)
> > > > * cpu models that do not have this leaf in real world should
> > > > not have it in QEMU either.
> > > >
> > > > If cpu model already exists, you'd need a new version of cpu model to
> > > > enable new leaf by default.
> > > >
> > > > For completely new cpu model, it could be enabled from the start.
> > > > i.e. workflow for enabling that should be the same as with CPU features
> > > > (or as you said 'endless game' of copying base model and making it look
> > > > like
> > > > should be according to spec,
> > > > but that's the process we currently use for describing CPU models).
> > > Igor my understanding was that there are two type of features one is
> > > real CPU feature, yes those makes sense in CPU models. But on other hand
> > > there are features which are emulated ones i.e. kvm-*, these make sense
> > > enabling regardless of any CPU model and we usually use machine types to
> > > enable these. Does not this features makes sense in 2nd category.
> > I'm not convinced that it applies to any CPU model.
> > I'd say it's risky to expose new leaf on CPUs that don't have it to begin
> > with.
> > Also what about AMD cpus? Do they also support this leaf?
>
> Hi Igor, No AMD has different leaf for this purpose, i think 8000_0026. But
> should not AMD platforms or guest ignore it in that case. This flag was
> anyway getting populated earlier too for nr_dies > 1?
>
AMD hasn't supported that leaf in QEMU (cpu_x86_cpuid()).
Igor's concern is right, as there is no way to ensure how the software
will behave (just like Windows doesn't respect the x86 spec). It is
least risky to consider this property as the 1st category, because the
particular CPU model supports this leaf, and software that runs
properly on the corresponding bare metal certainly won't complain about
0x1f or even prefer to have 0x1f in Guest (also as in your Windows
example).
Disable "cpuid-0x1f-enforce" by default is also fine for me. If you find
it's not easy to add 0x1f for the CPU models, I can add 0x1f into CPU
models in the future with my other cache model work, to help you fill in
the last piece that Igor suggested.
Regards,
Zhao
- Re: [PATCH v1] target/i386: Always set leaf 0x1f,
Zhao Liu <=