All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5)
Date: Wed, 21 Jan 2009 00:57:11 +0100	[thread overview]
Message-ID: <200901210057.12103.rjw@sisk.pl> (raw)
In-Reply-To: <4973F60E.5000706@jp.fujitsu.com>

On Monday 19 January 2009, Hidetoshi Seto wrote:
> Rafael J. Wysocki wrote:
> > On Saturday 17 January 2009, Rafael J. Wysocki wrote:
> (snip)
> >> If MSI-X are supported, it allocates as many vectors as there are entries
> >> in the port's MSI-X table, but no more than 32, and figures out which of them
> >> will be used for the port services.
> > 
> > The patch didn't check which services are available during the MSI-X set up
> > which was wrong.
> > 
> > Also, in the meantime, i thought it might be a good idea to free the interrupt
> > routing table entries that aren't going to be used after all.
> > 
> > The patch below adds this to the previous version and checks for the
> > availability of port services in the MSI-X setup resume.  I hope it will
> > be acceptable to everyone.
> > 
[--snip--]
> > +	/*
> > +	 * Allocate as many entries as the device wants temporarily, so that we
> > +	 * can check which of them will be useful.
> > +	 */
> > +	for (i = 0; i < nr_entries; i++)
> > +		msix_entries[i].entry = i;
> 
> 	/*
> 	 * So, if msix_entries is correctly equal to the number of entries this
> 	 * port actually uses, we'll happily go through without using trick.
> 	 */

Good point!

> > +
> > +	status = pci_enable_msix(dev, msix_entries, nr_entries);
> > +	if (status)
> > +		goto Exit;
[--snip--]
> > +
> 
> /* Are there any unused entries? */
> if (nr_allocated > nvec) {
> 	/* this port have extra entries not for services we know... */
> 
> > +	/* Drop the temporary MSI-X setup */
> > +	pci_disable_msix(dev);

Yes, I'm going to do that.

> > +	/* Now allocate the MSI-X vectors for real */
> > +	status = pci_enable_msix(dev, msix_entries, nvec);
> > +	if (status)
> > +		goto Error;
> 
> 	/*
> 	 * World have broken hardwares, so even spec says numbers are constant,
> 	 * it would be better to re-check registers after 2nd pci_enable_msix.
> 	 * Or we just skip this.  (However this was what your concern, Rafael?)
> 	 */
> 	if (func_foo_do_paranoia_check(dev, msix_entries, nvec))
> 		goto Error;	

Well, I think let's not do it for now.  If there's a system that actually
breaks here, then we can introduce the extra checking.

Thanks,
Rafael

  parent reply	other threads:[~2009-01-20 23:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 13:57 [PATCH] PCI PCIe portdrv: Fix allocation of interrupts (rev. 3) Rafael J. Wysocki
2009-01-15  7:24 ` Kenji Kaneshige
2009-01-15  7:52   ` Hidetoshi Seto
2009-01-15 10:15     ` Kenji Kaneshige
2009-01-17  0:19       ` Rafael J. Wysocki
2009-01-17 13:40         ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) (was: Re: [PATCH] PCI PCIe portdrv: Fix allocation ...) Rafael J. Wysocki
2009-01-19  3:39           ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) Hidetoshi Seto
2009-01-19  9:00             ` Kenji Kaneshige
2009-01-21  0:16               ` Rafael J. Wysocki
2009-01-21  0:18                 ` [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size() Rafael J. Wysocki
2009-01-21  0:33                   ` [PATCH 2/2] PCI PCIe portdrv: Fix allocation of interrupts (rev. 6) Rafael J. Wysocki
2009-01-21  1:17                     ` Hidetoshi Seto
2009-01-21 15:53                       ` Rafael J. Wysocki
2009-01-21  1:17                   ` [PATCH 1/2] PCI/MSI: Introduce pci_msix_table_size() Hidetoshi Seto
2009-01-21  2:30                   ` Michael Ellerman
2009-01-21 15:52                     ` Rafael J. Wysocki
2009-01-20 23:57             ` Rafael J. Wysocki [this message]
2009-01-21  0:12               ` [PATCH PCI PCIe portdrv: Fix allocation of interrupts (rev. 5) Kenji Kaneshige

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=200901210057.12103.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.