From: "Michael S. Tsirkin" <mst@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Angus Chen <angus.chen@jaguarmicro.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Ming Lei <ming.lei@redhat.com>, Jason Wang <jasowang@redhat.com>
Subject: Re: IRQ affinity problem from virtio_blk
Date: Tue, 15 Nov 2022 18:36:51 -0500 [thread overview]
Message-ID: <20221115183339-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <87o7t7rec7.ffs@tglx>
On Wed, Nov 16, 2022 at 12:24:24AM +0100, Thomas Gleixner wrote:
> On Wed, Nov 16 2022 at 00:04, Thomas Gleixner wrote:
>
> > On Tue, Nov 15 2022 at 17:44, Michael S. Tsirkin wrote:
> >> On Tue, Nov 15, 2022 at 11:19:47PM +0100, Thomas Gleixner wrote:
> >>> > We can see global_available drop from 15354 to 15273, is 81.
> >>> > And the total_allocated increase from 411 to 413. One config irq,and
> >>> > one vq irq.
> >>>
> >>> Right. That's perfectly fine. At the point where you looking at it, the
> >>> matrix allocator has given out 2 vectors as can be seen via
> >>> total_allocated.
> >>>
> >>> But then it also has another 79 vectors put aside for the other queues,
> >>
> >> What makes it put these vectors aside? pci_alloc_irq_vectors_affinity ?
> >
> > init_vq() -> virtio_find_vqs() -> vp_find_vqs() ->
> > vp_request_msix_vectors() -> pci_alloc_irq_vectors_affinity()
> >
> > init_vq() hands in a struct irq_affinity which means that
> > pci_alloc_irq_vectors_affinity() will spread out interrupts and have one
> > for config and one per queue if vp_request_msix_vectors() is invoked
> > with per_vq_vectors == true, which is what the first invocation in
> > vp_find_vqs() does.
>
> I just checked on a random VM. The PCI device as advertised to the guest
> does not expose that many vectors. One has 2 and the other 4.
>
> But as the interrupts are requested 'managed' the core ends up setting
> the vectors aside. That's a fundamental property of managed interrupts.
>
> Assume you have less queues than CPUs, which is the case with 2 vectors
> and tons of CPUs, i.e. one ends up for config and the other for the
> actual queue. So the affinity spreading code will end up having the full
> cpumask for the queue vector, which is marked managed. And managed means
> that it's guaranteed e.g. in the CPU hotplug case that the interrupt can
> be migrated to a still online CPU.
>
> So we end up setting 79 vectors aside (one per CPU) in the case that the
> virtio device only provides two vectors.
>
> But that's not the end of the world as you really would need ~200 such
> devices to exhaust the vector space...
>
> Thanks,
>
> tglx
Let's say we have 20 queues - then just 10 devices will exhaust the
vector space right?
--
MST
next prev parent reply other threads:[~2022-11-15 23:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 3:40 IRQ affinity problem from virtio_blk Angus Chen
2022-11-15 22:19 ` Thomas Gleixner
2022-11-15 22:44 ` Michael S. Tsirkin
2022-11-15 23:04 ` Thomas Gleixner
2022-11-15 23:24 ` Thomas Gleixner
2022-11-15 23:36 ` Michael S. Tsirkin [this message]
2022-11-16 1:02 ` Angus Chen
2022-11-16 10:55 ` Thomas Gleixner
2022-11-16 11:24 ` Angus Chen
2022-11-16 13:27 ` Thomas Gleixner
2022-11-16 10:43 ` Thomas Gleixner
2022-11-16 11:35 ` Ming Lei
2022-11-16 13:06 ` Thomas Gleixner
2022-11-16 0:46 ` Angus Chen
2022-11-16 10:54 ` Thomas Gleixner
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=20221115183339-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=angus.chen@jaguarmicro.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=tglx@linutronix.de \
/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