Skip to contentSkip to conversation

interrupts: do not resize event list for non MSIX

PATCH In review David Marchand 2 participants 3 messages Oct 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 interrupts: do not resize event list for non MSIX

Resizing event list only makes sense in MSIX case.

Besides, event list has always been RTE_MAX_RXTX_INTR_VEC_ID large. Let's restore this assumption for code that might rely on this property and only enlarge the event list when necessary.

Bugzilla ID: 843, 865

Fixes 8cb5d08db940 ("interrupts: extend event list")
---
 drivers/bus/pci/linux/pci_vfio.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +8 -6
index f622e7f8e6..edcee92556 100644
@@ -266,12 +266,6 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 			return -1;
 		}
 
-		/* Reallocate the efds and elist fields of intr_handle based
-		 * on PCI device MSIX size.
-		 */
-		if (rte_intr_event_list_update(dev->intr_handle, irq.count))
-			return -1;
-
 		/* if this vector cannot be used with eventfd, fail if we explicitly
 		 * specified interrupt type, otherwise continue */
 		if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) {
@@ -283,6 +277,14 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 				continue;
 		}
 
+		/* Reallocate the efds and elist fields of intr_handle based
+		 * on PCI device MSIX size.
+		 */
+		if (i == VFIO_PCI_MSIX_IRQ_INDEX &&
+				(uint32_t)rte_intr_nb_intr_get(dev->intr_handle) < irq.count &&
+				rte_intr_event_list_update(dev->intr_handle, irq.count))
+			return -1;
+
 		/* set up an eventfd for interrupts */
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, October 29, 2021 1:08 PM
To: [email protected]
Cc: Anatoly Burakov <[email protected]>; Dmitry Kozlyuk <[email protected]>; Harman Kalra <[email protected]>
Subject: [EXT] [PATCH] interrupts: do not resize event list for non MSIX

External Email

----------------------------------------------------------------------
Resizing event list only makes sense in MSIX case.

Quoted 7 lines

Besides, event list has always been RTE_MAX_RXTX_INTR_VEC_ID large. Let's restore this assumption for code that might rely on this property and only enlarge the event list when necessary.

Bugzilla ID: 843, 865

Fixes 8cb5d08db940 ("interrupts: extend event list")

Thanks David for fixing this.

Thanks
Harman

Quoted 44 lines
---
 drivers/bus/pci/linux/pci_vfio.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +0 -6
index f622e7f8e6..edcee92556 100644
@@ -266,12 +266,6 @@ pci_vfio_setup_interrupts(struct rte_pci_device
 *dev, int vfio_dev_fd)
 			return -1;
 		}
 
-		/* Reallocate the efds and elist fields of intr_handle based
-		 * on PCI device MSIX size.
-		 */
-		if (rte_intr_event_list_update(dev->intr_handle, irq.count))
-			return -1;
-
 		/* if this vector cannot be used with eventfd, fail if we

explicitly

drivers/bus/pci/linux/pci_vfio.c +1 -0
 		 * specified interrupt type, otherwise continue */
 		if ((irq.flags & VFIO_IRQ_INFO_EVENTFD) == 0) { @@ -283,6
+277,14 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int

vfio_dev_fd)

drivers/bus/pci/linux/pci_vfio.c +5 -0
 				continue;
 		}
 
+		/* Reallocate the efds and elist fields of intr_handle based
+		 * on PCI device MSIX size.
+		 */
+		if (i == VFIO_PCI_MSIX_IRQ_INDEX &&
+				(uint32_t)rte_intr_nb_intr_get(dev-
Quoted 1 line

intr_handle) < irq.count &&

drivers/bus/pci/linux/pci_vfio.c +1 -0
+				rte_intr_event_list_update(dev->intr_handle,

irq.count))

drivers/bus/pci/linux/pci_vfio.c +2 -1
+			return -1;
+
 		/* set up an eventfd for interrupts */
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
--

2.23.0

author Applied
#2 lore raw
Quoted 11 lines · Harman Kalra
Quoted 10 lines

Resizing event list only makes sense in MSIX case.

Besides, event list has always been RTE_MAX_RXTX_INTR_VEC_ID large. Let's restore this assumption for code that might rely on this property and only enlarge the event list when necessary.

Bugzilla ID: 843, 865

Fixes 8cb5d08db940 ("interrupts: extend event list")

Applied, thanks.

Signature · 1 line
David Marchand