From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Ben Gardon <bgardon@google.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Sean Christopherson <seanjc@google.com>,
David Matlack <dmatlack@google.com>,
Jim Mattson <jmattson@google.com>,
David Dunn <daviddunn@google.com>,
Jing Zhang <jingzhangos@google.com>,
Junaid Shahid <junaids@google.com>
Subject: Re: [PATCH] KVM: x86/MMU: Zap non-leaf SPTEs when disabling dirty logging
Date: Thu, 26 May 2022 17:52:44 +0200 [thread overview]
Message-ID: <a1fbab86-ece9-82e3-64fe-0a19a125513b@redhat.com> (raw)
In-Reply-To: <Yo+O6AqNNBTg7BMY@xz-m1.local>
On 5/26/22 16:30, Peter Xu wrote:
> On Thu, May 26, 2022 at 02:01:43PM +0200, Paolo Bonzini wrote:
>> On 5/26/22 01:09, Ben Gardon wrote:
>>> + WARN_ON(max_mapping_level < iter.level);
>>> +
>>> + /*
>>> + * If this page is already mapped at the highest
>>> + * viable level, there's nothing more to do.
>>> + */
>>> + if (max_mapping_level == iter.level)
>>> + continue;
>>> +
>>> + /*
>>> + * The page can be remapped at a higher level, so step
>>> + * up to zap the parent SPTE.
>>> + */
>>> + while (max_mapping_level > iter.level)
>>> + tdp_iter_step_up(&iter);
>>> +
>>> /* Note, a successful atomic zap also does a remote TLB flush. */
>>> - if (tdp_mmu_zap_spte_atomic(kvm, &iter))
>>> - goto retry;
>>> + tdp_mmu_zap_spte_atomic(kvm, &iter);
>>> +
>>
>> Can you make this a sparate function (for example
>> tdp_mmu_zap_collapsible_spte_atomic)? Otherwise looks great!
>
> There could be a tiny downside of using a helper in that it'll hide the
> step-up of the iterator, which might not be as obvious as keeping it in the
> loop?
That's true, my reasoning is that zapping at a higher level can only be
done by first moving the iterator up. Maybe
tdp_mmu_zap_at_level_atomic() is a better Though, I can very well apply
this patch as is.
Paolo
next prev parent reply other threads:[~2022-05-26 15:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 23:09 [PATCH] KVM: x86/MMU: Zap non-leaf SPTEs when disabling dirty logging Ben Gardon
2022-05-25 23:12 ` Ben Gardon
2022-05-26 1:30 ` Yuan Yao
2022-05-26 15:57 ` Ben Gardon
2022-05-26 12:01 ` Paolo Bonzini
2022-05-26 14:30 ` Peter Xu
2022-05-26 15:52 ` Paolo Bonzini [this message]
2022-05-26 16:00 ` Ben Gardon
2022-06-06 23:11 ` Ben Gardon
2022-05-26 16:40 ` David Matlack
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=a1fbab86-ece9-82e3-64fe-0a19a125513b@redhat.com \
--to=pbonzini@redhat.com \
--cc=bgardon@google.com \
--cc=daviddunn@google.com \
--cc=dmatlack@google.com \
--cc=jingzhangos@google.com \
--cc=jmattson@google.com \
--cc=junaids@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=seanjc@google.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