lkml.org 
[lkml]   [2021]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] KVM: x86/mmu: Skip !MMU-present SPTEs when removing SP in exclusive mode
From
Date
On 10/03/21 23:24, Ben Gardon wrote:
> On Wed, Mar 10, 2021 at 1:14 PM Sean Christopherson <seanjc@google.com> wrote:
>>
>> On Wed, Mar 10, 2021, Paolo Bonzini wrote:
>>> On 10/03/21 01:30, Sean Christopherson wrote:
>>>> diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
>>>> index 50ef757c5586..f0c99fa04ef2 100644
>>>> --- a/arch/x86/kvm/mmu/tdp_mmu.c
>>>> +++ b/arch/x86/kvm/mmu/tdp_mmu.c
>>>> @@ -323,7 +323,18 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, u64 *pt,
>>>> cpu_relax();
>>>> }
>>>> } else {
>>>> + /*
>>>> + * If the SPTE is not MMU-present, there is no backing
>>>> + * page associated with the SPTE and so no side effects
>>>> + * that need to be recorded, and exclusive ownership of
>>>> + * mmu_lock ensures the SPTE can't be made present.
>>>> + * Note, zapping MMIO SPTEs is also unnecessary as they
>>>> + * are guarded by the memslots generation, not by being
>>>> + * unreachable.
>>>> + */
>>>> old_child_spte = READ_ONCE(*sptep);
>>>> + if (!is_shadow_present_pte(old_child_spte))
>>>> + continue;
>>>> /*
>>>> * Marking the SPTE as a removed SPTE is not
>
> This optimization also makes me think we could also skip the
> __handle_changed_spte call in the read mode case if the SPTE change
> was !PRESENT -> REMOVED.
>
Yes, I think so. It should be a separate patch anyway, so I've queued
this one.

Paolo

\
 
 \ /
  Last update: 2021-03-12 19:13    [W:0.067 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site