kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: x86: Address performance degradation due to APICv inhibits
@ 2025-02-03 17:03 Naveen N Rao (AMD)
  2025-02-03 17:03 ` [PATCH 1/3] KVM: x86: hyper-v: Convert synic_auto_eoi_used to an atomic Naveen N Rao (AMD)
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Naveen N Rao (AMD) @ 2025-02-03 17:03 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: Sean Christopherson, Paolo Bonzini, Suravee Suthikulpanit,
	Vasant Hegde, Maxim Levitsky, Vitaly Kuznetsov

When AVIC is enabled (kvm_amd avic=1), guests with kernel-irqchip=on and 
PIT in reinject mode (default configuration) show degraded performance.  
This is because even though APICv is inhibited, we see other inhibits 
being set/cleared causing contention on apicv_update_lock. Rework 
inhibit code so that apicv_update_lock is not required unless APICv 
state is changing. More details in patch 3.

In a test setup with two guests (-smp 16, -netdev tap,vhost=on, -device 
virtio-net-pci,mq=on), multiple instances of netperf TCP_RR sending 
traffic to the other guest, sar shows:

Without this patch series, kvm_amd avic=0 (default):
Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         ens2 1323407.59 1323406.87 250722.47 126654.46      0.00      0.00      0.00      0.00

Without this patch series, kvm_amd avic=1:
Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         ens2 1057711.25 1057697.51 200385.83 101225.23      0.00      0.00      0.00      0.00

We see ~20% degradation in packet rate.

With this patch series, kvm_amd avic=1:
Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         ens2 1315433.91 1315434.46 249211.99 125891.47      0.00      0.00      0.00      0.00


- Naveen



Naveen N Rao (AMD) (3):
  KVM: x86: hyper-v: Convert synic_auto_eoi_used to an atomic
  KVM: x86: Remove use of apicv_update_lock when toggling guest debug
    state
  KVM: x86: Decouple APICv activation state from apicv_inhibit_reasons

 arch/x86/include/asm/kvm_host.h |  14 ++--
 arch/x86/kvm/hyperv.c           |  17 ++---
 arch/x86/kvm/x86.c              | 125 ++++++++++++++++----------------
 3 files changed, 72 insertions(+), 84 deletions(-)


base-commit: eb723766b1030a23c38adf2348b7c3d1409d11f0
-- 
2.48.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2025-02-11 18:17 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 17:03 [PATCH 0/3] KVM: x86: Address performance degradation due to APICv inhibits Naveen N Rao (AMD)
2025-02-03 17:03 ` [PATCH 1/3] KVM: x86: hyper-v: Convert synic_auto_eoi_used to an atomic Naveen N Rao (AMD)
2025-02-04  1:30   ` Maxim Levitsky
2025-02-04 13:09     ` Naveen N Rao
2025-02-04 19:33       ` Sean Christopherson
2025-02-05 11:00         ` Naveen N Rao
2025-02-03 17:03 ` [PATCH 2/3] KVM: x86: Remove use of apicv_update_lock when toggling guest debug state Naveen N Rao (AMD)
2025-02-04  2:00   ` Maxim Levitsky
2025-02-04 13:10     ` Naveen N Rao
2025-02-04 14:25     ` Naveen N Rao
2025-02-04 17:51       ` Sean Christopherson
2025-02-04 17:58         ` Paolo Bonzini
2025-02-04 19:42           ` Maxim Levitsky
2025-02-05 11:13         ` Naveen N Rao
2025-02-03 17:03 ` [PATCH 3/3] KVM: x86: Decouple APICv activation state from apicv_inhibit_reasons Naveen N Rao (AMD)
2025-02-03 18:45   ` Sean Christopherson
2025-02-03 22:22     ` Paolo Bonzini
2025-02-03 23:46       ` Sean Christopherson
2025-02-04  1:23         ` Maxim Levitsky
2025-02-04 19:18           ` Sean Christopherson
2025-02-04 20:08             ` Maxim Levitsky
2025-02-05  1:41               ` Sean Christopherson
2025-02-05 10:54                 ` Naveen N Rao
2025-02-05 11:36             ` Paolo Bonzini
2025-02-11 15:57               ` Naveen N Rao
2025-02-11 16:37                 ` Sean Christopherson
2025-02-11 18:13                   ` Naveen N Rao
2025-02-04 11:06         ` Naveen N Rao
2025-02-04 14:08           ` Paolo Bonzini
2025-02-11 14:37             ` Naveen N Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).