diff mbox series

KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled

Message ID 20231016221228.1348318-1-dmatlack@google.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled | expand

Commit Message

David Matlack Oct. 16, 2023, 10:12 p.m. UTC
Stop kicking vCPUs in kvm_arch_sync_dirty_log() when PML is disabled.
Kicking vCPUs when PML is disabled serves no purpose and could
negatively impact guest performance.

This restores KVM's behavior to prior to 5.12 commit a018eba53870 ("KVM:
x86: Move MMU's PML logic to common code"), which replaced a
static_call_cond(kvm_x86_flush_log_dirty) with unconditional calls to
kvm_vcpu_kick().

Fixes: a018eba53870 ("KVM: x86: Move MMU's PML logic to common code")
Signed-off-by: David Matlack <dmatlack@google.com>
---
 arch/x86/kvm/x86.c | 3 +++
 1 file changed, 3 insertions(+)


base-commit: ba8c993c3748931a307648616f68892bcb6afe28

Comments

Sean Christopherson Oct. 18, 2023, 1:16 a.m. UTC | #1
On Mon, 16 Oct 2023 15:12:28 -0700, David Matlack wrote:
> Stop kicking vCPUs in kvm_arch_sync_dirty_log() when PML is disabled.
> Kicking vCPUs when PML is disabled serves no purpose and could
> negatively impact guest performance.
> 
> This restores KVM's behavior to prior to 5.12 commit a018eba53870 ("KVM:
> x86: Move MMU's PML logic to common code"), which replaced a
> static_call_cond(kvm_x86_flush_log_dirty) with unconditional calls to
> kvm_vcpu_kick().
> 
> [...]

Applied to kvm-x86 misc, thanks!

[1/1] KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled
      https://github.com/kvm-x86/linux/commit/3d30bfcbdc26

--
https://github.com/kvm-x86/linux/tree/next
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 41cce5031126..af97de19b2ce 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6259,6 +6259,9 @@  void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
 	struct kvm_vcpu *vcpu;
 	unsigned long i;
 
+	if (!kvm_x86_ops.cpu_dirty_log_size)
+		return;
+
 	kvm_for_each_vcpu(i, vcpu, kvm)
 		kvm_vcpu_kick(vcpu);
 }