public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] KVM: x86: Include host suspended time in steal time.
@ 2025-01-07  4:21 Suleiman Souhlal
  2025-01-07  4:21 ` [PATCH v3 1/3] kvm: Introduce kvm_total_suspend_ns() Suleiman Souhlal
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Suleiman Souhlal @ 2025-01-07  4:21 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, 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. This can be particularly noticeable
if the guest task was RT, as it can end up getting throttled for a
long time.

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.

v3:
- 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 (3):
  kvm: Introduce kvm_total_suspend_ns().
  KVM: x86: Include host suspended time in steal time.
  KVM: x86: Document host suspend being included in steal time.

 Documentation/virt/kvm/x86/msr.rst |  6 ++++--
 arch/x86/include/asm/kvm_host.h    |  1 +
 arch/x86/kvm/x86.c                 | 11 ++++++++++-
 include/linux/kvm_host.h           |  2 ++
 virt/kvm/kvm_main.c                | 26 ++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 3 deletions(-)

-- 
2.47.1.613.gc27f4b7a9f-goog


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

end of thread, other threads:[~2025-02-13  3:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07  4:21 [PATCH v3 0/3] KVM: x86: Include host suspended time in steal time Suleiman Souhlal
2025-01-07  4:21 ` [PATCH v3 1/3] kvm: Introduce kvm_total_suspend_ns() Suleiman Souhlal
2025-01-07 15:27   ` Sean Christopherson
2025-01-07 16:43     ` Suleiman Souhlal
2025-01-08  7:15   ` kernel test robot
2025-01-08  8:36   ` kernel test robot
2025-01-15 21:49   ` Sean Christopherson
2025-01-17  6:35     ` Suleiman Souhlal
2025-01-17 16:52       ` Sean Christopherson
2025-01-21  5:37         ` Suleiman Souhlal
2025-01-21 20:22           ` Sean Christopherson
2025-02-04  7:58             ` Suleiman Souhlal
2025-02-05  5:55               ` Suleiman Souhlal
2025-02-06  1:29                 ` Sean Christopherson
2025-02-13  3:56                   ` Suleiman Souhlal
2025-01-07  4:22 ` [PATCH v3 2/3] KVM: x86: Include host suspended time in steal time Suleiman Souhlal
2025-01-07 15:37   ` Sean Christopherson
2025-01-08  4:05     ` Suleiman Souhlal
2025-01-08 15:17       ` Sean Christopherson
2025-01-07  4:22 ` [PATCH v3 3/3] KVM: x86: Document host suspend being included " Suleiman Souhlal
2025-01-07 15:37   ` Sean Christopherson

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