virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] msi-x: let drivers retry when not enough vectors
@ 2009-05-07  8:28 Michael S. Tsirkin
  0 siblings, 0 replies; 19+ messages in thread
From: Michael S. Tsirkin @ 2009-05-07  8:28 UTC (permalink / raw)
  To: jbarnes, linux-kernel, linux-pci, Matthew Wilcox; +Cc: kvm, virtualization

pci_enable_msix currently returns -EINVAL if you ask
for more vectors than supported by the device, which would
typically cause fallback to regular interrupts.

It's better to return the table size, making the driver retry
MSI-X with less vectors.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Hi Jesse,
This came up when I was adding MSI-X support to virtio pci driver,
which does not know the exact table size upfront.
Could you consider this patch for 2.6.31 please?


 drivers/pci/msi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6f2e629..f5bd1c9 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -687,8 +687,8 @@ int pci_msix_table_size(struct pci_dev *dev)
  * indicates the successful configuration of MSI-X capability structure
  * with new allocated MSI-X irqs. A return of < 0 indicates a failure.
  * Or a return of > 0 indicates that driver request is exceeding the number
- * of irqs available. Driver should use the returned value to re-send
- * its request.
+ * of irqs or MSI-X vectors available. Driver should use the returned value to
+ * re-send its request.
  **/
 int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
 {
@@ -704,7 +704,7 @@ int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
 
 	nr_entries = pci_msix_table_size(dev);
 	if (nvec > nr_entries)
-		return -EINVAL;
+		return nr_entries;
 
 	/* Check for any invalid entries */
 	for (i = 0; i < nvec; i++) {
-- 
1.6.3.rc3.1.g830204

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2009-06-11 18:28 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090507082841.GA31751@redhat.com>
2009-05-07  8:51 ` [PATCH] msi-x: let drivers retry when not enough vectors Sheng Yang
     [not found] ` <200905071651.24970.sheng@linux.intel.com>
2009-05-07  9:05   ` Michael S. Tsirkin
     [not found]   ` <20090507090506.GB32039@redhat.com>
2009-05-07  9:10     ` Sheng Yang
     [not found]     ` <200905071710.47204.sheng@linux.intel.com>
2009-05-07  9:31       ` Michael S. Tsirkin
2009-05-07  9:27   ` Matthew Wilcox
     [not found]   ` <20090507092731.GH8112@parisc-linux.org>
2009-05-07  9:40     ` Sheng Yang
     [not found]     ` <200905071740.16190.sheng@linux.intel.com>
2009-05-07  9:53       ` Matthew Wilcox
     [not found]       ` <20090507095302.GI8112@parisc-linux.org>
2009-05-07 10:19         ` Sheng Yang
2009-05-07 10:23         ` Michael Ellerman
     [not found]         ` <1241691830.24385.6.camel@concordia>
2009-05-07 10:28           ` Sheng Yang
2009-05-07 10:44           ` Avi Kivity
     [not found]           ` <4A02BB96.8070103@redhat.com>
2009-05-07 11:57             ` Matthew Wilcox
     [not found]         ` <200905071819.54426.sheng@linux.intel.com>
2009-05-07 10:32           ` Michael S. Tsirkin
2009-05-07 23:55           ` Rusty Russell
     [not found]           ` <200905080925.01398.rusty@rustcorp.com.au>
2009-05-08  0:22             ` Matthew Wilcox
2009-05-08  0:28             ` Michael Ellerman
2009-05-12 21:28             ` Michael S. Tsirkin
2009-06-11 18:28 ` Jesse Barnes
2009-05-07  8:28 Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).