lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 2/7] KVM: VMX: Add proper cache tracking for PKRS
From


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>

\
 
 \ /
  Last update: 2022-03-31 07:39    [W:0.302 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site