Linux USB
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: raoxu <raoxu@uniontech.com>
Cc: kenny@panix.com, linux-usb@vger.kernel.org,
	mathias.nyman@linux.intel.com, michal.pecio@gmail.com,
	niklas.neronin@linux.intel.com, zhanjun@uniontech.com
Subject: Re: [PATCH v10 2/2] usb: xhci: enable secondary interrupters and route
Date: Mon, 26 Jan 2026 10:10:02 +0100	[thread overview]
Message-ID: <2026012644-chute-gangly-9b7b@gregkh> (raw)
In-Reply-To: <1FCECDEA86461C52+20260126085828.803972-1-raoxu@uniontech.com>

On Mon, Jan 26, 2026 at 04:58:28PM +0800, raoxu wrote:
> Some xHCI hosts expose multiple MSI/MSI-X vectors and support multiple
> interrupters with independent event rings, but Linux commonly routes all
> transfer completions through interrupter 0.
> 
> Allocate a small capped set of secondary interrupters in xhci_mem_init()
> (MAX_SECONDARY_INTRNUM, default 4) and request up to the matching number
> of IRQ vectors (bounded by what PCI core provides).  Dispatch each vector
> to its interrupter via the per-vector irq_ctx.
> 
> Route transfers per USB device (slot) by assigning vdev->interrupter at
> device allocation time and programming the interrupter target (slot
> context + TRB_INTR_TARGET) from that selection, so completions land on the
> selected event ring.  Drain a slot's secondary event ring at selected
> command completion boundaries to reduce late-event artifacts when teardown
> happens on interrupter 0.

This all says what is happening, but not why.  Why does it matter to
spread out the interrupts?  What is the downside of not doing so?  What
is the benifit of doing so?  What benchmarks or real tests show any
changes at all here?

Given that the USB data path is very slow, because the hardware is slow,
moving interrupts around to other processors feels like an odd thing to
do as it's normally only done for busses that have real data throughput
needs (i.e. keep the irqs next to the cpus where the data is being
processed, like the networking stack does).  For USB this feels odd as
once the data is handled by the host controller driver, the cpu affinity
is totally lost so any benifit you were expecting from spreading
interrupts out is lost.

So again, why is any of this needed at all?  What hardware and workloads
actually matter here?

thanks,

greg k-h

  reply	other threads:[~2026-01-26  9:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-26  8:55 [PATCH v10 0/2] usb:xhc:route device to secondary interrupters raoxu
2026-01-26  8:58 ` [PATCH v10 1/2] usb: xhci: refactor IRQ/interrupter plumbing for raoxu
2026-01-26  9:06   ` Greg KH
2026-01-26  8:58 ` [PATCH v10 2/2] usb: xhci: enable secondary interrupters and route raoxu
2026-01-26  9:10   ` Greg KH [this message]
2026-01-26 14:49   ` kernel test robot

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=2026012644-chute-gangly-9b7b@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=kenny@panix.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=michal.pecio@gmail.com \
    --cc=niklas.neronin@linux.intel.com \
    --cc=raoxu@uniontech.com \
    --cc=zhanjun@uniontech.com \
    /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