kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] KVM: x86/xen updates
@ 2024-02-27 11:49 David Woodhouse
  2024-02-27 11:49 ` [PATCH v2 1/8] KVM: x86/xen: improve accuracy of Xen timers David Woodhouse
                   ` (9 more replies)
  0 siblings, 10 replies; 26+ messages in thread
From: David Woodhouse @ 2024-02-27 11:49 UTC (permalink / raw)
  To: kvm; +Cc: Sean Christopherson, Paul Durrant, Paolo Bonzini, Michal Luczaj

These apply to the kvm-x86/xen tree.

First, deal with the awful brokenness of the KVM clock, and its systemic 
drift especially when TSC scaling is used. This is a bit of a workaround 
for Xen timers where it hurts *most*, but it's actually easier in this 
case because there is a vCPU (and associated PV clock information) to 
use for the scaling. A better fix for __get_kvmclock() is in the works, 
but there's an enormous yak to shave there because there are so many 
interrelated bugs in the TSC and timekeeping code.

Ensure that the guest doesn't miss Xen event channel wakeups which are
already pending when the local APIC is enabled. Userspace doesn't get
to interpose here, so KVM needs to do the same as Xen and explicitly
check for the pending event. While looking at that, Michal spotted a
potential false positive from the WARN_ON_ONCE() when delivering the
vector, so fix that too.

The remainder of the series is about cleaning up locking, simplifying
the pfncache locking so that a recursive lock deadlock in the Xen code
can be eliminated (by virtue of the inner function not having to take
that lock at all any more). The final patch in the series is optional,
but probably worth doing anyway.

In moving the rwlock cleanup to be an optional patch at the end of the
series, I've reworked the commit messages so most of the lamentation
about the existing horridness, and the mention of the "bug that should
not happen", is in the simpler ->refresh_lock patch.

In v2 I rounded up the patches which were dropped from Paul's shared-info
series, to (cosmetically) split up kvm_xen_set_evtchn_fast() and then fix
the RT_PREEMPT locking issue. To address the concerns about fairness when
using read_trylock(), I've adjusted it to only do so from IRQ context, so
if it does fall back to the slow path it still takes the lock normally as
before.

David Woodhouse (6):
      KVM: x86/xen: improve accuracy of Xen timers
      KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled
      KVM: x86/xen: remove WARN_ON_ONCE() with false positives in evtchn delivery
      KVM: pfncache: simplify locking and make more self-contained
      KVM: x86/xen: fix recursive deadlock in timer injection
      KVM: pfncache: clean up rwlock abuse

Paul Durrant (2):
      KVM: x86/xen: split up kvm_xen_set_evtchn_fast()
      KVM: x86/xen: avoid blocking in hardirq context in kvm_xen_set_evtchn_fast()

 arch/x86/kvm/lapic.c |   5 +-
 arch/x86/kvm/x86.c   |  61 +++++++++-
 arch/x86/kvm/x86.h   |   1 +
 arch/x86/kvm/xen.c   | 327 +++++++++++++++++++++++++++++++++------------------
 arch/x86/kvm/xen.h   |  18 +++
 virt/kvm/pfncache.c  | 216 +++++++++++++++++-----------------
 6 files changed, 403 insertions(+), 225 deletions(-)


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

end of thread, other threads:[~2024-03-08 18:10 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 11:49 [PATCH v2 0/8] KVM: x86/xen updates David Woodhouse
2024-02-27 11:49 ` [PATCH v2 1/8] KVM: x86/xen: improve accuracy of Xen timers David Woodhouse
2024-03-04 23:44   ` Sean Christopherson
2024-03-05  9:29     ` Paul Durrant
2024-03-05 21:12       ` Sean Christopherson
2024-03-06  9:48         ` Paul Durrant
2024-03-06  9:57           ` David Woodhouse
2024-02-27 11:49 ` [PATCH v2 2/8] KVM: x86/xen: inject vCPU upcall vector when local APIC is enabled David Woodhouse
2024-02-27 11:49 ` [PATCH v2 3/8] KVM: x86/xen: remove WARN_ON_ONCE() with false positives in evtchn delivery David Woodhouse
2024-02-27 11:49 ` [PATCH v2 4/8] KVM: pfncache: simplify locking and make more self-contained David Woodhouse
2024-03-05  0:08   ` Sean Christopherson
2024-02-27 11:49 ` [PATCH v2 5/8] KVM: x86/xen: fix recursive deadlock in timer injection David Woodhouse
2024-02-27 11:49 ` [PATCH v2 6/8] KVM: x86/xen: split up kvm_xen_set_evtchn_fast() David Woodhouse
2024-02-27 11:49 ` [PATCH v2 7/8] KVM: x86/xen: avoid blocking in hardirq context in kvm_xen_set_evtchn_fast() David Woodhouse
2024-02-27 14:43   ` Steven Rostedt
2024-02-27 17:00     ` David Woodhouse
2024-02-27 17:18       ` Thomas Gleixner
2024-02-27 17:22         ` David Woodhouse
2024-03-07  9:27           ` David Woodhouse
2024-03-07 10:02             ` David Woodhouse
2024-02-27 17:25       ` Steven Rostedt
2024-02-27 17:28         ` David Woodhouse
2024-03-08 18:10     ` David Woodhouse
2024-02-27 11:49 ` [PATCH v2 8/8] KVM: pfncache: clean up rwlock abuse David Woodhouse
2024-02-29 23:12 ` [PATCH v2 0/8] KVM: x86/xen updates Sean Christopherson
2024-03-05  0:35 ` Sean Christopherson

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).