Skip to content

kvm: set irq affinity for assigned devices

Michael S. Tsirkin kvm lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesNew
  2. v1 RFC2 patches 12 repliesSuperseded

Changes from v1 from the cover letter

Address comments by Alex Williamson and Marcelo Tosatti:
- Fold in v2 patch from [email protected]:
fix affinity for lowest priority setups,
- Disable automatic affinity for round robin setups.
- Fix compiler warnings.
- Fix a checkpatch warning.
- Clear hint before free irq for MSI/INTx.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kvm: pass host irq number to set irq callsarch/x86/kvm/i8254.c arch/x86/kvm/lapic.c arch/x86/kvm/x86.c +6 more+29 -230 replies
2/2kvm: set affinity hint for assigned device msivirt/kvm/assigned-dev.c virt/kvm/irq_comm.c+28 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCHv3 0/2] kvm: set irq affinity for assigned devices

To forward an interrupt to a vcpu that runs on a host cpu different from the current one,
we need an ipi which likely will cost us as much as delivering the interrupt directly to that cpu would.

So it seems to make sense to set irq affinity hint to point there, irq balancer can then take this into accound and balance interrupts accordingly.

This is what this patchset does.
Note: it might make sense to optimize the gsi lookups here for the msi case, using rcu, the way we did for eventfd. But that's a subject for another patch.

Testing shows that with irqbalance running this performs basically the same as manual numa pinning.

This patch applies to 3.2 or linux-next.

Changes from v1:
Address comments by Alex Williamson and Marcelo Tosatti:
- Fold in v2 patch from [email protected]:
fix affinity for lowest priority setups,
- Disable automatic affinity for round robin setups.
- Fix compiler warnings.
- Fix a checkpatch warning.
- Clear hint before free irq for MSI/INTx.

Michael S. Tsirkin (2):
kvm: pass host irq number to set irq calls
kvm: set affinity hint for assigned device msi

 arch/x86/kvm/i8254.c     |    4 ++--
 arch/x86/kvm/lapic.c     |    2 +-
 arch/x86/kvm/x86.c       |    2 +-
 include/linux/kvm_host.h |    7 ++++---
 virt/kvm/assigned-dev.c  |   14 +++++++++-----
 virt/kvm/eventfd.c       |    7 ++++---
 virt/kvm/ioapic.c        |    2 +-
 virt/kvm/ioapic.h        |    2 +-
 virt/kvm/irq_comm.c      |   43 ++++++++++++++++++++++++++++++++++---------
 9 files changed, 57 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.8.2.325.g247f9