Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] RISC-V: KVM: Lessen steal time update overhead
@ 2026-11-18  6:22 Koichiro Den
  2026-11-18  6:22 ` [PATCH 1/2] RISC-V: KVM: Batch user accesses when updating steal time Koichiro Den
  2026-11-18  6:22 ` [PATCH 2/2] RISC-V: KVM: Skip steal-time updates when run_delay is unchanged Koichiro Den
  0 siblings, 2 replies; 7+ messages in thread
From: Koichiro Den @ 2026-11-18  6:22 UTC (permalink / raw)
  To: Anup Patel, Atish Patra
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Bingyu Xian, kvm, kvm-riscv, linux-riscv, linux-kernel

Hi,

For guests that register an SBI STA shared-memory area, this small patch
set reduces update overhead by batching user accesses and also skipping
updates when run_delay is unchanged.

Tested on SpacemiT K3:
The benchmark uses KVM selftest helpers. The guest registers its STA
shared memory and calls GUEST_UCALL_NONE() in a loop. The vCPU thread is
pinned to one host CPU and re-enters KVM_RUN after each exit.

The table shows the median vCPU thread CPU time per round trip (from
host userspace to the guest and back), measured with
CLOCK_THREAD_CPUTIME_ID. Each case has five runs of 1,000,000
iterations, preceded by 10,000 warm-up iterations per run.
Below, "contended" adds a busy loop on that CPU.

                Before      After
  ------------  ----------  -------------------
  uncontended   2966.51 ns  2703.26 ns (-8.87%)
  contended     2973.46 ns  2717.72 ns (-8.60%)

Based off of riscv_kvm_next, commit e9bf49bbc422 ("RISC-V: KVM: Fix
G-stage page table memory leak on VM destroy")

Best regards,
Koichiro Den


Koichiro Den (2):
  RISC-V: KVM: Batch user accesses when updating steal time
  RISC-V: KVM: Skip steal-time updates when run_delay is unchanged

 arch/riscv/kvm/vcpu_sbi_sta.c | 61 +++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 24 deletions(-)


base-commit: e9bf49bbc4227048685c78f97e1446845760df4f
-- 
2.54.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2026-11-20 17:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18  6:22 [PATCH 0/2] RISC-V: KVM: Lessen steal time update overhead Koichiro Den
2026-11-18  6:22 ` [PATCH 1/2] RISC-V: KVM: Batch user accesses when updating steal time Koichiro Den
2026-11-20 16:40   ` Andrew Jones
2026-11-20 17:20     ` Koichiro Den
2026-11-18  6:22 ` [PATCH 2/2] RISC-V: KVM: Skip steal-time updates when run_delay is unchanged Koichiro Den
2026-11-20 16:45   ` Andrew Jones
2026-11-20 17:25     ` Koichiro Den

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