public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Rene Herman <rene.herman@keyaccess.nl>,
	Adrian Bunk <bunk@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	rmk@arm.linux.org.uk, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: MSI, fun for the whole family
Date: Thu, 24 Apr 2008 20:57:48 -0700	[thread overview]
Message-ID: <adaiqy67fib.fsf@cisco.com> (raw)
In-Reply-To: <481150EE.3040103@garzik.org> (Jeff Garzik's message of "Thu, 24 Apr 2008 23:33:02 -0400")

 > > To my knowledge there is not any information that varies each time an
 > > interrupt fires.
 > 
 > Absolutely there is!  This is why MSI is so cool.
 > 
 > You get a tiny chunk of data from the hardware, across the PCI bus in
 > a single PCI transaction, sent [well, basically...] straight to the
 > driver __for each MSI interrupt__.  Rather than having a separate
 > interrupt line -- really an ugly OOB mechanism -- you get a bus
 > transaction as God intended, a bus transaction just like all the
 > others going across the PCI bus.

I think you've fundamentally misunderstood what the PCI spec for MSI
multi message means.  It is true that if the whole system agrees, then
an MSI-capable device that supports multiple messages might be allocated
a range of vectors (MSI is kind of stupid because it only allows
multiple messages to be generated by varying the low order bits -- MSI-X
fixes this limitation).  However, the way that these different messages
are handled is that they are all independent interrupt vectors.

Now, it is true that the kernel could do something crazy and collapse
all these interrupt vectors into a single "IRQ" and then tell the
interrupt handler which vector it was by passing some "metadata" in, but
why not just give each MSI message it's own IRQ?

By the way, for MSI on Linux this is theoretical, since MSI messages
have to be consecutive, and the kernel (on standard x86 at least) can't
really allocate a chunk of consecutive vectors.  However, Linux has
quite a few device drivers that handle devices that generate multiple
MSI-X messages, and the model of having each message be a different IRQ
works quite well.

You are correct that MSI/MSI-X has the advantage of being an in-band
transaction that obeys PCI ordering rules, rather than going through an
asynchronous separate wire that might reach the CPU before the DMA it is
signaling.

 > An AHCI PCI device uses MSI messages to inform the driver which <mask>
 > of 32 SATA ports have asserted an activity indication.

Actually from the spec it looks like it uses multiple MSI messages to
give each port its own interrupt.  There aren't enough bits available to
| together a bitwise port mask, and it wouldn't be sane to have eg 3
separate interrupt handlers for port 1 interrupts, port 2 interrupts,
and port 1 *and* 2 interrupts.

 - R.

  reply	other threads:[~2008-04-25  3:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 22:17 [git patch] free_irq() fixes Jeff Garzik
2008-04-22 22:25 ` Linus Torvalds
2008-04-22 22:59   ` Jeff Garzik
2008-04-22 23:20     ` Linus Torvalds
2008-04-22 23:49       ` Jeff Garzik
2008-04-22 23:52         ` Linus Torvalds
2008-04-23  0:05           ` Adrian Bunk
2008-04-23  0:16             ` Linus Torvalds
2008-04-23 13:51               ` Rene Herman
2008-04-24  2:10                 ` Jeff Garzik
2008-04-24  2:19                   ` Linus Torvalds
2008-04-24  5:59                     ` Eric W. Biederman
2008-04-24 10:53                       ` Jeff Garzik
2008-04-24 15:16                         ` Linus Torvalds
2008-04-24 15:40                           ` Jeff Garzik
2008-04-24 15:55                             ` Linus Torvalds
2008-04-24 15:37                               ` Alan Cox
2008-04-24 16:20                                 ` Jeff Garzik
2008-04-24 16:16                               ` Jeff Garzik
2008-04-24 16:48                               ` Eric W. Biederman
2008-04-24 16:58                                 ` Linus Torvalds
2008-04-24 18:15                                   ` Eric W. Biederman
2008-04-24 17:30                                 ` Jeff Garzik
2008-04-25  2:53                                   ` Eric W. Biederman
2008-04-25  3:33                                     ` MSI, fun for the whole family (was Re: [git patch] free_irq() fixes) Jeff Garzik
2008-04-25  3:57                                       ` Roland Dreier [this message]
2008-04-25  4:19                                         ` MSI, fun for the whole family David Miller
2008-04-25  4:35                                         ` Jeff Garzik
2008-04-25  5:48                                           ` Eric W. Biederman
2008-04-25 22:44                                           ` Roland Dreier
2008-04-25  5:08                                       ` Eric W. Biederman

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=adaiqy67fib.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rene.herman@keyaccess.nl \
    --cc=rmk@arm.linux.org.uk \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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