mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunwu Chan <kunwu.chan@gmail.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Kunwu Chan <kunwu.chan@gmail.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	rcu@vger.kernel.org, pbonzini@redhat.com, seanjc@google.com,
	paul@xen.org, paulmck@kernel.org, kunwu.chan@linux.dev,
	nh-open-source@amazon.com
Subject: Re: [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting
Date: Wed, 23 Sep 2026 17:54:33 +0800	[thread overview]
Message-ID: <20260923095435.591542-1-kunwu.chan@gmail.com> (raw)
In-Reply-To: <84e1f6c28becdf94ccb72f5c64c0001768167fc2.camel@infradead.org>

On Tue, 22 Sep 2026 12:37:43 +0200 David Woodhouse <dwmw2@infradead.org> wrote:

> On Tue, 2026-09-22 at 11:16 +0800, KunWu Chan wrote:
> > Do you happen to have any numbers comparing the GPC invalidation
> > latency with regular SRCU vs. `synchronize_srcu_atomic()`? If there
> > are also numbers with the reader-free fastpath, that would be useful
> > for understanding its impact as well.
> 
> Yeah, I built some latency tests and was posting results in the earlier
> thread¹, on a few different test hosts.
> 
> I compared against the existing rwlock, as well as SRCU both with and
> without the try_synchronize_srcu() fast path. Mostly looking at the
> invalidation latency, since that was Sean's stated concern with the
> original RCU-based proof of concept.
> 
> All from the same test: 12 concurrent guest-memory invalidation
> reproducers hammering the Xen shinfo/vcpu_info caches, 300 second
> windows, measuring the invalidation drain end-to-end.
> 
> 192-way Granite Rapids, PREEMPT_RT production config:
> 
>   rwlock (before this series)              avg  4.4µs   max 3.85ms
>   synchronize_srcu_expedited() drain       avg  8.6µs   max 810µs
>   synchronize_srcu_atomic() + fastpath     avg  ~3µs    max 801µs
> 
> The A/B numbers I have for the reader-free fast path were on different
> hardware (128-way Ice Lake, production-like config):
> 
>   synchronize_srcu_atomic(), no fastpath   avg 8.0µs   max 6.0ms
>   with the inline no-readers proof         avg 3.6µs   max 326µs
> 
> If you want, it isn't much effort for me to tell my friend to redo any
> of the measurements.
> 
> ¹ https://lore.kernel.org/all/0d4af6318ac67486858be1df8d436147b444a2d2.camel@infradead.org/
> 

Hi David,

Thanks, this is very helpful. I've put the results together below.

KVM GPC invalidation drain latency

128-way Ice Lake:
┌──────────────────────────────────┬──────────────┬──────────────┐
│ Implementation                   │ Avg          │ Max          │
├──────────────────────────────────┼──────────────┼──────────────┤
│ Baseline (rwlock)                │ not provided │ not provided │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_expedited()     │ not provided │ not provided │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_atomic()        │ 8.0us        │ 6.0ms        │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_atomic() +      │ 3.6us        │ 326us        │
│   reader-free fastpath           │              │              │
└──────────────────────────────────┴──────────────┴──────────────┘

192-way Granite Rapids:
┌──────────────────────────────────┬──────────────┬──────────────┐
│ Implementation                   │ Avg          │ Max          │
├──────────────────────────────────┼──────────────┼──────────────┤
│ Baseline (rwlock)                │ 4.4us        │ 3.85ms       │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_expedited()     │ 8.6us        │ 810us        │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_atomic()        │ not provided │ not provided │
├──────────────────────────────────┼──────────────┼──────────────┤
│ synchronize_srcu_atomic() +      │ ~3us         │ 801us        │
│   reader-free fastpath           │              │              │
└──────────────────────────────────┴──────────────┴──────────────┘
Note: Avg / Max are the average and maximum end-to-end invalidation drain latency.
The measurements use 12 concurrent guest-memory invalidation reproducers 
hammering the Xen shinfo/vcpu_info caches over 300-second windows.

On the 128-way Ice Lake system, the reader-free fastpath reduces the
average latency from 8.0us to 3.6us, and the maximum from 6.0ms to
326us.

The 192-way Granite Rapids result is from a separate hardware
configuration, so I kept it separate from the 128-way A/B comparison.

The only missing comparison is the 192-way Granite Rapids result for
synchronize_srcu_atomic() without the reader-free fastpath. If you
already have that result, it would be useful to add it. No need to
rerun the measurement just for this table if you don't have it.

Could you please confirm that I transcribed the numbers correctly?

Thanks,
Kunwu


  reply	other threads:[~2026-09-23  9:54 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 20:49 David Woodhouse
2026-09-20 20:49 ` [PATCH 01/17] KVM: pfncache: Use atomic SRCU for readers instead of a rwlock David Woodhouse
2026-09-20 21:55   ` sashiko-bot
2026-09-21  1:42   ` Hillf Danton
2026-09-21  9:54     ` David Woodhouse
2026-09-21 11:21       ` Hillf Danton
2026-09-21 11:29         ` Paolo Bonzini
2026-09-20 20:49 ` [PATCH 02/17] KVM: x86/xen: Extract delivery of event to vCPU into a separate helper David Woodhouse
2026-09-20 20:49 ` [PATCH 03/17] KVM: x86/xen: Explicitly tag "shared info" page as never being dirty tracked David Woodhouse
2026-09-20 20:49 ` [PATCH 04/17] KVM: x86/xen: Don't dirty track "vCPU info" page David Woodhouse
2026-09-20 20:49 ` [PATCH 05/17] KVM: x86: Request the guest TLB flush from record_steal_time() David Woodhouse
2026-09-20 20:49 ` [PATCH 06/17] KVM: x86: Use gfn_to_pfn_cache for steal time / preempted status David Woodhouse
2026-09-20 22:06   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 07/17] KVM: pfncache: Add guest-mode pinning (GUEST_USES_PFN successor) David Woodhouse
2026-09-20 21:53   ` sashiko-bot
2026-09-21 14:17     ` David Woodhouse
2026-09-20 20:49 ` [PATCH 08/17] KVM: pfncache: Return -EAGAIN for a lookup which hits an invalid memslot David Woodhouse
2026-09-20 21:53   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 09/17] KVM: x86: Post KVM_REQ_GET_NESTED_STATE_PAGES on memslot updates David Woodhouse
2026-09-20 20:49 ` [PATCH 10/17] KVM: nVMX: Implement cache for L1 MSR bitmap David Woodhouse
2026-09-20 21:56   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 11/17] KVM: nVMX: Use pinned pfncache for L1 APIC virtualization pages David Woodhouse
2026-09-20 21:57   ` sashiko-bot
2026-09-21 14:31     ` David Woodhouse
2026-09-20 20:49 ` [PATCH 12/17] KVM: selftests: Add nested VMX APIC cache invalidation test David Woodhouse
2026-09-20 21:51   ` sashiko-bot
2026-09-20 20:49 ` [PATCH 13/17] KVM: x86: Move nested GPC lock helpers to x86.h as kvm_gpc_lock_page() David Woodhouse
2026-09-20 20:49 ` [PATCH 14/17] KVM: nSVM: Use a gfn_to_pfn_cache for the vmcb12 page David Woodhouse
2026-09-20 20:49 ` [PATCH 15/17] KVM: nSVM: Cache L1's MSR permissions map pages David Woodhouse
2026-09-20 20:49 ` [PATCH 16/17] KVM: nSVM: Cache L1's IO " David Woodhouse
2026-09-20 20:49 ` [PATCH 17/17] KVM: selftests: Add nested transition benchmark David Woodhouse
2026-09-20 21:52   ` sashiko-bot
2026-09-21 14:10 ` [PATCH 00/17] KVM: Use atomic SRCU for gfn-to-pfn cache, reinstate guest mode for x86 nesting David Woodhouse
2026-09-22  3:16 ` KunWu Chan
2026-09-22 10:37   ` David Woodhouse
2026-09-23  9:54     ` Kunwu Chan [this message]
2026-09-23 12:05       ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923095435.591542-1-kunwu.chan@gmail.com \
    --to=kunwu.chan@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kunwu.chan@linux.dev \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nh-open-source@amazon.com \
    --cc=paul@xen.org \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rcu@vger.kernel.org \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®