From: Wei Huang <wei.huang2@amd.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Wei Huang <whuang2@amd.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 0/2] KVM: x86: allow for more CPUID entries
Date: Wed, 16 Sep 2020 14:22:36 -0500 [thread overview]
Message-ID: <20200916192236.GA623906@weilap> (raw)
In-Reply-To: <20200916083351.GA2833@work-vm>
On 09/16 09:33, Dr. David Alan Gilbert wrote:
> * Wei Huang (wei.huang2@amd.com) wrote:
> > On 09/15 05:51, Dr. David Alan Gilbert wrote:
> > > * Vitaly Kuznetsov (vkuznets@redhat.com) wrote:
> > > > With QEMU and newer AMD CPUs (namely: Epyc 'Rome') the current limit for
> >
> > Could you elaborate on this limit? On Rome, I counted ~35 CPUID functions which
> > include Fn0000_xxxx, Fn4000_xxxx and Fn8000_xxxx.
>
> On my 7302P the output of:
> cpuid -1 -r | wc -l
>
> is 61, there is one line of header in there.
>
> However in a guest I see more; and I think that's because KVM tends to
> list the CPUID entries for a lot of disabled Intel features, even on
> AMD, e.g. 0x11-0x1f which AMD doesn't have, are listed in a KVM guest.
> Then you add the KVM CPUIDs at 4...0 and 4....1.
>
It is indeed a mixing bag. Some are added even though AMD CPU doesn't define
them. BTW I also believe that cpuid command lists more CPUIDs than the real
value of cpuid->nent in kvm_vcpu_ioctl_set_cpuid(2).
Anyway I don't have objection to this patchset.
> IMHO we should be filtering those out for at least two reasons:
> a) They're wrong
> b) We're probably not keeping the set of visible CPUID fields the same
> when we move between host kernels, and that can't be good for
> migration.
>
> Still, those are separate problems.
>
> Dave
>
> > > > KVM_MAX_CPUID_ENTRIES(80) is reported to be hit. Last time it was raised
> > > > from '40' in 2010. We can, of course, just bump it a little bit to fix
> > > > the immediate issue but the report made me wonder why we need to pre-
> > > > allocate vcpu->arch.cpuid_entries array instead of sizing it dynamically.
> > > > This RFC is intended to feed my curiosity.
> > > >
> > > > Very mildly tested with selftests/kvm-unit-tests and nothing seems to
> > > > break. I also don't have access to the system where the original issue
> > > > was reported but chances we're fixing it are very good IMO as just the
> > > > second patch alone was reported to be sufficient.
> > > >
> > > > Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > >
> > > Oh nice, I was just going to bump the magic number :-)
> > >
> > > Anyway, this seems to work for me, so:
> > >
> > > Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > >
> >
> > I tested on two platforms and the patches worked fine. So no objection on the
> > design.
> >
> > Tested-by: Wei Huang <wei.huang2@amd.com>
> >
> > > > Vitaly Kuznetsov (2):
> > > > KVM: x86: allocate vcpu->arch.cpuid_entries dynamically
> > > > KVM: x86: bump KVM_MAX_CPUID_ENTRIES
> > > >
> > > > arch/x86/include/asm/kvm_host.h | 4 +--
> > > > arch/x86/kvm/cpuid.c | 55 ++++++++++++++++++++++++---------
> > > > arch/x86/kvm/x86.c | 1 +
> > > > 3 files changed, 43 insertions(+), 17 deletions(-)
> > > >
> > > > --
> > > > 2.25.4
> > > >
> > > --
> > > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> > >
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
>
prev parent reply other threads:[~2020-09-16 19:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 15:43 [PATCH RFC 0/2] KVM: x86: allow for more CPUID entries Vitaly Kuznetsov
2020-09-15 15:43 ` [PATCH RFC 1/2] KVM: x86: allocate vcpu->arch.cpuid_entries dynamically Vitaly Kuznetsov
2020-09-18 2:41 ` Sean Christopherson
2020-10-01 10:04 ` Vitaly Kuznetsov
2020-09-15 15:43 ` [PATCH RFC 2/2] KVM: x86: bump KVM_MAX_CPUID_ENTRIES Vitaly Kuznetsov
2020-09-15 16:51 ` [PATCH RFC 0/2] KVM: x86: allow for more CPUID entries Dr. David Alan Gilbert
2020-09-16 3:49 ` Wei Huang
2020-09-16 7:44 ` Vitaly Kuznetsov
2020-09-16 8:33 ` Dr. David Alan Gilbert
2020-09-16 19:22 ` Wei Huang [this message]
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=20200916192236.GA623906@weilap \
--to=wei.huang2@amd.com \
--cc=dgilbert@redhat.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=whuang2@amd.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