From: Sean Christopherson <sean.j.christopherson@intel.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Like Xu <like.xu@linux.intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v3] KVM: x86: Add Intel CPUID.1F cpuid emulation support
Date: Mon, 3 Jun 2019 12:18:18 -0700 [thread overview]
Message-ID: <20190603191818.GF13384@linux.intel.com> (raw)
In-Reply-To: <20190603165616.GA11101@flask>
On Mon, Jun 03, 2019 at 06:56:17PM +0200, Radim Krčmář wrote:
> > + break;
> > + }
> > entry->eax = min(entry->eax, (u32)(f_intel_pt ? 0x14 : 0xd));
>
> Similarly in the existing code. If we don't have f_intel_pt, then we
> should make sure that leaf 0x14 is not being filled, but we don't really
> have to limit the maximal index.
>
> Adding a single clamping like
>
> /* Limited to the highest leaf implemented in KVM. */
> entry->eax = min(entry->eax, 0x1f);
>
> seems sufficient.
>
> (Passing the hardware value is ok in theory, but it is a cheap way to
> avoid future leaves that cannot be simply zeroed for some weird reason.)
I don't have a strong opinion regarding the code itself, but whatever ends
up getting committed should have a big beefy changelog explaining why the
clamping exists, or at least extolling its virtues. I had a hell of a
time understanding the intent of this one line of code because as your
response shows, there is no one right answer.
next prev parent reply other threads:[~2019-06-03 19:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-26 13:30 [RESEND PATCH v3] KVM: x86: Add Intel CPUID.1F cpuid emulation support Like Xu
2019-06-03 16:56 ` Radim Krčmář
2019-06-03 19:18 ` Sean Christopherson [this message]
2019-06-06 1:30 ` Like Xu
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=20190603191818.GF13384@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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.