mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chenyi Qiang <chenyi.qiang@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Xiaoyao Li <xiaoyao.li@intel.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/7] KVM: VMX: Add proper cache tracking for PKRS
Date: Thu, 31 Mar 2022 13:39:07 +0800	[thread overview]
Message-ID: <04df790f-0900-d678-d560-7b1905b7b56d@intel.com> (raw)
In-Reply-To: <YkTAzCPZ3zXYDBLj@google.com>



On 3/31/2022 4:42 AM, Sean Christopherson wrote:
> On Mon, Feb 21, 2022, Chenyi Qiang wrote:
>> Add PKRS caching into the standard register caching mechanism in order
>> to take advantage of the availability checks provided by regs_avail.
>>
>> This is because vcpu->arch.pkrs will be rarely acceesed by KVM, only in
>> the case of host userspace MSR reads and GVA->GPA translation in
>> following patches. It is unnecessary to keep it up-to-date at all times.
> 
> It might be worth throwing in a blurb that the potential benefits of this caching
> are tenous.
> 
> Barring userspace wierdness, the MSR read is not a hot path.
> 
> permission_fault() is slightly more common, but I would be surprised if caching
> actually provides meaningful performance benefit.  The PKRS checks are done only
> once per virtual access, i.e. only on the final translation, so the cache will get
> a hit if and only if there are multiple translations in a single round of emulation,
> where a "round of emulation" ends upon entry to the guest.  With unrestricted
> guest, i.e. for all intents and purposes every VM using PKRS, there aren't _that_
> many scenarios where KVM will (a) emulate in the first place and (b) emulate enough
> accesses for the caching to be meaningful.
> 
> That said, this is basically "free", so I've no objection to adding it.  But I do
> think it's worth documenting that it's nice-to-have so that we don't hesitate to
> rip it out in the future if there's a strong reason to drop the caching.
> 

OK, will add this note in commit message.

>> Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
>> ---
> 
> Reviewed-by: Sean Christopherson <seanjc@google.com>

  reply	other threads:[~2022-03-31  5:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  8:08 [PATCH v6 0/7] KVM: PKS Virtualization support Chenyi Qiang
2022-02-21  8:08 ` [PATCH v6 1/7] KVM: VMX: Introduce PKS VMCS fields Chenyi Qiang
2022-03-30 20:05   ` Sean Christopherson
2022-02-21  8:08 ` [PATCH v6 2/7] KVM: VMX: Add proper cache tracking for PKRS Chenyi Qiang
2022-03-30 20:42   ` Sean Christopherson
2022-03-31  5:39     ` Chenyi Qiang [this message]
2022-02-21  8:08 ` [PATCH v6 3/7] KVM: X86: Expose IA32_PKRS MSR Chenyi Qiang
2022-02-21  8:08 ` [PATCH v6 4/7] KVM: MMU: Rename the pkru to pkr Chenyi Qiang
2022-02-21  8:08 ` [PATCH v6 5/7] KVM: MMU: Add support for PKS emulation Chenyi Qiang
2022-03-30 21:27   ` Sean Christopherson
2022-03-31  5:43     ` Chenyi Qiang
2022-02-21  8:08 ` [PATCH v6 6/7] KVM: VMX: Expose PKS to guest Chenyi Qiang
2022-03-30 21:30   ` Sean Christopherson
2022-02-21  8:08 ` [PATCH v6 7/7] KVM: VMX: Enable PKS for nested VM Chenyi Qiang
2022-03-30 21:47   ` Sean Christopherson
2022-03-31  6:08     ` Chenyi Qiang
2022-03-07  6:09 ` [PATCH v6 0/7] KVM: PKS Virtualization support Chenyi Qiang

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=04df790f-0900-d678-d560-7b1905b7b56d@intel.com \
    --to=chenyi.qiang@intel.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=xiaoyao.li@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®