mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/8] PCI PCIe portdrv: Fix allocation of interrupts
Date: Thu, 15 Jan 2009 20:10:59 +0100	[thread overview]
Message-ID: <200901152011.00216.rjw@sisk.pl> (raw)
In-Reply-To: <200901152005.25370.rjw@sisk.pl>

On Thursday 15 January 2009, Rafael J. Wysocki wrote:
> On Thursday 15 January 2009, Rafael J. Wysocki wrote:
> > On Thursday 15 January 2009, Kenji Kaneshige wrote:
> > > Hidetoshi Seto wrote:
> > > > Rafael J. Wysocki wrote:
> > > >> On Wednesday 14 January 2009, Rafael J. Wysocki wrote:
> > > >>> On Wednesday 14 January 2009, Kenji Kaneshige wrote:
> > > >> [...]
> > > >>>> I'm sorry but I don't understand what the problem is.
> > > >>>> Do you mean pci_disable_msix() doesn't work on some platforms?
> > > >>> No, I don't.  It was just confusion on my side, sorry.
> > > >>>
> > > >>> Please have a look at the new version of the patch I sent yesterday
> > > >>> (http://marc.info/?l=linux-pci&m=123185510828181&w=4).
> > > >> BTW, in your patch the first dummy pci_enable_msix() allocates just one
> > > >> vector, which means that the contents of both
> > > >> msix_entries[idx_hppme].entry and msix_entries[idx_aer].entry will be the same,
> > > >> if my reading of the spec (PCI 3.0 in this case) is correct.
> > > > 
> > > > According to PCI 3.0 implementation note "Handling MSI-X Vector Shortage,"
> > > > it seems your reading is not correct.
> > > > 
> > > > Assume that the port have 4 entries([0-3]) in MSI-X table, and that entry[2]
> > > > for hotplug/PME and entry[3] for AER, and that kernel only allocates 2 vector.
> > > > Spec says that the port could be designed for software to configure entries
> > > > assigning vectors{A,B} to multiple entries as ABAB, AABB, ABBB etc. 
> > > > 
> > > > So if there is just one vector, it could be AAAA.
> > 
> > Our pci_enable_msix() doesn't do that.  It will always do A---.
> > 
> > > BTW, I don't think pci_enable_msix() allows this kind of configuration.
> > > With the dummy pci_enable_msix() in my patch, it would be A---, I think.
> > 
> > And that exactly is why I'm not sure it's correct.
> > 
> > Namely, if only the first entry is configured, the device is only able to use
> > one vector, represented by this entry, for any purpose.  Now, for instance, for
> > PCIE_CAPABILITIES_REG, there are two possibilities:
> > (1) the value in the register always points to the _valid_ entry in the MSI-X
> >     table and that would be the first one,
> > (2) the value in the register may point to an _invalid_ entry (1 - 3).
> > 
> > You seem to assume that (2) is the case, but I'm not sure (that should follow
> > from the PCI Express spec, but it clearly doesn't, at least I couldn't find
> > any pointer in the spec).  IMO it wouldn't make sense, because the port
> > wouldn't have been able to generate interrupts for this service if only one
> > vector had been configured.
> > 
> > Still, even though (2) is the case, but both PCIE_CAPABILITIES_REG and
> > PCI_ERR_ROOT_STATUS just happen to point to the same entry, which very well may
> > be possible, the second pci_enable_msix() in your patch will fail.
> > 
> > In any case, I think we should
> > (a) get the number of the port's MSI-X table entries _first_, without enabling
> >     MSI-X,
> > (b) allocate as many MSI-X vectors as indicated by this number, even though
> >     some of them may not be used,
> > (c) use PCIE_CAPABILITIES_REG and PCI_ERR_ROOT_STATUS to check
> >     which vector has been allocated to which service.
> 
> (d) mask the unused vectors.

However, it's probably simpler to do something like in your patch, although
I don't like the dummy enabling of MSI-X at all.

Thanks,
Rafael

  reply	other threads:[~2009-01-15 19:11 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-04 22:46 [PATCH 0/8] PCI Express port driver fixes and cleanups Rafael J. Wysocki
2009-01-04 22:48 ` [PATCH 1/8] PCI PCIe portdrv: Remove root ports MSI quirk Rafael J. Wysocki
2009-01-09 23:12   ` Jesse Barnes
2009-01-09 23:18   ` Jesse Barnes
2009-01-09 23:33     ` Rafael J. Wysocki
2009-01-04 22:49 ` [PATCH 2/8] PCI PCIe portdrv: Aviod using service devices with wrong interrupts Rafael J. Wysocki
2009-01-09 23:23   ` Jesse Barnes
2009-01-04 22:51 ` [PATCH 3/8] PCI PCIe portdrv: Remove unused device extension Rafael J. Wysocki
2009-01-09 23:23   ` Jesse Barnes
2009-01-04 22:54 ` [PATCH 4/8] PCI PCIe portdrv: Do not enable port device before setting up interrupts Rafael J. Wysocki
2009-01-09 23:25   ` Jesse Barnes
2009-01-04 22:55 ` [PATCH 5/8] PCI PCIe portdrv: Fix allocation of interrupts Rafael J. Wysocki
2009-01-08  3:02   ` Kenji Kaneshige
2009-01-08  7:13     ` Rafael J. Wysocki
2009-01-08  8:20       ` Kenji Kaneshige
2009-01-08 16:53         ` Rafael J. Wysocki
2009-01-08 20:45           ` Rafael J. Wysocki
2009-01-09 23:33             ` Jesse Barnes
2009-01-09 23:38               ` Rafael J. Wysocki
2009-01-13  2:47                 ` Kenji Kaneshige
2009-01-13 11:17                   ` Rafael J. Wysocki
2009-01-14  6:08                     ` Kenji Kaneshige
2009-01-14 10:35                       ` Rafael J. Wysocki
2009-01-14 10:57                         ` Rafael J. Wysocki
2009-01-15  6:24                           ` Kenji Kaneshige
2009-01-15  7:38                           ` Hidetoshi Seto
2009-01-15 10:31                             ` Kenji Kaneshige
2009-01-15 16:42                               ` Rafael J. Wysocki
2009-01-15 19:05                                 ` Rafael J. Wysocki
2009-01-15 19:10                                   ` Rafael J. Wysocki [this message]
2009-01-16  7:33                                     ` Hidetoshi Seto
2009-01-16  9:29                                       ` Rafael J. Wysocki
2009-01-17  0:20                                         ` Rafael J. Wysocki
2009-01-19  1:52                                           ` Hidetoshi Seto
2009-01-19  6:27                                 ` Kenji Kaneshige
2009-01-13  2:34           ` Kenji Kaneshige
2009-01-04 22:57 ` [PATCH 6/8] PCI PCIe portdrv: Remove unnecessary function Rafael J. Wysocki
2009-01-04 22:59 ` [PATCH 7/8] PCI PCIe portdrv: Simplily probe callback of service drivers Rafael J. Wysocki
2009-01-07 12:15   ` Rafael J. Wysocki
2009-01-04 23:01 ` [PATCH 8/8] PCI PCIe portdrv: Remove struct pcie_port_service_id Rafael J. Wysocki
2009-01-07 12:16   ` Rafael J. Wysocki

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=200901152011.00216.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=seto.hidetoshi@jp.fujitsu.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

Powered by JetHome