archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <>
Cc:, Paul Mackerras <>,, Thomas Gleixner <>,
	Marc Zyngier <>,,
	Benjamin Herrenschmidt <>,
	"Michael S . Tsirkin" <>,
	Greg Kurz <>, Christoph Hellwig <>,
	Michael Ellerman <>,
	Laurent Vivier <>
Subject: [PATCH v2 0/2] powerpc/pseries: fix MSI/X IRQ affinity on pseries
Date: Wed, 25 Nov 2020 12:16:55 +0100	[thread overview]
Message-ID: <> (raw)

With virtio, in multiqueue case, each queue IRQ is normally\r
bound to a different CPU using the affinity mask.\r
This works fine on x86_64 but totally ignored on pseries.\r
This is not obvious at first look because irqbalance is doing\r
some balancing to improve that.\r
It appears that the "managed" flag set in the MSI entry\r
is never copied to the system IRQ entry.\r
This series passes the affinity mask from rtas_setup_msi_irqs()\r
to irq_domain_alloc_descs() by adding an affinity parameter to\r
The first patch adds the parameter (no functional change), the\r
second patch passes the actual affinity mask to irq_create_mapping()\r
in rtas_setup_msi_irqs().\r
For instance, with 32 CPUs VM and 32 queues virtio-scsi interface:\r
... -smp 32 -device virtio-scsi-pci,id=virtio_scsi_pci0,num_queues=32\r
for IRQ in $(grep virtio2-request /proc/interrupts |cut -d: -f1); do\r
    for file in /proc/irq/$IRQ/ ; do\r
        echo -n "IRQ: $(basename $file) CPU: " ; cat $file/smp_affinity_list\r
Without the patch (and without irqbalanced)\r
IRQ: 268 CPU: 0-31\r
IRQ: 269 CPU: 0-31\r
IRQ: 270 CPU: 0-31\r
IRQ: 271 CPU: 0-31\r
IRQ: 272 CPU: 0-31\r
IRQ: 273 CPU: 0-31\r
IRQ: 274 CPU: 0-31\r
IRQ: 275 CPU: 0-31\r
IRQ: 276 CPU: 0-31\r
IRQ: 277 CPU: 0-31\r
IRQ: 278 CPU: 0-31\r
IRQ: 279 CPU: 0-31\r
IRQ: 280 CPU: 0-31\r
IRQ: 281 CPU: 0-31\r
IRQ: 282 CPU: 0-31\r
IRQ: 283 CPU: 0-31\r
IRQ: 284 CPU: 0-31\r
IRQ: 285 CPU: 0-31\r
IRQ: 286 CPU: 0-31\r
IRQ: 287 CPU: 0-31\r
IRQ: 288 CPU: 0-31\r
IRQ: 289 CPU: 0-31\r
IRQ: 290 CPU: 0-31\r
IRQ: 291 CPU: 0-31\r
IRQ: 292 CPU: 0-31\r
IRQ: 293 CPU: 0-31\r
IRQ: 294 CPU: 0-31\r
IRQ: 295 CPU: 0-31\r
IRQ: 296 CPU: 0-31\r
IRQ: 297 CPU: 0-31\r
IRQ: 298 CPU: 0-31\r
IRQ: 299 CPU: 0-31\r
With the patch:\r
IRQ: 265 CPU: 0\r
IRQ: 266 CPU: 1\r
IRQ: 267 CPU: 2\r
IRQ: 268 CPU: 3\r
IRQ: 269 CPU: 4\r
IRQ: 270 CPU: 5\r
IRQ: 271 CPU: 6\r
IRQ: 272 CPU: 7\r
IRQ: 273 CPU: 8\r
IRQ: 274 CPU: 9\r
IRQ: 275 CPU: 10\r
IRQ: 276 CPU: 11\r
IRQ: 277 CPU: 12\r
IRQ: 278 CPU: 13\r
IRQ: 279 CPU: 14\r
IRQ: 280 CPU: 15\r
IRQ: 281 CPU: 16\r
IRQ: 282 CPU: 17\r
IRQ: 283 CPU: 18\r
IRQ: 284 CPU: 19\r
IRQ: 285 CPU: 20\r
IRQ: 286 CPU: 21\r
IRQ: 287 CPU: 22\r
IRQ: 288 CPU: 23\r
IRQ: 289 CPU: 24\r
IRQ: 290 CPU: 25\r
IRQ: 291 CPU: 26\r
IRQ: 292 CPU: 27\r
IRQ: 293 CPU: 28\r
IRQ: 294 CPU: 29\r
IRQ: 295 CPU: 30\r
IRQ: 299 CPU: 31\r
This matches what we have on an x86_64 system.\r
v2: add a wrapper around original irq_create_mapping() with the\r
    affinity parameter. Update comments\r
Laurent Vivier (2):\r
  genirq: add an irq_create_mapping_affinity() function\r
  powerpc/pseries: pass MSI affinity to irq_create_mapping()\r
 arch/powerpc/platforms/pseries/msi.c |  3 ++-\r
 include/linux/irqdomain.h            | 12 ++++++++++--\r
 kernel/irq/irqdomain.c               | 13 ++++++++-----\r
 3 files changed, 20 insertions(+), 8 deletions(-)\r
-- \r

             reply	other threads:[~2020-11-25 11:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 11:16 Laurent Vivier [this message]
2020-11-25 11:16 ` [PATCH v2 1/2] genirq: add an irq_create_mapping_affinity() function Laurent Vivier
2020-11-25 12:45   ` Greg Kurz
2020-11-25 13:20   ` Thomas Gleixner
2020-11-25 14:09     ` Laurent Vivier
2020-11-25 14:54       ` Marc Zyngier
2020-11-25 15:00         ` Laurent Vivier
2020-11-25 11:16 ` [PATCH v2 2/2] powerpc/pseries: pass MSI affinity to irq_create_mapping() Laurent Vivier
2020-11-25 12:51   ` Greg Kurz

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v2 0/2] powerpc/pseries: fix MSI/X IRQ affinity on pseries' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).