public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2]  KVM: x86: Include host suspended time in steal time
@ 2025-02-21  5:39 Suleiman Souhlal
  2025-02-21  5:39 ` [PATCH v4 1/2] KVM: x86: Advance guest TSC after deep suspend Suleiman Souhlal
  2025-02-21  5:39 ` [PATCH v4 2/2] KVM: x86: Include host suspended time in steal time Suleiman Souhlal
  0 siblings, 2 replies; 5+ messages in thread
From: Suleiman Souhlal @ 2025-02-21  5:39 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Chao Gao, David Woodhouse, Sergey Senozhatsky,
	kvm, linux-kernel, ssouhlal, Suleiman Souhlal

This series makes it so that the time that the host is suspended is
included in guests' steal time.

When the host resumes from a suspend, the guest thinks any task
that was running during the suspend ran for a long time, even though
the effective run time was much shorter, which can end up having
negative effects with scheduling.

To mitigate this issue, we include the time that the host was
suspended in steal time, which lets the guest can subtract the
duration from the tasks' runtime.

In addition, we make the guest TSC behavior consistent whether the
host TSC went backwards or not.

v4:
- Advance guest TSC on suspends where host TSC goes backwards.
- Block vCPUs from running until resume notifier.
- Move suspend duration accounting out of machine-independent kvm to
  x86.
- Merge code and documentation patches.
- Reworded documentation.

v3: https://lore.kernel.org/kvm/Z5AB-6bLRNLle27G@google.com/T/
- Use PM notifier instead of syscore ops (kvm_suspend()/kvm_resume()),
  because the latter doesn't get called on shallow suspend.
- Don't call function under UACCESS.
- Whitespace.

v2: https://lore.kernel.org/lkml/20241118043745.1857272-1-suleiman@google.com/
- Accumulate suspend time at machine-independent kvm layer and track per-VCPU
  instead of per-VM.
- Document changes.

v1: https://lore.kernel.org/kvm/20240710074410.770409-1-suleiman@google.com/


Suleiman Souhlal (2):
  KVM: x86: Advance guest TSC after deep suspend.
  KVM: x86: Include host suspended time in steal time

 Documentation/virt/kvm/x86/msr.rst |  9 +++-
 arch/x86/include/asm/kvm_host.h    |  7 +++
 arch/x86/kvm/x86.c                 | 84 +++++++++++++++++++++++++++++-
 3 files changed, 97 insertions(+), 3 deletions(-)

-- 
2.48.1.601.g30ceb7b040-goog


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

end of thread, other threads:[~2025-03-05  4:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-21  5:39 [PATCH v4 0/2] KVM: x86: Include host suspended time in steal time Suleiman Souhlal
2025-02-21  5:39 ` [PATCH v4 1/2] KVM: x86: Advance guest TSC after deep suspend Suleiman Souhlal
2025-02-21  5:39 ` [PATCH v4 2/2] KVM: x86: Include host suspended time in steal time Suleiman Souhlal
2025-03-01 17:21   ` Konrad Rzeszutek Wilk
2025-03-05  4:17     ` Suleiman Souhlal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox