From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Jason Wang <jasowang@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Alex Williamson <alex.williamson@redhat.com>,
kvm@vger.kernel.org, virtualization@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Oliver Upton <oliver.upton@linux.dev>,
David Matlack <dmatlack@google.com>,
Like Xu <like.xu.linux@gmail.com>,
Yong He <alexyonghe@tencent.com>
Subject: Re: [PATCH 0/7] irqbypass: Cleanups and a perf improvement
Date: Tue, 8 Apr 2025 07:49:39 -0400 [thread overview]
Message-ID: <20250408074907-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250404211449.1443336-1-seanjc@google.com>
On Fri, Apr 04, 2025 at 02:14:42PM -0700, Sean Christopherson wrote:
> The two primary goals of this series are to make the irqbypass concept
> easier to understand, and to address the terrible performance that can
> result from using a list to track connections.
>
> For the first goal, track the producer/consumer "tokens" as eventfd context
> pointers instead of opaque "void *". Supporting arbitrary token types was
> dead infrastructure when it was added 10 years ago, and nothing has changed
> since. Taking an opaque token makes a *very* simple concept (device signals
> eventfd; KVM listens to eventfd) unnecessarily difficult to understand.
>
> Burying that simple behind a layer of obfuscation also makes the overall
> code more brittle, as callers can pass in literally anything. I.e. passing
> in a token that will never be paired would go unnoticed.
>
> For the performance issue, use an xarray. I'm definitely not wedded to an
> xarray, but IMO it doesn't add meaningful complexity (even requires less
> code), and pretty much Just Works. Like tried this a while back[1], but
> the implementation had undesirable behavior changes and stalled out.
>
> To address the use case where huge numbers of VMs are being created without
> _any_ possibility for irqbypass, KVM should probably add a
> KVM_IRQFD_FLAG_NO_IRQBYPASS flag so that userspace can opt-out on a per-IRQ
> basis. I already proposed a KVM module param[2] to let userspace disable
> IRQ bypass, but that obviously affects all IRQs in all VMs. It might
> suffice for most use cases, but I can imagine scenarios where the VMM wants
> to be more selective, e.g. when it *knows* a KVM_IRQFD isn't eligible for
> bypass. And both of those require userspace changes.
>
> Note, I want to do more aggressive cleanups of irqbypass at some point,
> e.g. not reporting an error to userspace if connect() fails is *awful*
> behavior for environments that want/need irqbypass to always work. But
> that's a future problem.
>
> [1] https://lore.kernel.org/all/20230801115646.33990-1-likexu@tencent.com
> [2] https://lore.kernel.org/all/20250401161804.842968-1-seanjc@google.com
vdpa changes seem minor, so
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> Sean Christopherson (7):
> irqbypass: Drop pointless and misleading THIS_MODULE get/put
> irqbypass: Drop superfluous might_sleep() annotations
> irqbypass: Take ownership of producer/consumer token tracking
> irqbypass: Explicitly track producer and consumer bindings
> irqbypass: Use paired consumer/producer to disconnect during
> unregister
> irqbypass: Use guard(mutex) in lieu of manual lock+unlock
> irqbypass: Use xarray to track producers and consumers
>
> drivers/vfio/pci/vfio_pci_intrs.c | 5 +-
> drivers/vhost/vdpa.c | 4 +-
> include/linux/irqbypass.h | 38 +++---
> virt/kvm/eventfd.c | 3 +-
> virt/lib/irqbypass.c | 185 ++++++++++--------------------
> 5 files changed, 88 insertions(+), 147 deletions(-)
>
>
> base-commit: 782f9feaa9517caf33186dcdd6b50a8f770ed29b
> --
> 2.49.0.504.g3bcea36a83-goog
prev parent reply other threads:[~2025-04-08 11:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 21:14 [PATCH 0/7] irqbypass: Cleanups and a perf improvement Sean Christopherson
2025-04-04 21:14 ` [PATCH 1/7] irqbypass: Drop pointless and misleading THIS_MODULE get/put Sean Christopherson
2025-04-10 7:12 ` Tian, Kevin
2025-04-04 21:14 ` [PATCH 2/7] irqbypass: Drop superfluous might_sleep() annotations Sean Christopherson
2025-04-10 7:13 ` Tian, Kevin
2025-04-04 21:14 ` [PATCH 3/7] irqbypass: Take ownership of producer/consumer token tracking Sean Christopherson
2025-04-10 7:28 ` Tian, Kevin
2025-04-10 15:51 ` Sean Christopherson
2025-04-10 21:28 ` Alex Williamson
2025-04-10 22:04 ` Sean Christopherson
2025-04-10 22:25 ` Alex Williamson
2025-04-04 21:14 ` [PATCH 4/7] irqbypass: Explicitly track producer and consumer bindings Sean Christopherson
2025-04-10 7:32 ` Tian, Kevin
2025-04-04 21:14 ` [PATCH 5/7] irqbypass: Use paired consumer/producer to disconnect during unregister Sean Christopherson
2025-04-10 7:34 ` Tian, Kevin
2025-04-04 21:14 ` [PATCH 6/7] irqbypass: Use guard(mutex) in lieu of manual lock+unlock Sean Christopherson
2025-04-10 7:34 ` Tian, Kevin
2025-04-04 21:14 ` [PATCH 7/7] irqbypass: Use xarray to track producers and consumers Sean Christopherson
2025-04-07 3:37 ` Binbin Wu
2025-04-10 7:38 ` Tian, Kevin
2025-04-10 14:52 ` Sean Christopherson
2025-04-11 0:09 ` Tian, Kevin
2025-04-08 11:49 ` Michael S. Tsirkin [this message]
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=20250408074907-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=alexyonghe@tencent.com \
--cc=dmatlack@google.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=like.xu.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=virtualization@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.