diff mbox series

[v6,21/22] KVM: x86/mmu: Use ranged-based TLB flush for dirty log memslot flush

Message ID 20200218210736.16432-22-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: Dynamically size memslot arrays | expand

Commit Message

Sean Christopherson Feb. 18, 2020, 9:07 p.m. UTC
Use the with_address() variant to when performing a TLB flush for a
specific memslot via kvm_arch_flush_remote_tlbs_memslot(), i.e. when
flushing after clearing dirty bits during KVM_{GET,CLEAR}_DIRTY_LOG.
This aligns all dirty log memslot-specific TLB flushes to use the
with_address() variant and paves the way for consolidating the relevant
code.

Note, moving to the with_address() variant only affects functionality
when running as a HyperV guest.

Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/kvm/mmu/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Sergei Shtylyov Feb. 19, 2020, 9:22 a.m. UTC | #1
Hello!

On 19.02.2020 0:07, Sean Christopherson wrote:

> Use the with_address() variant to when performing a TLB flush for a
                                  ^^ is it really needed here?

> specific memslot via kvm_arch_flush_remote_tlbs_memslot(), i.e. when
> flushing after clearing dirty bits during KVM_{GET,CLEAR}_DIRTY_LOG.
> This aligns all dirty log memslot-specific TLB flushes to use the
> with_address() variant and paves the way for consolidating the relevant
> code.
> 
> Note, moving to the with_address() variant only affects functionality
> when running as a HyperV guest.
> 
> Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
[...]

MBR, Sergei
Sean Christopherson Feb. 19, 2020, 3:18 p.m. UTC | #2
On Wed, Feb 19, 2020 at 12:22:58PM +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 19.02.2020 0:07, Sean Christopherson wrote:
> 
> >Use the with_address() variant to when performing a TLB flush for a
>                                  ^^ is it really needed here?

Doh, thanks.  The subject also has a typo, it should be "range-based", not
"ranged-based".

> >specific memslot via kvm_arch_flush_remote_tlbs_memslot(), i.e. when
> >flushing after clearing dirty bits during KVM_{GET,CLEAR}_DIRTY_LOG.
> >This aligns all dirty log memslot-specific TLB flushes to use the
> >with_address() variant and paves the way for consolidating the relevant
> >code.
> >
> >Note, moving to the with_address() variant only affects functionality
> >when running as a HyperV guest.
> >
> >Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
> >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> [...]
> 
> MBR, Sergei
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 026e4a5c8e86..8a6516ce2983 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -5950,7 +5950,8 @@  void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm,
 	 * kvm_mmu_slot_remove_write_access().
 	 */
 	lockdep_assert_held(&kvm->slots_lock);
-	kvm_flush_remote_tlbs(kvm);
+	kvm_flush_remote_tlbs_with_address(kvm, memslot->base_gfn,
+					   memslot->npages);
 }
 
 void kvm_mmu_slot_leaf_clear_dirty(struct kvm *kvm,