[lkml]   [2009]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Reworking suspend-resume sequence (was: Re: PCI PM: Restore standard config registers of all devices early)

* Linus Torvalds <> wrote:

> So I wouldn't worry too much. I think this is interesting mostly from a
> performance standpoint - MSI interrupts are supposed to be fast, and under
> heavy interrupt load I could easily see something like
> - cpu1: handles interrupt, has acked it, calls down to the handler
> - the handler clears the original irq source, but another packet (or disk
> completion) happens almost immediately
> - cpu2 takes the second interrupt, but it's still IRQ_INPROGRESS, so it
> masks.
> - cpu1 gets back and unmasks etc and now really handles it because of
> Note how the mask/unmask were all just costly extra overhead over the PCI
> bus. If we're talking something like high-performance 10Gbit ethernet (or
> even maybe fast SSD disks), driver writers actually do count PCI cycles,
> because a single PCI read can be several hundred ns, and if you take a
> thousand interrupts per second, it does add up.

In practice MSI (and in particular MSI-X) irq sources tend to be bound to a
single CPU on modern x86 hardware. The kernel does not do IRQ balancing
anymore, nor does the hardware. We have a slow irq-balancer daemon
(irqbalanced) in user-space. So singular IRQ sources, especially when they
are MSI, tend to be 99.9% on the same CPU. Changing affinity is possible and
has to always work reliably, but it is a performance slowpath.

An increasing trend is to have multiple irqs per device (multiple descriptor
rings, split rx and tx rings with separate irq sources): and each IRQ can
get balanced to a separate CPU. But those irqs cannot interact on a ->mask()
level as each IRQ has its separate irq_desc.

The most advanced way of balancing IRQs is not widespread yet: it is where
devices actually interpret the payload and send completions dynamically to
differing CPUs - depending on things like the TCP/IP hash value or a
in-descriptor "target CPU". That way we could get completion on the CPU
where the work was submitted from. (and where the data structures are the
most cache-localized)

That principle works both for networking and for other IO transports - but
we have little support for it yet. It would work really well for workloads
where one physical device is shared by many CPUs.

(A lesser method that approximates this is the use of lots of
submission/completion rings per device and their binding to cpus - but that
can never really approach the number of CPUs really possible in a system.)

And in this most advanced mode of MSI IRQs, and if MSI devices had the
ability to direct IRQs to a specific CPU (they dont have that right now
AFAICT), we'd run into the overhead scenarios you describe above, and your
edge-triggered flow is the most performant one.


 \ /
  Last update: 2009-02-03 22:01    [W:0.133 / U:2.612 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site