irqbypass: Cleanups and a perf improvement
Status from this message: Applied to kvm-x86 irqs, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest8 patches 5 repliesApplied
- v17 patches 15 repliesSuperseded
Changes in v2 from the cover letter
- Collect reviews. [Kevin, Michael]
- Track the pointer as "struct eventfd_ctx *eventfd" instead of "void *token". [Alex]
- Fix typos and stale comments. [Kevin, Binbin]
- Use "trigger" instead of the null token/eventfd pointer on failure in vfio_msi_set_vector_signal(). [Kevin]
- Drop a redundant "tmp == consumer" check from patch 3. [Kevin]
- Require producers to pass in the line IRQ number.
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | irqbypass: Drop pointless and misleading THIS_MODULE get/putvirt/ | +0 | 0 replies | |
| 2/8 | irqbypass: Drop superfluous might_sleep() annotationsvirt/ | +0 | 0 replies | |
| 3/8 | irqbypass: Take ownership of producer/consumer token trackingarch/ drivers/ drivers/ +3 more | +58 | 0 replies | |
| 4/8 | irqbypass: Explicitly track producer and consumer bindingsinclude/ virt/ | +16 | 0 replies | |
| 5/8 | irqbypass: Use paired consumer/producer to disconnect during unregistervirt/ | +8 | 0 replies | |
| 6/8 | irqbypass: Use guard(mutex) in lieu of manual lock+unlockvirt/ | +10 | 0 replies | |
| 7/8 | irqbypass: Use xarray to track producers and consumersinclude/ virt/ | +38 | 0 replies | |
| 8/8 | irqbypass: Require producers to pass in Linux IRQ number during registrationdrivers/ drivers/ include/ +1 more | +8 | 1 reply |
Reviews trailers per patch
All 8 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Kevin Tian | Michael S. Tsirkin | Alex Williamson |
|---|---|---|---|
| Series | A-b | R-b | |
| 1/8 | R-b | A-b | |
| 2/8 | R-b | A-b | |
| 3/8 | R-b | A-b | |
| 4/8 | R-b | A-b | |
| 5/8 | R-b | A-b | |
| 6/8 | R-b | A-b | |
| 7/8 | R-b | A-b | |
| 8/8 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v2 0/8] irqbypass: Cleanups and a perf improvement
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.
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. And KVM shold probably have a KVM_IRQFD_FLAG_NO_IRQBYPASS if a VM is never going to use device posted interrupts. But those are future problems.
v2:
- Collect reviews. [Kevin, Michael]
- Track the pointer as "struct eventfd_ctx *eventfd" instead of "void *token". [Alex]
- Fix typos and stale comments. [Kevin, Binbin]
- Use "trigger" instead of the null token/eventfd pointer on failure in vfio_msi_set_vector_signal(). [Kevin]
- Drop a redundant "tmp == consumer" check from patch 3. [Kevin]
- Require producers to pass in the line IRQ number.
v1: https://lore.kernel.org/all/[email protected]
[1] https://lore.kernel.org/all/[email protected]
[2] https://lore.kernel.org/all/[email protected]
Sean Christopherson (8):
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
irqbypass: Require producers to pass in Linux IRQ number during
registration
arch/x86/kvm/x86.c | 4 +- drivers/vfio/pci/vfio_pci_intrs.c | 10 +- drivers/vhost/vdpa.c | 10 +- include/linux/irqbypass.h | 46 ++++---- virt/kvm/eventfd.c | 7 +- virt/lib/irqbypass.c | 190 +++++++++++------------------- 6 files changed, 107 insertions(+), 160 deletions(-)
base-commit: 7ef51a41466bc846ad794d505e2e34ff97157f7f
Signature · 1 line
2.49.0.1112.g889b7c5bd8-goog