vfio: avoid re-installing irq handler
Subsystems (2)
Quoted 10 lines
-----Original Message-----
From: Hyong Youb Kim <[email protected]>
Sent: Monday, July 15, 2019 9:28 PM
To: David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Ferruh Yigit <[email protected]>
Cc: [email protected]; John Daley <[email protected]>; Hyong Youb Kim <[email protected]>
Subject: [EXT] [RFC PATCH] vfio: avoid re-installing irq handler
Quoted 5 lines
A rough patch for the approach mentioned earlier. It is only for discussion.
http://mails.dpdk.org/archives/dev/2019-July/138113.htmlTo try this out, first revert the following then apply. commit
89aac60e0be9("vfio: fix interrupts race condition")
Yes. This patch has to be to reverted. It changes the existing interrupt behavior and does not address the MSIX case as well.
I think, The clean fix would be to introduce rte_intr_mask() and rte_intr_unmask() by abstracting the INTX and MSIX differences And let qede driver call it as needed.
Thoughts?
Quoted 27 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Tuesday, July 16, 2019 1:51 AM
To: Hyong Youb Kim (hyonkim) <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Cc: [email protected]; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: RE: [RFC PATCH] vfio: avoid re-installing irq handlerQuoted 10 lines
-----Original Message-----
From: Hyong Youb Kim <[email protected]>
Sent: Monday, July 15, 2019 9:28 PM
To: David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Ferruh Yigit <[email protected]>
Cc: [email protected]; John Daley <[email protected]>; Hyong Youb Kim <[email protected]>
Subject: [EXT] [RFC PATCH] vfio: avoid re-installing irq handlerQuoted 5 lines
A rough patch for the approach mentioned earlier. It is only for discussion.
http://mails.dpdk.org/archives/dev/2019-July/138113.htmlTo try this out, first revert the following then apply. commit
89aac60e0be9("vfio: fix interrupts race condition")
Quoted 8 lines
Yes. This patch has to be to reverted. It changes the existing interrupt behavior and does not address the MSIX case as well.
I think, The clean fix would be to introduce
rte_intr_mask()andrte_intr_unmask()by abstracting the INTX and MSIX differences And let qede driver call it as needed.Thoughts?
Hi,
You are proposing these?
- Add rte_intr_mask_intx, rte_intr_unmask_intx.
No APIs for masking MSI/MSI-X as vfio-pci does not support that.
- Modify PMD irq handlers to use rte_intr_unmask_intx as necessary.
That might be too intrusive. And too much work for the sake of INTx.. Anyone really using/needing INTx these days? :-)
The following drivers call rte_intr_enable from their irq handlers. So with explicit rte_intr_unmask_intx, all these would need to do "if using intx, unmask"?
atlantic, avp, axgbe, bnx2x, e1000, fm10k, ice, ixgbe, nfp, qede, sfc, vmxnet3
And nfp seems to rely on rte_intr_enable to re-install irq handler to unmask a vector in MSI-X Table?
if (hw->ctrl & NFP_NET_CFG_CTRL_MSIXAUTO) {
/* If MSI-X auto-masking is used, clear the entry */
rte_wmb();
rte_intr_enable(&pci_dev->intr_handle);With David's patch and mine, this handler would have to first rte_intr_disable() and then enable, if such unmasking is really necessary..
As for the semantics of rte_intr_enable/disable, I am ok as is.
- "enable": put things in a state where NIC can send an interrupt, and PMD/app gets a callback.
Whether this involves unmasking for INTx is hidden.
- "disable": put things in a state where NIC cannot send an interrupt.
Regardless of vfio changes, we should probably remove rte_intr_enable from qede_interrupt_handler (the MSI/MSI-X interrupt handler), to make usage/intention clear..
Thanks.
-Hyong
Quoted 23 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Tuesday, July 16, 2019 11:28 AM
To: Jerin Jacob Kollanukkaran <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Alejandro Lucero <[email protected]>; Anatoly Burakov <[email protected]>
Cc: [email protected]; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: RE: [RFC PATCH] vfio: avoid re-installing irq handlerQuoted 1 line
Quoted 1 line
A rough patch for the approach mentioned earlier. It is only for
discussion.
Quoted 8 lines
Quoted 4 lines
http://mails.dpdk.org/archives/dev/2019-July/138113.html
To try this out, first revert the following then apply. commit
89aac60e0be9("vfio: fix interrupts race condition")Yes. This patch has to be to reverted. It changes the existing interrupt behavior and does not address the MSIX case as well.
Quoted 7 lines
Quoted 5 lines
I think, The clean fix would be to introduce
rte_intr_mask()andrte_intr_unmask()by abstracting the INTX and MSIX differences And let qede driver call it as needed.Thoughts?
Hi,
Hi Hyong,
Quoted 5 lines
You are proposing these?
- Addrte_intr_mask_intx,rte_intr_unmask_intx.
No APIs for masking MSI/MSI-X as vfio-pci does not support that.
- Modify PMD irq handlers to userte_intr_unmask_intxas necessary.
No, introduce the rte_intr_mask() and rte_intr_unmask().
For MSIX + Linux VFIO, That API can return -ENOSUP as Linux VFIO+MSIX is not supporting. Another platform/eal may support it.
Mask and unmask is operation is known to all IRQ controllers. So, IMO, As far as abstraction is concerned it will be good fit.
Quoted 2 lines
That might be too intrusive. And too much work for the sake of INTx.. Anyone really using/needing INTx these days? :-)
Yup. Mask needs to called only for only qede INTx. Looks like qede Has MSIX and INTX separate handler. So this mask can go to qede INTx
Quoted 7 lines
The following drivers call
rte_intr_enablefrom their irq handlers. So with explicitrte_intr_unmask_intx, all these would need to do "if using intx, unmask"?atlantic, avp, axgbe, bnx2x, e1000, fm10k, ice, ixgbe, nfp, qede, sfc, vmxnet3
No change on these PMDs.
Quoted 8 lines
And nfp seems to rely on
rte_intr_enableto re-install irq handler to unmask a vector in MSI-X Table?if (hw->ctrl & NFP_NET_CFG_CTRL_MSIXAUTO) { /* If MSI-X auto-masking is used, clear the entry */ rte_wmb(); rte_intr_enable(&pci_dev->intr_handle);
Quoted 8 lines
With David's patch and mine, this handler would have to first
rte_intr_disable()and then enable, if such unmasking is really necessary..As for the semantics of rte_intr_enable/disable, I am ok as is.
- "enable": put things in a state where NIC can send an interrupt, and PMD/app gets a callback.
Whether this involves unmasking for INTx is hidden.
- "disable": put things in a state where NIC cannot send an interrupt.
It looks OK to me. My only thought was, Since mask and unmask is a common irq controller operation. We may not need to add A lot of common code(Introducing a state) to hide unmask INTx. More over as you said, There is may only handful of devices uses INTX.
IMO, mask and unmask API is good fit as eal abstraction.
But Using a separate API or hide inside eal to solve this problem is good question. May be more thoughts from another quys will be good.
We will try to send a version with mask/unmask API to see the changes required.
Quoted 4 lines
Regardless of vfio changes, we should probably remove
rte_intr_enablefromqede_interrupt_handler(the MSI/MSI-X interrupt handler), to make usage/intention clear..
Yes. Anyway this change is required.
Quoted 3 lines
Thanks.
-Hyong
Quoted 2 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
[...]
Quoted 26 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
A rough patch for the approach mentioned earlier. It is only for
discussion.
Quoted 8 lines
Quoted 4 lines
http://mails.dpdk.org/archives/dev/2019-July/138113.html
To try this out, first revert the following then apply. commit
89aac60e0be9("vfio: fix interrupts race condition")Yes. This patch has to be to reverted. It changes the existing interrupt behavior and does not address the MSIX case as well.
Quoted 7 lines
Quoted 5 lines
I think, The clean fix would be to introduce
rte_intr_mask()andrte_intr_unmask()by abstracting the INTX and MSIX differences And let qede driver call it as needed.Thoughts?
Hi,
Hi Hyong,
Quoted 5 lines
You are proposing these?
- Addrte_intr_mask_intx,rte_intr_unmask_intx.
No APIs for masking MSI/MSI-X as vfio-pci does not support that.
- Modify PMD irq handlers to userte_intr_unmask_intxas necessary.
Quoted 5 lines
No, introduce the
rte_intr_mask()andrte_intr_unmask().
For MSIX + Linux VFIO, That API can return-ENOSUPas Linux VFIO+MSIX is not supporting.
Another platform/eal may support it.
These generic names would invite people to use API, only to see it fail, since it only works with INTx..
Quoted 10 lines
Mask and unmask is operation is known to all IRQ controllers. So, IMO, As far as abstraction is concerned it will be good fit.
Quoted 2 lines
That might be too intrusive. And too much work for the sake of INTx.. Anyone really using/needing INTx these days? :-)
Yup. Mask needs to called only for only qede INTx. Looks like qede Has MSIX and INTX separate handler. So this mask can go to qede INTx
Quoted 1 line
Quoted 9 lines
Quoted 6 lines
The following drivers call
rte_intr_enablefrom their irq handlers. So with explicitrte_intr_unmask_intx, all these would need to do "if using intx, unmask"?atlantic, avp, axgbe, bnx2x, e1000, fm10k, ice, ixgbe, nfp, qede, sfc, vmxnet3
No change on these PMDs.
Why is that?
These drivers potentially have the same "lost" interrupt issue mentioned in the original redhat bz (qede + MSI). I *think* this observation led David to address them all through vfio changes, rather than fixing qede alone.
You want to introduce unmask API and use it only for qede in this cycle, and ask respective maintainers to fix their drivers in 19.11?
Quoted 32 lines
Quoted 1 line
And nfp seems to rely on
rte_intr_enableto re-install irq handler tounmask
Quoted 7 lines
a vector in MSI-X Table?
if (hw->ctrl & NFP_NET_CFG_CTRL_MSIXAUTO) { /* If MSI-X auto-masking is used, clear the entry */ rte_wmb(); rte_intr_enable(&pci_dev->intr_handle);Quoted 8 lines
With David's patch and mine, this handler would have to first
rte_intr_disable()and then enable, if such unmasking is really necessary..As for the semantics of rte_intr_enable/disable, I am ok as is.
- "enable": put things in a state where NIC can send an interrupt, and PMD/app gets a callback.
Whether this involves unmasking for INTx is hidden.
- "disable": put things in a state where NIC cannot send an interrupt.It looks OK to me. My only thought was, Since mask and unmask is a common irq controller operation. We may not need to add A lot of common code(Introducing a state) to hide unmask INTx. More over as you said, There is may only handful of devices uses INTX.
IMO, mask and unmask API is good fit as eal abstraction.
But Using a separate API or hide inside eal to solve this problem is good question.
May be more thoughts from another quys will be good.We will try to send a version with mask/unmask API to see the changes required.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Regardless of vfio changes, we should probably remove
rte_intr_enablefromqede_interrupt_handler(the MSI/MSI-X interrupt handler), to make usage/intention clear..Yes. Anyway this change is required.
That change fixes the immediate problem (redhat bz) that started all this discussion. And allow us to kick the can down the road, for potential issues in other PMDs :-) Not suggesting we do, but it becomes an option..
Thanks.
-Hyong
Quoted 42 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Tuesday, July 16, 2019 1:19 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Alejandro Lucero <[email protected]>; Anatoly Burakov <[email protected]>
Cc: [email protected]; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>
Subject: RE: [RFC PATCH] vfio: avoid re-installing irq handlerQuoted 2 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>[...]
Quoted 26 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
A rough patch for the approach mentioned earlier. It is only for
discussion.
Quoted 8 lines
Quoted 4 lines
http://mails.dpdk.org/archives/dev/2019-July/138113.html
To try this out, first revert the following then apply. commit
89aac60e0be9("vfio: fix interrupts race condition")Yes. This patch has to be to reverted. It changes the existing interrupt behavior and does not address the MSIX case as well.
Quoted 7 lines
Quoted 5 lines
I think, The clean fix would be to introduce
rte_intr_mask()andrte_intr_unmask()by abstracting the INTX and MSIX differences And let qede driver call it as needed.Thoughts?
Hi,
Hi Hyong,
Quoted 5 lines
You are proposing these?
- Addrte_intr_mask_intx,rte_intr_unmask_intx.
No APIs for masking MSI/MSI-X as vfio-pci does not support that.
- Modify PMD irq handlers to userte_intr_unmask_intxas necessary.
Quoted 8 lines
Quoted 5 lines
No, introduce the
rte_intr_mask()andrte_intr_unmask(). For MSIX + Linux VFIO, That API can return-ENOSUPas Linux VFIO+MSIX is not supporting.
Another platform/eal may support it.These generic names would invite people to use API, only to see it fail, since it only works with INTx..
It works for all non VFIO MSIx case. VFIO MSIx case it NOP(Yes, No need to return error in that case)
Quoted 22 lines
Quoted 15 lines
Mask and unmask is operation is known to all IRQ controllers. So, IMO, As far as abstraction is concerned it will be good fit.
Quoted 2 lines
That might be too intrusive. And too much work for the sake of INTx.. Anyone really using/needing INTx these days? :-)
Yup. Mask needs to called only for only qede INTx. Looks like qede Has MSIX and INTX separate handler. So this mask can go to qede INTx
Quoted 5 lines
The following drivers call
rte_intr_enablefrom their irq handlers. So with explicitrte_intr_unmask_intx, all these would need to do "if using intx, unmask"?Quoted 6 lines
Quoted 3 lines
atlantic, avp, axgbe, bnx2x, e1000, fm10k, ice, ixgbe, nfp, qede, sfc,
vmxnet3No change on these PMDs.
Quoted 8 lines
Why is that?
These drivers potentially have the same "lost" interrupt issue mentioned in the original redhat bz (qede + MSI). I *think* this observation led David to address them all through vfio changes, rather than fixing qede alone.
You want to introduce unmask API and use it only for qede in this cycle, and ask respective maintainers to fix their drivers in 19.11?
Changing the rte_intr_enable() to rte_intr_unmask() is trivial on the places Where existing drivers enable as unmask.
If we understand it correctly:
In case of non VFIO MSIX(INTx) and UIO
-------------------------------------------------
AK1) Kernel receives interrupt
AK2) Kernel _mask_ the interrupt
AK3) Kernel notify the use space
On usersapce:
AU1) Driver specific interrupt handler invoked
AU2) Handle the driver specific interrupt
AU3) Call rte_intr_enable(), it will intern call VFIO_IRQ_SET_ACTION_UNMASK using VFIO_DEVICE_SET_IRQS to unmask the interrupt.
In case of VFIO MSIX(INTx)
------------------------------------
BK1) Kernel receives interrupt.
BK2) Kernel notify the use space
On usersapce:
BU1) Driver specific interrupt handler invoked
BU2) Handle the driver specific interrupt
BU3) Call rte_intr_enable(), it will intern call VFIO_IRQ_SET_ACTION_TRIGGER using VFIO_DEVICE_SET_IRQS to unmask the interrupt.
VFIO_IRQ_SET_ACTION_TRIGGER: is the nasty one, it will free the existing interrupt handler and request new handler etc. Which is the source of the actual race conditional problem.
Ideally BU3 can be just NOP. Since we need to keep the same interrupt handler for both UIO and MSIX(I *think*) DPDK tends to use rte_intr_enable() which can work for AU3/BU3 as well.
So we need,
A light weight primitive, which unmask the AK2 incase of VFIO INTx by not overriding
The meaning of normal rte_intr_enable() which suppose not use for MSIX interrupt in action due to racy behavior of VFIO_IRQ_SET_ACTION_TRIGGER
Replacing AU3 and BU3 as rte_intr_unmask() would fix problem. Where rte_intr_unmask() for BU3 is just NOP.
RFC PATCH 1/1 eal: add mask and unmask interrupt apis
In reply to Jerin Jacob KollanukkaranAdd new mask and unmask interrupt api's specifically for VFIO_LEGACY type of interrupts. For legacy/intx vfio-pci masks the interrupt before posting the event and application has to unmask it as a part of its interrupt handling. Hence these new api's can be used for the light-weight operation of masking and unmasking.
In all the other VFIO interrupts i.e MSI & MSIx, vfio-pci doesn't do anything like that and there is also no implementation for masking and unmasking.
--- lib/librte_eal/common/include/rte_interrupts.h | 23 ++++ lib/librte_eal/linux/eal/eal_interrupts.c | 155 +++++++++++++++++++++++++ 2 files changed, 178 insertions(+)
lib/librte_eal/common/include/rte_interrupts.h +23 -0
@@ -118,6 +118,29 @@ int rte_intr_enable(const struct rte_intr_handle *intr_handle);*/ int rte_intr_disable (const struct rte_intr_handle *intr_handle); +/** +* It masks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_mask (const struct rte_intr_handle *intr_handle); + +/** +* It unmasks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_unmask (const struct rte_intr_handle *intr_handle); #ifdef __cplusplus }#endif
lib/librte_eal/linux/eal/eal_interrupts.c +155 -0
167 lines not on this page · raw message
Signature · 1 line
2.8.4
RFC PATCH v2 1/1 eal: add mask and unmask interrupt apis
In reply to Jerin Jacob KollanukkaranAdd new mask and unmask interrupt api's specifically for VFIO_LEGACY type of interrupts. For legacy/intx vfio-pci masks the interrupt before posting the event and application has to unmask it as a part of its interrupt handling. Hence these new api's can be used for the light-weight operation of masking and unmasking.
In all the other VFIO interrupts i.e MSI & MSIx, vfio-pci doesn't do anything like that and there is also no implementation for masking and unmasking.
For qede intx handling, we can call the new api for unmasking interrupt. We have not tested it on qede.
--- drivers/net/qede/qede_ethdev.c | 6 +- lib/librte_eal/common/include/rte_interrupts.h | 23 ++++ lib/librte_eal/linux/eal/eal_interrupts.c | 155 +++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 4 deletions(-)
drivers/net/qede/qede_ethdev.c +2 -4
@@ -248,8 +248,8 @@ qede_interrupt_handler_intx(void *param)if (status &0x1 ) {qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); } }
@@ -261,8 +261,6 @@ qede_interrupt_handler(void *param)struct ecore_dev *edev = &qdev->edev;qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); } static void
lib/librte_eal/common/include/rte_interrupts.h +23 -0
@@ -118,6 +118,29 @@ int rte_intr_enable(const struct rte_intr_handle *intr_handle);*/ int rte_intr_disable (const struct rte_intr_handle *intr_handle); +/** +* It masks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_mask (const struct rte_intr_handle *intr_handle); + +/** +* It unmasks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_unmask (const struct rte_intr_handle *intr_handle); #ifdef __cplusplus }#endif
lib/librte_eal/linux/eal/eal_interrupts.c +155 -0
167 lines not on this page · raw message
Signature · 1 line
2.8.4
RFC PATCH v3 1/3 vfio: revert change that does intr eventfd setup at probe
In reply to Jerin Jacob KollanukkaranThis reverts commit 89aac60e0be9ed95a87b16e3595f102f9faaffb4. "vfio: fix interrupts race condition"
The above mentioned commit moves the interrupt's eventfd setup to probe time but only enables one interrupt for all types of interrupt handles i.e VFIO_MSI, VFIO_LEGACY, VFIO_MSIX, UIO. It works fine with default case but breaks below cases specifically for MSIX based interrupt handles.
* Applications like l3fwd-power that request rxq interrupts while ethdev setup.
* Drivers that need > 1 MSIx interrupts to be configured for functionality to work.
VFIO PCI for MSIx expects all the possible vectors to be setup up when using VFIO_IRQ_SET_ACTION_TRIGGER so that they can be allocated from kernel pci subsystem. Only way to increase the number of vectors later is first free all by using VFIO_IRQ_SET_DATA_NONE with action trigger and then enable new vector count.
Above commit changes the behavior of rte_intr_[enable|disable] to only mask and unmask unlike earlier behavior and thereby breaking above two scenarios.
--- drivers/bus/pci/linux/pci_vfio.c | 78 ++++++------ lib/librte_eal/linux/eal/eal_interrupts.c | 201 +++++++++++++++++++++++------- 2 files changed, 191 insertions(+), 88 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +38 -40
@@ -187,11 +187,8 @@ pci_vfio_set_bus_master(int dev_fd, bool op)static int pci_vfio_setup_interrupts (struct rte_pci_device *dev,int vfio_dev_fd) { -char irq_set_buf[sizeof (struct vfio_irq_set ) +sizeof (int )]; -struct vfio_irq_set *irq_set; -enum rte_intr_mode intr_mode;int i, ret, intr_idx; -int fd; +enum rte_intr_mode intr_mode;/* default to invalid index */ intr_idx =VFIO_PCI_NUM_IRQS ;
@@ -223,6 +220,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)/* start from MSI-X interrupt type */ for (i =VFIO_PCI_MSIX_IRQ_INDEX ; i >=0 ; i--) {struct vfio_irq_info irq = { .argsz =sizeof (irq) }; +int fd =-1 ;/* skip interrupt modes we don't want */ if (intr_mode != RTE_INTR_MODE_NONE &&
@@ -238,51 +236,51 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)return -1 ; } -/* found a usable interrupt mode */ -if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) !=0 ) -break ; -/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ -if (intr_mode !=RTE_INTR_MODE_NONE ) { -RTE_LOG (ERR ,EAL ," interrupt vector does not support eventfd!\n" ); +if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) { +if (intr_mode !=RTE_INTR_MODE_NONE ) { +RTE_LOG (ERR ,EAL , +" interrupt vector does not support eventfd!\n" ); +return -1 ; + }else +continue ; + } + +/* set up an eventfd for interrupts */ + fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC ); +if (fd <0 ) { +RTE_LOG (ERR ,EAL ," cannot set up eventfd, " +"error %i (%s)\n" , errno,strerror (errno));return -1 ; } - } -if (i <0 ) -return -1 ; + dev->intr_handle.fd = fd; + dev->intr_handle.vfio_dev_fd = vfio_dev_fd; - fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC ); -if (fd <0 ) { -RTE_LOG (ERR ,EAL ," cannot set up eventfd, error %i (%s)\n" , - errno,strerror (errno)); -return -1 ; - } +switch (i) { +case VFIO_PCI_MSIX_IRQ_INDEX : + intr_mode =RTE_INTR_MODE_MSIX ; + dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSIX ; +break ; +case VFIO_PCI_MSI_IRQ_INDEX : + intr_mode =RTE_INTR_MODE_MSI ; + dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSI ; +break ; +case VFIO_PCI_INTX_IRQ_INDEX : + intr_mode =RTE_INTR_MODE_LEGACY ; + dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_LEGACY ; +break ; +default : +RTE_LOG (ERR ,EAL ," unknown interrupt type!\n" ); +return -1 ; + } - irq_set = (struct vfio_irq_set *)irq_set_buf; - irq_set->argsz =sizeof (irq_set_buf); - irq_set->flags =VFIO_IRQ_SET_DATA_EVENTFD |VFIO_IRQ_SET_ACTION_TRIGGER ; - irq_set->index = i; - irq_set->start =0 ; - irq_set->count =1 ; -memcpy (&irq_set->data, &fd,sizeof (int )); -if (ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set) <0 ) { -RTE_LOG (ERR ,EAL ," error configuring interrupt\n" ); -close (fd); -return -1 ; +return 0 ; } - dev->intr_handle.fd = fd; - dev->intr_handle.vfio_dev_fd = vfio_dev_fd; -if (i ==VFIO_PCI_MSIX_IRQ_INDEX ) - dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSIX ; -else if (i ==VFIO_PCI_MSI_IRQ_INDEX ) - dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSI ; -else if (i ==VFIO_PCI_INTX_IRQ_INDEX ) - dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_LEGACY ; - -return 0 ; +/* if we're here, we haven't found a suitable interrupt vector */ +return -1 ; }#ifdef HAVE_VFIO_DEV_REQ_INTERFACE
lib/librte_eal/linux/eal/eal_interrupts.c +153 -48
258 lines not on this page · raw message
Signature · 1 line
2.8.4
RFC PATCH v3 2/3 eal: add mask and unmask interrupt APIs
Add new mask and unmask interrupt APIs to avoid using VFIO_IRQ_SET_ACTION_TRIGGER for masking/unmasking purpose for VFIO based handlers. This implementation is specific to Linux.
Using action trigger for masking and unmasking has below issues
* Time consuming to do for every interrupt received as it will free_irq() followed by request_irq() and all other initializations
* A race condition because of a window between free_irq() and request_irq() with packet reception still on and device still enabled and would throw warning messages like below.
[158764.159833] do_IRQ: 9.34 No irq handler for vector
In this patch, mask/unmask is a no-op for VFIO_MSIX/VFIO_MSI interrupts as they are edge triggered and kernel would not mask the interrupt before delivering the event to userspace.
---
v3:
* Re-org patch to move driver change to 3/3
* Add stub implementation for freebsd.
* Fix version map file for new apis.
v2:
Make change in qede driver for unmask
lib/librte_eal/common/include/rte_interrupts.h | 23 ++++ lib/librte_eal/freebsd/eal/eal_interrupts.c | 54 +++++++++ lib/librte_eal/linux/eal/eal_interrupts.c | 155 +++++++++++++++++++++++++ lib/librte_eal/rte_eal_version.map | 2 + 4 files changed, 234 insertions(+)
lib/librte_eal/common/include/rte_interrupts.h +23 -0
@@ -118,6 +118,29 @@ int rte_intr_enable(const struct rte_intr_handle *intr_handle);*/ int rte_intr_disable (const struct rte_intr_handle *intr_handle); +/** +* It masks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_mask (const struct rte_intr_handle *intr_handle); + +/** +* It unmasks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_unmask (const struct rte_intr_handle *intr_handle); #ifdef __cplusplus }#endif
lib/librte_eal/freebsd/eal/eal_interrupts.c +54 -0
60 lines not on this page · raw message
lib/librte_eal/linux/eal/eal_interrupts.c +155 -0
167 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +2 -0
@@ -309,6 +309,8 @@ DPDK_19.08 { rte_service_lcore_attr_reset_all; rte_service_may_be_active; rte_srand; + rte_intr_unmask; + rte_intr_mask; } DPDK_19.05;
Signature · 1 line
2.8.4
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 80 lines
-----Original Message-----
From: Nithin Dabilpuram <[email protected]>
Sent: Wednesday, July 17, 2019 1:44 AM
To: Hyong Youb Kim (hyonkim) <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: [email protected]; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]; Nithin Dabilpuram <[email protected]>
Subject: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsAdd new mask and unmask interrupt APIs to avoid using
VFIO_IRQ_SET_ACTION_TRIGGERfor masking/unmasking purpose for VFIO based handlers. This implementation is specific to Linux.Using action trigger for masking and unmasking has below issues
* Time consuming to do for every interrupt received as it will
free_irq()followed byrequest_irq()and all other initializations
* A race condition because of a window betweenfree_irq()andrequest_irq()with packet reception still on and device still enabled and would throw warning messages like below.[158764.159833] do_IRQ: 9.34 No irq handler for vectorIn this patch, mask/unmask is a no-op for VFIO_MSIX/VFIO_MSI interrupts as they are edge triggered and kernel would not mask the interrupt before delivering the event to userspace.
Signed-off-by Nithin Dabilpuram <[email protected]>---
v3:
* Re-org patch to move driver change to 3/3
* Add stub implementation for freebsd.
* Fix version map file for new apis.
v2:
Make change in qede driver for unmasklib/librte_eal/common/include/rte_interrupts.h | 23 ++++ lib/librte_eal/freebsd/eal/eal_interrupts.c | 54 +++++++++ lib/librte_eal/linux/eal/eal_interrupts.c | 155 +++++++++++++++++++++++++ lib/librte_eal/rte_eal_version.map | 2 + 4 files changed, 234 insertions(+)lib/librte_eal/common/include/rte_interrupts.h +23
-0@@ -118,6 +118,29 @@ int rte_intr_enable(const struct rte_intr_handle*intr_handle); */ int rte_intr_disable (const struct rte_intr_handle *intr_handle); +/** +* It masks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_mask (const struct rte_intr_handle *intr_handle); + +/** +* It unmasks the interrupt for the specified handle. +* +* @param intr_handle +* pointer to the interrupt handle. +* +* @return +* - On success, zero. +* - On failure, a negative value. +*/ +int rte_intr_unmask (const struct rte_intr_handle *intr_handle); #ifdef __cplusplus }#endif
[...]
Quoted 5 lines
lib/librte_eal/linux/eal/eal_interrupts.c +0
-0
[...]
Quoted 16 lines
int
lib/librte_eal/linux/eal/eal_interrupts.c +15
-0+rte_intr_mask(const struct rte_intr_handle *intr_handle) +{ +if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV ) +return 0 ; + +if (!intr_handle || intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) +return -1 ; + +switch (intr_handle->type){ +/* Both masking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_disable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX :
lib/librte_eal/linux/eal/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 778
Quoted 10 lines
lib/librte_eal/linux/eal/eal_interrupts.c +10
-0+if (uio_intx_intr_disable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */ +case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ;
Isn't this a little confusing? It returns success, but irq is not masked.
As is, return code 0 means...
- igb_uio: irq is masked for INTx, MSI, MSI-X
- vfio-pci + INTx: irq is masked
- vfio-pci + MSI/MSI-X: no changes
Masking is useful only for INTx, IMO...
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers. Handshaking/masking/unmasking is done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various drivers/NICs to control interrupts their own way.
A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon removed as it was unnecessary overhead (expensive PIOs to NIC for every interrupt). Windows and FreeBSD do not do auto-masking either.
Thanks.
-Hyong
Quoted 92 lines
lib/librte_eal/linux/eal/eal_interrupts.c +73
-0+case RTE_INTR_HANDLE_VFIO_LEGACY : +if (vfio_mask_intx (intr_handle)) +return -1 ; +break ; +#ifdef HAVE_VFIO_DEV_REQ_INTERFACE +case RTE_INTR_HANDLE_VFIO_REQ : +return -1 ; +#endif +#endif +/* not used at this moment */ +case RTE_INTR_HANDLE_DEV_EVENT : +return -1 ; +/* unknown handle type */ +default : +RTE_LOG (ERR ,EAL , +"Unknown handle type of fd %d\n" , + intr_handle->fd); +return -1 ; + } + +return 0 ; +} + +int +rte_intr_unmask (const struct rte_intr_handle *intr_handle) +{ +if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV ) +return 0 ; + +if (!intr_handle || intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) +return -1 ; + +switch (intr_handle->type){ +/* Both unmasking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_enable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX : +if (uio_intx_intr_enable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */ +case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ; +case RTE_INTR_HANDLE_VFIO_LEGACY : +if (vfio_unmask_intx (intr_handle)) +return -1 ; +break ; +#ifdef HAVE_VFIO_DEV_REQ_INTERFACE +case RTE_INTR_HANDLE_VFIO_REQ : +return -1 ; +#endif +#endif +/* not used at this moment */ +case RTE_INTR_HANDLE_DEV_EVENT : +return -1 ; +/* unknown handle type */ +default : +RTE_LOG (ERR ,EAL , +"Unknown handle type of fd %d\n" , + intr_handle->fd); +return -1 ; + } + +return 0 ; +} + +int rte_intr_disable (const struct rte_intr_handle *intr_handle) {if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV )lib/librte_eal/rte_eal_version.map +2
-1@@ -309,6 +309,8 @@ DPDK_19.08 { rte_service_lcore_attr_reset_all; rte_service_may_be_active; rte_srand; + rte_intr_unmask; + rte_intr_mask; } DPDK_19.05; --2.8.4
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 30 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 11:26 AM
To: Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIslib/librte_eal/freebsd/eal/eal_interrupts.c rte_intr_disable(const struct rte_intr_handle *intr_handle)
Quoted 5 lines
lib/librte_eal/freebsd/eal/eal_interrupts.c +5
-0+rte_intr_mask(const struct rte_intr_handle *intr_handle) { + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) + return 0; + + if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd <0)
Quoted 13 lines
lib/librte_eal/linux/eal/eal_interrupts.c +13
-0+return -1 ; + +switch (intr_handle->type){ +/* Both masking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_disable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX : +if (uio_intx_intr_disable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */
Quoted 8 lines
lib/librte_eal/linux/eal/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 778
Quoted 6 lines
lib/librte_eal/linux/eal/eal_interrupts.c +6
-0+case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ;Isn't this a little confusing? It returns success, but irq is not masked.
Yes. How about changing the API to rte_intr_ack()(Acknowledge the interrupt) Or something similar? i.e replace rte_intr_unmask() with rte_intr_ack() for this use case.
Quoted 13 lines
As is, return code 0 means...
-igb_uio: irq is masked for INTx, MSI, MSI-X
- vfio-pci + INTx: irq is masked
- vfio-pci + MSI/MSI-X: no changesMasking is useful only for INTx, IMO...
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers. Handshaking/masking/unmasking is done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various
drivers/NICsto control interrupts their own way.
Quoted 4 lines
A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon removed as it was unnecessary overhead (expensive PIOs to NIC for every interrupt). Windows and FreeBSD do not do auto-masking either.
rte_intr_ack() can abstract FreeBSD and Windows difference.
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 52 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 3:15 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 4 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 11:26 AM
To: Nithin Kumar Dabilpuram <[email protected]>; DavidMarchand
Quoted 26 lines
<[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIslib/librte_eal/freebsd/eal/eal_interrupts.c rte_intr_disable(const struct rte_intr_handle *intr_handle)
Quoted 5 lines
lib/librte_eal/freebsd/eal/eal_interrupts.c +5
-0+rte_intr_mask(const struct rte_intr_handle *intr_handle) { + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) + return 0; + + if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd <0)
Quoted 13 lines
lib/librte_eal/linux/eal/eal_interrupts.c +13
-0+return -1 ; + +switch (intr_handle->type){ +/* Both masking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_disable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX : +if (uio_intx_intr_disable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */ Quoted 8 lines
lib/librte_eal/linux/eal/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 778
Quoted 6 lines
lib/librte_eal/linux/eal/eal_interrupts.c +6
-0+case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ;Isn't this a little confusing? It returns success, but irq is not masked.
Quoted 6 lines
Yes. How about changing the API to rte_intr_ack()(Acknowledge the interrupt)
Or something similar? i.e replacerte_intr_unmask()withrte_intr_ack()for this use
case.
Not sure. I do not have a good suggestion here :-) Like to hear from David when he comes back, as he spent most time on this issue..
Why not return -1 and let the caller deal with it?
Optimist view:
Maintainers will see the error as vfio-pci + MSI/MSI_X is on everyone's test list. And it forces them to confront the issue. Do I really need unmask here, etc.
Pessimist view:
Wastes a lot of people's time. Potentially duplicate code like this everywhere.
if (INTx) unmask();
BTW, are you targeting 19.08 or 19.11? Not sure how much change we can tolerate in 19.08.
Requirements for 19.08 seem to be...
- Must fix the redhat bz (lost interrupt issue with qede + MSI/MSI-X)
- Fix potentially similar issues in other drivers too?
Thanks..
-Hyong
Quoted 21 lines
Quoted 7 lines
As is, return code 0 means...
-igb_uio: irq is masked for INTx, MSI, MSI-X
- vfio-pci + INTx: irq is masked
- vfio-pci + MSI/MSI-X: no changesMasking is useful only for INTx, IMO...
Quoted 8 lines
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers. Handshaking/masking/unmasking is done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various
drivers/NICsto control interrupts their own way.A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon
removed
Quoted 2 lines
as it was unnecessary overhead (expensive PIOs to NIC for every interrupt). Windows and FreeBSD do not do auto-masking either.
rte_intr_ack()can abstract FreeBSD and Windows difference.
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 43 lines
Quoted 6 lines
Quoted 4 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 11:26 AM
To: Nithin Kumar Dabilpuram <[email protected]>; DavidMarchand
Quoted 1 line
<[email protected]>; Thomas Monjalon
Quoted 36 lines
Quoted 35 lines
Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIslib/librte_eal/freebsd/eal/eal_interrupts.c rte_intr_disable(const struct rte_intr_handle *intr_handle)
Quoted 6 lines
lib/librte_eal/freebsd/eal/eal_interrupts.c +6
-0+rte_intr_mask(const struct rte_intr_handle *intr_handle) { + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) + return 0; + + if (!intr_handle || intr_handle->fd < 0 || +intr_handle->uio_cfg_fd <0)
Quoted 9 lines
lib/librte_eal/linux/eal/eal_interrupts.c +9
-0+return -1 ; + +switch (intr_handle->type){ +/* Both masking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_disable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX :lib/librte_eal/linux/eal/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 778
Quoted 10 lines
lib/librte_eal/linux/eal/eal_interrupts.c +10
-0+if (uio_intx_intr_disable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */ +case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ;Isn't this a little confusing? It returns success, but irq is not masked.
Quoted 8 lines
Quoted 5 lines
Yes. How about changing the API to rte_intr_ack()(Acknowledge the interrupt)
Or something similar? i.e replacerte_intr_unmask()withrte_intr_ack()for this use case.Not sure. I do not have a good suggestion here :-) Like to hear from David when he comes back, as he spent most time on this issue..
Sure. He is on vacation.
Any reason for thinking, rte_intr_ack() may not be semantically correct?
I think, it is very much correct if there are no better suggestions.
Anyway it the name, From VFIO perspective, we know what is expected so I think it is fine.
Quoted 2 lines
Why not return -1 and let the caller deal with it?
If we make it as rte_intr_ack() no need to return -1 for MSIX-VFIO+Linux as it is semantically correct.
Quoted 5 lines
Optimist view:
Maintainers will see the error as vfio-pci + MSI/MSI_X is on everyone's test list. And it forces them to confront the issue. Do I really need unmask here, etc.
If we make it as ack then it fine as driver does not need to know the fine details.
Quoted 9 lines
Pessimist view:
Wastes a lot of people's time. Potentially duplicate code like this everywhere.if (INTx) unmask();BTW, are you targeting 19.08 or 19.11? Not sure how much change we can tolerate in 19.08.
19.08 as fundamentally it correct. Finer adjustment can made by existing drivers if required in the testing phase.
It is trivial change as scope is limited to interrupt hander rte_intr_enable() replacement with rte_intr_ack(). For MSIX case, it should be real NOP, so I don't think there issue. It should be much better than the existing state, where almost everything broken.
Quoted 3 lines
Requirements for 19.08 seem to be...
- Must fix the redhat bz (lost interrupt issue with qede + MSI/MSI-X)
- Fix potentially similar issues in other drivers too?
Proposed patch will fix the above mentioned issues.
Quoted 27 lines
Thanks..
-HyongQuoted 9 lines
Quoted 9 lines
As is, return code 0 means...
-igb_uio: irq is masked for INTx, MSI, MSI-X
- vfio-pci + INTx: irq is masked
- vfio-pci + MSI/MSI-X: no changesMasking is useful only for INTx, IMO...
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers. Handshaking/masking/unmasking
is
Quoted 8 lines
Quoted 6 lines
done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various
drivers/NICsto control interrupts their own way.A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon
removed
Quoted 1 line
as it was unnecessary overhead (expensive PIOs to NIC for every
interrupt).
Quoted 4 lines
Quoted 1 line
Windows and FreeBSD do not do auto-masking either.
rte_intr_ack()can abstract FreeBSD and Windows difference.
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 72 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 5:03 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 14 lines
Quoted 6 lines
Quoted 4 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 11:26 AM
To: Nithin Kumar Dabilpuram <[email protected]>; DavidMarchand
Quoted 1 line
<[email protected]>; Thomas Monjalon
Quoted 7 lines
Quoted 7 lines
Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+rte_intr_mask(const struct rte_intr_handle *intr_handle) { + if (intr_handle && intr_handle->type ==
RTE_INTR_HANDLE_VDEV)Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
lib/librte_eal/freebsd/eal/eal_interrupts.c rte_intr_disable(const struct rte_intr_handle *intr_handle)
Quoted 4 lines
lib/librte_eal/freebsd/eal/eal_interrupts.c +4
-0+return 0 ; + +if (!intr_handle || intr_handle->fd <0 || +intr_handle->uio_cfg_fd <0)
Quoted 9 lines
lib/librte_eal/linux/eal/eal_interrupts.c +9
-0+return -1 ; + +switch (intr_handle->type){ +/* Both masking and disabling are same for UIO */ +case RTE_INTR_HANDLE_UIO : +if (uio_intr_disable (intr_handle)) +return -1 ; +break ; +case RTE_INTR_HANDLE_UIO_INTX :lib/librte_eal/linux/eal/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 778
Quoted 10 lines
lib/librte_eal/linux/eal/eal_interrupts.c +10
-0+if (uio_intx_intr_disable (intr_handle)) +return -1 ; +break ; +/* not used at this moment */ +case RTE_INTR_HANDLE_ALARM : +return -1 ; +#ifdef VFIO_PRESENT +case RTE_INTR_HANDLE_VFIO_MSIX : +case RTE_INTR_HANDLE_VFIO_MSI : +return 0 ;Isn't this a little confusing? It returns success, but irq is not masked.
Quoted 8 lines
Quoted 5 lines
Yes. How about changing the API to rte_intr_ack()(Acknowledge the interrupt)
Or something similar? i.e replacerte_intr_unmask()withrte_intr_ack()for this use case.Not sure. I do not have a good suggestion here :-) Like to hear from David when he comes back, as he spent most time on this issue..
Sure. He is on vacation.
Any reason for thinking,rte_intr_ack()may not be semantically correct? I think, it is very much correct if there are no better suggestions. Anyway it the name, From VFIO perspective, we know what is expected so I think it is fine.Quoted 1 line
Quoted 5 lines
Quoted 1 line
Why not return -1 and let the caller deal with it?
If we make it as
rte_intr_ack()no need to return -1 for MSIX-VFIO+Linux as it is semantically correct.
Ack can be ambiguous. For INTx, ack usually means PIO to a NIC register, saying "I got your interrupt, please de-assert irq".
Besides the name, are we agreeing that we want these?
- Unmask if INTx
- Nothing if MSI/MSI-X
So, really just "unmask if INTx". I am ok with rte_intr_unmask() if we make this intention clear. rte_unmask_if_intx() looks messy.
Thanks..
-Hyong
Quoted 63 lines
Quoted 5 lines
Optimist view:
Maintainers will see the error as vfio-pci + MSI/MSI_X is on everyone's test list. And it forces them to confront the issue. Do I really need unmask here, etc.If we make it as ack then it fine as driver does not need to know the fine details.
Quoted 9 lines
Pessimist view:
Wastes a lot of people's time. Potentially duplicate code like this everywhere.if (INTx) unmask();BTW, are you targeting 19.08 or 19.11? Not sure how much change we can tolerate in 19.08.
19.08 as fundamentally it correct. Finer adjustment can made by existing drivers if required in the testing phase.
It is trivial change as scope is limited to interrupt hander
rte_intr_enable()replacement withrte_intr_ack(). For MSIX case, it should be real NOP, so I don't think there issue. It should be much better than the existing state, where almost everything broken.Quoted 3 lines
Requirements for 19.08 seem to be...
- Must fix the redhat bz (lost interrupt issue with qede + MSI/MSI-X)
- Fix potentially similar issues in other drivers too?Proposed patch will fix the above mentioned issues.
Quoted 13 lines
Thanks..
-HyongQuoted 9 lines
Quoted 9 lines
As is, return code 0 means...
-igb_uio: irq is masked for INTx, MSI, MSI-X
- vfio-pci + INTx: irq is masked
- vfio-pci + MSI/MSI-X: no changesMasking is useful only for INTx, IMO...
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers.
Handshaking/masking/unmasking
Quoted 3 lines
is
Quoted 2 lines
Quoted 2 lines
done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various
drivers/NICsto
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
control interrupts their own way.
A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon
removed
Quoted 1 line
as it was unnecessary overhead (expensive PIOs to NIC for every
interrupt).
Quoted 4 lines
Quoted 1 line
Windows and FreeBSD do not do auto-masking either.
rte_intr_ack()can abstract FreeBSD and Windows difference.
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
Not sure. I do not have a good suggestion here :-) Like to hear from David when he comes back, as he spent most time on this issue..
Sure. He is on vacation.
Any reason for thinking,rte_intr_ack()may not be semantically correct? I think, it is very much correct if there are no better suggestions. Anyway it the name, From VFIO perspective, we know what is expected so I think it is fine.Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Why not return -1 and let the caller deal with it?
If we make it as
rte_intr_ack()no need to return -1 for MSIX-VFIO+Linux as it is semantically correct.Ack can be ambiguous. For INTx, ack usually means PIO to a NIC register, saying "I got your interrupt, please de-assert irq".
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC register(Source) PoV. Since the API starts from rte_intr_* it is more of controller so _ack_ make sense Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports it
3) if it is ack, no need to add unmask counterpart, the _mask_ API
Quoted 3 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTx
Yes
Quoted 1 line
- Nothing if MSI/MSI-X
Yes for MSI over VFIO
No for MSI over UIO/igb_uio
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above. If you really have strong opinion on using unmask, we will stick with that to make forward progress. Let us know.
Quoted 6 lines
So, really just "unmask if INTx". I am ok with
rte_intr_unmask()if we make this intention clear.rte_unmask_if_intx()looks messy.Thanks..
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 32 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 6:21 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 7 lines
Quoted 7 lines
Quoted 2 lines
Not sure. I do not have a good suggestion here :-) Like to hear from David when he comes back, as he spent most time on this issue..
Sure. He is on vacation.
Any reason for thinking,rte_intr_ack()may not be semantically correct? I think, it is very much correct if there are no better suggestions. Anyway it the name, From VFIO perspective, we know what is expectedso
Quoted 11 lines
Quoted 8 lines
I think it is fine.
Quoted 2 lines
Why not return -1 and let the caller deal with it?
If we make it as
rte_intr_ack()no need to return -1 for MSIX-VFIO+Linux as it is semantically correct.Ack can be ambiguous. For INTx, ack usually means PIO to a NIC register, saying "I got your interrupt, please de-assert irq".
Quoted 11 lines
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC register(Source) PoV.
Since the API starts from rte_intr_* it is more of controller so _ack_ make sense
Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports
it
3) if it is ack, no need to add unmask counterpart, the _mask_ API
Just curious, what you mean by irq controller? Ack/mask/unmask PIOs all go to the NIC. It is the NIC that asserts/de-asserts irq..
Quoted 10 lines
Quoted 3 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTxYes
Quoted 1 line
- Nothing if MSI/MSI-X
Yes for MSI over VFIO
No for MSI over UIO/igb_uio
I guess I was not clear. For MSI/MSI-X, we do not want to do mask/unmask regardless of vfio-pci/igb_uio. Below is my comment about linux/windows/freebsd from an earlier email. Do you disagree? I am sure there are plenty of kernel NIC driver guys here. Please correct me if I am mistaken...
---
Masking is useful only for INTx, IMO...
Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X Table) has no practical use for drivers. Handshaking/masking/unmasking is done via device/vendor specific ways, as needed. See all those ack/block/unblock/credit/... mechanisms used in various drivers/NICs to control interrupts their own way.
A long time ago in early PCIe days, the linux kernel did auto-masking for MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon removed as it was unnecessary overhead (expensive PIOs to NIC for every interrupt). Windows and FreeBSD do not do auto-masking either.
---
Most drivers have a single irq callback.
handler() {
do_action()
rte_intr_umask/ack()
}
Suppose MSI/MSI-X is used (super likely since it is the default). With igb_uio, rte_intr_umask/ack() will actually do PIO writes to the NIC to unmask. This is unnecessary overhead.
Quoted 6 lines
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above.
If you really have strong opinion on using unmask, we will stick with that to make forward progress.
Let us know.
I have no strong opinion either.
Thanks..
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 11 lines
Quoted 10 lines
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC
register(Source) PoV.
Since the API starts from rte_intr_* it is more of controller so _ack_ make sense Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports it
3) if it is ack, no need to add unmask counterpart, the _mask_ API
Quoted 1 line
Just curious, what you mean by irq controller? Ack/mask/unmask PIOs all go
Programmable Interrupt Controller. Like Intel 8259A, GIC from ARM etc The drivers in linux/drivers/irqchip/
Quoted 13 lines
to the NIC. It is the NIC that asserts/de-asserts irq..
Quoted 10 lines
Quoted 3 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTxYes
Quoted 1 line
- Nothing if MSI/MSI-X
Yes for MSI over VFIO
No for MSI over UIO/igb_uio
Quoted 5 lines
I guess I was not clear. For MSI/MSI-X, we do not want to do mask/unmask regardless of vfio-pci/igb_uio. Below is my comment about linux/windows/freebsd from an earlier email. Do you disagree? I am sure there are plenty of kernel NIC driver guys here. Please correct me if I am mistaken...
For some reason, igb_uio kernel driver mask the interrupt for MSIx. We need to ack or unmask if needs to work with MSIX + IGB_UIO.
Seepci_uio_alloc_resource()
if (dev->kdrv == RTE_KDRV_IGB_UIO)
dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
else {
dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;igbuio_pci_irqcontrol() for masking in kernel.
So it is more of making inline with igb_uio kernel driver AND not break The existing drivers which was using rte_intr_enable in ISR with MSIX+IGB_UIO
I do agree with that for edge trigged interrupt mask may not require from kernel. But I am not sure why it is added in igb_uio kernel driver. May be it is just legacy. Anyway this wont change schematics, when igb_uio kenrel fixed then the counter Part can be changed in rte_intr_ack(). Ie. it is transparent to drivers.
Quoted 9 lines
Quoted 7 lines
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above.
If you really have strong opinion on using unmask, we will stick with that to make forward progress.
Let us know.I have no strong opinion either.
OK. Lets stick with rte_intr_ack().
Quoted 3 lines
Thanks..
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 52 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 7:44 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 11 lines
Quoted 10 lines
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC
register(Source) PoV.
Since the API starts from rte_intr_* it is more of controller so _ack_ make sense Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports it
3) if it is ack, no need to add unmask counterpart, the _mask_ APIQuoted 1 line
Just curious, what you mean by irq controller? Ack/mask/unmask PIOs all
go
Programmable Interrupt Controller. Like Intel 8259A, GIC from ARM etc The drivers in linux/drivers/irqchip/
Quoted 13 lines
to the NIC. It is the NIC that asserts/de-asserts irq..
Quoted 10 lines
Quoted 3 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTxYes
Quoted 1 line
- Nothing if MSI/MSI-X
Yes for MSI over VFIO
No for MSI over UIO/igb_uioQuoted 5 lines
I guess I was not clear. For MSI/MSI-X, we do not want to do mask/unmask regardless of vfio-pci/igb_uio. Below is my comment about linux/windows/freebsd from an earlier email. Do you disagree? I am sure there are plenty of kernel NIC driver guys here. Please correct me if I am mistaken...
For some reason,
igb_uiokernel driver mask the interrupt for MSIx. We need to ack or unmask if needs to work with MSIX +IGB_UIO.
Quoted 9 lines
See
pci_uio_alloc_resource()if (dev->kdrv == RTE_KDRV_IGB_UIO) dev->intr_handle.type = RTE_INTR_HANDLE_UIO; else { dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
igbuio_pci_irqcontrol()for masking in kernel.
igb_uio does not auto-mask MSI/MSI-X.
static irqreturn_tigbuio_pci_irqhandler(int irq, void *dev_id)
{
struct rte_uio_pci_dev *udev = (struct rte_uio_pci_dev *)dev_id;
struct uio_info *info = &udev->info;
/* Legacy mode need to mask in hardware */
if (udev->mode == RTE_INTR_MODE_LEGACY &&
!pci_check_and_mask_intx(udev->pdev))
return IRQ_NONE;
uio_event_notify(info);
/* Message signal mode, no share IRQ and automasked */
return IRQ_HANDLED;
}Also tested just now with igb_uio. The driver does not need to call rte_intr_enable(), and it keeps getting interrupts without any issues.
Am I missing something?
-Hyong
Quoted 27 lines
So it is more of making inline with
igb_uiokernel driver AND not break The existing drivers which was usingrte_intr_enablein ISR with MSIX+IGB_UIOI do agree with that for edge trigged interrupt mask may not require from kernel.
But I am not sure why it is added inigb_uiokernel driver. May be it is just legacy.
Anyway this wont change schematics, whenigb_uiokenrel fixed then the counter
Part can be changed inrte_intr_ack(). Ie. it is transparent to drivers.Quoted 9 lines
Quoted 7 lines
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above.
If you really have strong opinion on using unmask, we will stick with that to make forward progress.
Let us know.I have no strong opinion either.
OK. Lets stick with
rte_intr_ack().Quoted 3 lines
Thanks..
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 74 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 4:36 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 6 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 7:44 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas MonjalonQuoted 55 lines
Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 11 lines
Quoted 10 lines
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC
register(Source) PoV.
Since the API starts from rte_intr_* it is more of controller so _ack_ make sense Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports it
3) if it is ack, no need to add unmask counterpart, the _mask_ APIQuoted 2 lines
Just curious, what you mean by irq controller? Ack/mask/unmask PIOs all
go
Programmable Interrupt Controller. Like Intel 8259A, GIC from ARM etc The drivers in linux/drivers/irqchip/
Quoted 13 lines
to the NIC. It is the NIC that asserts/de-asserts irq..
Quoted 10 lines
Quoted 3 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTxYes
Quoted 1 line
- Nothing if MSI/MSI-X
Yes for MSI over VFIO
No for MSI over UIO/igb_uioQuoted 5 lines
I guess I was not clear. For MSI/MSI-X, we do not want to do mask/unmask regardless of vfio-pci/igb_uio. Below is my comment about linux/windows/freebsd from an earlier email. Do you disagree? I am sure there are plenty of kernel NIC driver guys here. Please correct me if I am mistaken...
For some reason,
igb_uiokernel driver mask the interrupt for MSIx. We need to ack or unmask if needs to work with MSIX +IGB_UIO.See
pci_uio_alloc_resource()if (dev->kdrv == RTE_KDRV_IGB_UIO) dev->intr_handle.type = RTE_INTR_HANDLE_UIO; else { dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
Quoted 4 lines
Quoted 2 lines
igbuio_pci_irqcontrol()for masking in kernel.
igb_uiodoes not auto-mask MSI/MSI-X.
I have not tested igbuio as we don't specific NIC + IGB_UIO platform.
The observation based on following code. see code under HAVE_PCI_MSI_MASK_IRQ
static intigbuio_pci_irqcontrol(struct uio_info *info, s32 irq_state)
{
struct rte_uio_pci_dev *udev = info->priv;
struct pci_dev *pdev = udev->pdev;#ifdef HAVE_PCI_MSI_MASK_IRQ
struct irq_data *irq = irq_get_irq_data(udev->info.irq);#endif
pci_cfg_access_lock(pdev);
if (udev->mode == RTE_INTR_MODE_MSIX || udev->mode == RTE_INTR_MODE_MSI) {
#ifdef HAVE_PCI_MSI_MASK_IRQ
if (irq_state == 1)
pci_msi_unmask_irq(irq);
else
pci_msi_mask_irq(irq);
#else
igbuio_mask_irq(pdev, udev->mode, irq_state);
#endif
}
if (udev->mode == RTE_INTR_MODE_LEGACY)
pci_intx(pdev, !!irq_state);
pci_cfg_access_unlock(pdev);
return 0;
}Quoted 17 lines
static
irqreturn_tigbuio_pci_irqhandler(int irq, void *dev_id) { struct rte_uio_pci_dev *udev = (struct rte_uio_pci_dev *)dev_id; struct uio_info *info = &udev->info; /* Legacy mode need to mask in hardware */ if (udev->mode == RTE_INTR_MODE_LEGACY && !pci_check_and_mask_intx(udev->pdev)) return IRQ_NONE; uio_event_notify(info); /* Message signal mode, no share IRQ and automasked */ return IRQ_HANDLED; }
Quoted 2 lines
Also tested just now with
igb_uio. The driver does not need to callrte_intr_enable(), and it keeps getting interrupts without any issues.
If you are sure, we can make MSIX+IGB_UIO as NOP in rte_intr_ack()
Quoted 31 lines
Am I missing something?
-Hyong
Quoted 27 lines
So it is more of making inline with
igb_uiokernel driver AND not break The existing drivers which was usingrte_intr_enablein ISR with MSIX+IGB_UIOI do agree with that for edge trigged interrupt mask may not require from kernel.
But I am not sure why it is added inigb_uiokernel driver. May be it is just legacy.
Anyway this wont change schematics, whenigb_uiokenrel fixed then the counter Part can be changed inrte_intr_ack(). Ie. it is transparent to drivers.Quoted 9 lines
Quoted 7 lines
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above.
If you really have strong opinion on using unmask, we will stick with that to make forward progress.
Let us know.I have no strong opinion either.
OK. Lets stick with
rte_intr_ack().Quoted 3 lines
Thanks..
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs
Quoted 119 lines · Jerin Jacob Kollanukkaran
Quoted 69 lines
-----Original Message-----
From: Hyong Youb Kim (hyonkim) <[email protected]>
Sent: Wednesday, July 17, 2019 4:36 PM
To: Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 6 lines
-----Original Message-----
From: Jerin Jacob Kollanukkaran <[email protected]>
Sent: Wednesday, July 17, 2019 7:44 PM
To: Hyong Youb Kim (hyonkim) <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; David Marchand <[email protected]>; Thomas MonjalonQuoted 50 lines
Ferruh Yigit <[email protected]>; Bruce Richardson <[email protected]>
Cc: John Daley (johndale) <[email protected]>; Shahed Shaikh <[email protected]>; [email protected]
Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIsQuoted 10 lines
Quoted 10 lines
I think, it vary from the perspective of IRQ Chip(or controller) vs NIC
register(Source) PoV.
Since the API starts from rte_intr_* it is more of controller so _ack_ make sense Other reason for ack:
1) It will enforce that it needs to be called form ISR
2) It would be have been really correct to unmask if VFIO+MSIx+Linux supports it
3) if it is ack, no need to add unmask counterpart, the _mask_ APIQuoted 2 lines
Just curious, what you mean by irq controller? Ack/mask/unmask PIOs all
go
Programmable Interrupt Controller. Like Intel 8259A, GIC from ARM etc The drivers in linux/drivers/irqchip/
Quoted 7 lines
to the NIC. It is the NIC that asserts/de-asserts irq..
Quoted 5 lines
Quoted 2 lines
Besides the name, are we agreeing that we want these?
- Unmask if INTxYes
Quoted 1 line
- Nothing if MSI/MSI-X
Quoted 8 lines
Quoted 3 lines
Yes for MSI over VFIO
No for MSI over UIO/igb_uioI guess I was not clear. For MSI/MSI-X, we do not want to do mask/unmask regardless of vfio-pci/igb_uio. Below is my comment about linux/windows/freebsd from an earlier email. Do you disagree? I am sure there are plenty of kernel NIC driver guys here. Please correct me if I am mistaken...
For some reason,
igb_uiokernel driver mask the interrupt for MSIx. We need to ack or unmask if needs to work with MSIX +IGB_UIO.See
pci_uio_alloc_resource()if (dev->kdrv == RTE_KDRV_IGB_UIO) dev->intr_handle.type = RTE_INTR_HANDLE_UIO; else { dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;Quoted 3 lines
Quoted 2 lines
igbuio_pci_irqcontrol()for masking in kernel.
igb_uiodoes not auto-mask MSI/MSI-X.I have not tested igbuio as we don't specific NIC +
IGB_UIOplatform.The observation based on following code. see code under
HAVE_PCI_MSI_MASK_IRQstatic int
igbuio_pci_irqcontrol(struct uio_info *info, s32 irq_state){ struct rte_uio_pci_dev *udev = info->priv; struct pci_dev *pdev = udev->pdev;#ifdef HAVE_PCI_MSI_MASK_IRQ struct irq_data *irq = irq_get_irq_data(udev->info.irq);#endif
pci_cfg_access_lock(pdev); if (udev->mode == RTE_INTR_MODE_MSIX || udev->mode == RTE_INTR_MODE_MSI) { #ifdef HAVE_PCI_MSI_MASK_IRQ if (irq_state == 1) pci_msi_unmask_irq(irq); else pci_msi_mask_irq(irq); #else igbuio_mask_irq(pdev, udev->mode, irq_state); #endif } if (udev->mode == RTE_INTR_MODE_LEGACY) pci_intx(pdev, !!irq_state); pci_cfg_access_unlock(pdev); return 0; }Quoted 12 lines
static
irqreturn_tigbuio_pci_irqhandler(int irq, void *dev_id) { struct rte_uio_pci_dev *udev = (struct rte_uio_pci_dev *)dev_id; struct uio_info *info = &udev->info; /* Legacy mode need to mask in hardware */ if (udev->mode == RTE_INTR_MODE_LEGACY && !pci_check_and_mask_intx(udev->pdev)) return IRQ_NONE; uio_event_notify(info);
Quoted 7 lines
Quoted 6 lines
/* Message signal mode, no share IRQ and automasked */ return IRQ_HANDLED; }Also tested just now with
igb_uio. The driver does not need to callrte_intr_enable(), and it keeps getting interrupts without any issues.If you are sure, we can make MSIX+IGB_UIO as NOP in
rte_intr_ack()
Ok. Another problem is that we might not be able to distinguish in case of IGB_UIO
at rte_intr_ack() level if underlying interrupt is a INTx or MSIx. See igbuio_pci_enable_interrupts() that
finds and stores that mode in uio->mode.
So we think leaving the behavior as earlier is needed and simpler as it meets the current expectation.
Quoted 28 lines
Quoted 28 lines
Am I missing something?
-Hyong
Quoted 23 lines
So it is more of making inline with
igb_uiokernel driver AND not break The existing drivers which was usingrte_intr_enablein ISR with MSIX+IGB_UIOI do agree with that for edge trigged interrupt mask may not require from kernel.
But I am not sure why it is added inigb_uiokernel driver. May be it is just legacy.
Anyway this wont change schematics, whenigb_uiokenrel fixed then the counter Part can be changed inrte_intr_ack(). Ie. it is transparent to drivers.Quoted 7 lines
Quoted 6 lines
I don't have very strong opinion unmask vs ack. I prefer to have ack due the reasons stated above.
If you really have strong opinion on using unmask, we will stick with that to make forward progress.
Let us know.I have no strong opinion either.
OK. Lets stick with
rte_intr_ack().Quoted 2 lines
Thanks..
-Hyong
RFC PATCH v3 3/3 drivers/net: use unmask API in interrupt handlers
In reply to Nithin DabilpuramReplace rte_intr_enable() with rte_intr_unmask() API
for unmasking in interrupt handlers and rx_queue_intr_enable() in callbacks of PMD's whose original intent was to unmask interrupts after handling is completed if device is backed by UIO, IGB_UIO or VFIO(with INTx).
---
v3:
* Change all PMD's that use rte_intr_enable() in
rx_queue_intr_enable() or in irq handler to use
new unmask api.
drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/avp/avp_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.c | 4 ++-- drivers/net/bnx2x/bnx2x_ethdev.c | 2 +- drivers/net/e1000/em_ethdev.c | 4 ++-- drivers/net/e1000/igb_ethdev.c | 6 +++--- drivers/net/fm10k/fm10k_ethdev.c | 6 +++--- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/iavf/iavf_ethdev.c | 2 +- drivers/net/ice/ice_ethdev.c | 4 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 6 +++--- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/qede/qede_ethdev.c | 8 ++++---- drivers/net/sfc/sfc_intr.c | 4 ++-- drivers/net/virtio/virtio_ethdev.c | 16 +++++++++++++++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- 16 files changed, 43 insertions(+), 29 deletions(-)
drivers/net/atlantic/atl_ethdev.c +1 -1
@@ -1394,7 +1394,7 @@ atl_dev_interrupt_action(struct rte_eth_dev *dev, } done:atl_enable_intr (dev); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
drivers/net/avp/avp_ethdev.c +1 -1
@@ -713,7 +713,7 @@ avp_dev_interrupt_handler(void *data) status);/* re-enable UIO interrupt handling */ - ret =rte_intr_enable (&pci_dev->intr_handle); + ret =rte_intr_unmask (&pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to re-enable UIO interrupts, ret=%d\n" , ret);
drivers/net/axgbe/axgbe_ethdev.c +2 -2
@@ -136,8 +136,8 @@ axgbe_dev_interrupt_handler(void *param) DMA_CH_SR, dma_ch_isr); } } -/* Enable interrupts since disabled after generation*/ -rte_intr_enable (&pdata->pci_dev->intr_handle); +/* Unmask interrupts since disabled after generation*/ +rte_intr_unmask (&pdata->pci_dev->intr_handle); }/*
drivers/net/bnx2x/bnx2x_ethdev.c +1 -1
@@ -133,7 +133,7 @@ bnx2x_interrupt_handler(void *param)PMD_DEBUG_PERIODIC_LOG (INFO , sc,"Interrupt handled" );bnx2x_interrupt_action (dev,1 ); -rte_intr_enable (&sc->pci_dev->intr_handle); +rte_intr_unmask (&sc->pci_dev->intr_handle); }static void bnx2x_periodic_start (void *param)
drivers/net/e1000/em_ethdev.c +2 -2
@@ -1001,7 +1001,7 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queuestruct rte_intr_handle *intr_handle = &pci_dev->intr_handle;em_rxq_intr_enable (hw); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
@@ -1568,7 +1568,7 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,return -1 ; intr->flags &= ~E1000_FLAG_NEED_LINK_UPDATE ; -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);/* set get_link_status to check register later */ hw->mac.get_link_status =1 ;
drivers/net/e1000/igb_ethdev.c +3 -3
@@ -2876,7 +2876,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev, }igb_intr_enable (dev); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);if (intr->flags &E1000_FLAG_NEED_LINK_UPDATE ) { intr->flags &= ~E1000_FLAG_NEED_LINK_UPDATE ;
@@ -2987,7 +2987,7 @@ eth_igbvf_interrupt_action(struct rte_eth_dev *dev, struct rte_intr_handle *intr }igbvf_intr_enable (dev); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
@@ -5500,7 +5500,7 @@ eth_igb_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)E1000_WRITE_REG (hw,E1000_EIMS , regval | mask);E1000_WRITE_FLUSH (hw); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
drivers/net/fm10k/fm10k_ethdev.c +3 -3
@@ -2381,7 +2381,7 @@ fm10k_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)else FM10K_WRITE_REG (hw,FM10K_VFITR (Q2V (pdev, queue_id)),FM10K_ITR_AUTOMASK |FM10K_ITR_MASK_CLEAR ); -rte_intr_enable (&pdev->intr_handle); +rte_intr_unmask (&pdev->intr_handle);return 0 ; }
@@ -2680,7 +2680,7 @@ fm10k_dev_interrupt_handler_pf(void *param)FM10K_WRITE_REG (hw,FM10K_ITR (0 ),FM10K_ITR_AUTOMASK |FM10K_ITR_MASK_CLEAR );/* Re-enable interrupt from host side */ -rte_intr_enable (dev->intr_handle); +rte_intr_unmask (dev->intr_handle); }/**
@@ -2760,7 +2760,7 @@ fm10k_dev_interrupt_handler_vf(void *param)FM10K_WRITE_REG (hw,FM10K_VFITR (0 ),FM10K_ITR_AUTOMASK |FM10K_ITR_MASK_CLEAR );/* Re-enable interrupt from host side */ -rte_intr_enable (dev->intr_handle); +rte_intr_unmask (dev->intr_handle); }/* Mailbox message handler in VF */
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -11646,7 +11646,7 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) I40E_PFINT_DYN_CTLN_ITR_INDX_MASK);I40E_WRITE_FLUSH (hw); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle);return 0 ; }
drivers/net/iavf/iavf_ethdev.c +1 -1
@@ -1098,7 +1098,7 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)IAVF_WRITE_FLUSH (hw); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle);return 0 ; }
drivers/net/ice/ice_ethdev.c +2 -2
@@ -1118,7 +1118,7 @@ ice_interrupt_handler(void *param) done:/* Enable interrupt */ ice_pf_enable_irq0 (hw); -rte_intr_enable (dev->intr_handle); +rte_intr_unmask (dev->intr_handle); }/* Initialize SW parameters of PF */
@@ -3002,7 +3002,7 @@ static int ice_rx_queue_intr_enable(struct rte_eth_dev *dev, val &= ~GLINT_DYN_CTL_WB_ON_ITR_M ;ICE_WRITE_REG (hw,GLINT_DYN_CTL (msix_intr), val); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle);return 0 ; }
drivers/net/ixgbe/ixgbe_ethdev.c +3 -3
@@ -4502,7 +4502,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param)PMD_DRV_LOG (DEBUG ,"enable intr in delayed handler S[%08x]" , eicr);ixgbe_enable_intr (dev); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle); }/**
@@ -5763,7 +5763,7 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , intr->mask); -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
@@ -5812,7 +5812,7 @@ ixgbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) mask &= (1 << (queue_id -32 ));IXGBE_WRITE_REG (hw,IXGBE_EIMS_EX (1 ), mask); } -rte_intr_enable (intr_handle); +rte_intr_unmask (intr_handle);return 0 ; }
drivers/net/nfp/nfp_net.c +1 -1
@@ -1412,7 +1412,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)if (hw->ctrl &NFP_NET_CFG_CTRL_MSIXAUTO ) {/* If MSI-X auto-masking is used, clear the entry */ rte_wmb (); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle); }else {/* Make sure all updates are written before un-masking */ rte_wmb ();
drivers/net/qede/qede_ethdev.c +4 -4
@@ -248,8 +248,8 @@ qede_interrupt_handler_intx(void *param)if (status &0x1 ) {qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); } }
@@ -261,8 +261,8 @@ qede_interrupt_handler(void *param)struct ecore_dev *edev = &qdev->edev;qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); } static void
drivers/net/sfc/sfc_intr.c +2 -2
@@ -79,7 +79,7 @@ sfc_intr_line_handler(void *cb_arg)if (qmask & (1 << sa->mgmt_evq_index))sfc_intr_handle_mgmt_evq (sa); -if (rte_intr_enable (&pci_dev->intr_handle) !=0 ) +if (rte_intr_unmask (&pci_dev->intr_handle) !=0 )sfc_err (sa,"cannot reenable interrupts" );sfc_log_init (sa,"done" );
@@ -123,7 +123,7 @@ sfc_intr_message_handler(void *cb_arg)sfc_intr_handle_mgmt_evq (sa); -if (rte_intr_enable (&pci_dev->intr_handle) !=0 ) +if (rte_intr_unmask (&pci_dev->intr_handle) !=0 )sfc_err (sa,"cannot reenable interrupts" );sfc_log_init (sa,"done" );
drivers/net/virtio/virtio_ethdev.c +15 -1
@@ -1265,6 +1265,20 @@ virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) }static int +virtio_intr_unmask (struct rte_eth_dev *dev) +{ +struct virtio_hw *hw = dev->data->dev_private; + +if (rte_intr_unmask (dev->intr_handle) <0 ) +return -1 ; + +if (!hw->virtio_user_dev) + hw->use_msix =vtpci_msix_detect (RTE_ETH_DEV_TO_PCI (dev)); + +return 0 ; +} + +static int virtio_intr_enable (struct rte_eth_dev *dev) {struct virtio_hw *hw = dev->data->dev_private;
@@ -1457,7 +1471,7 @@ virtio_interrupt_handler(void *param) isr =vtpci_isr (hw);PMD_DRV_LOG (INFO ,"interrupt status = %#x" , isr); -if (virtio_intr_enable (dev) <0 ) +if (virtio_intr_unmask (dev) <0 )PMD_DRV_LOG (ERR ,"interrupt enable failed" );if (isr &VIRTIO_PCI_ISR_CONFIG ) {
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -1
@@ -1426,7 +1426,7 @@ vmxnet3_interrupt_handler(void *param)vmxnet3_process_events (dev); -if (rte_intr_enable (&pci_dev->intr_handle) <0 ) +if (rte_intr_unmask (&pci_dev->intr_handle) <0 )PMD_DRV_LOG (ERR ,"interrupt enable failed" ); }
Signature · 1 line
2.8.4
Re: [dpdk-dev] [RFC PATCH v3 3/3] drivers/net: use unmask API in interrupt handlers
Quoted 3 lines
-----Original Message-----
From: Nithin Dabilpuram <[email protected]>
Sent: Wednesday, July 17, 2019 1:44 AM
[...]
Quoted 35 lines
Subject: [RFC PATCH v3 3/3]
drivers/net: use unmask API in interrupt handlersReplace
rte_intr_enable()withrte_intr_unmask()API
for unmasking in interrupt handlers andrx_queue_intr_enable()in callbacks of PMD's whose original intent was to unmask interrupts after handling is completed if device is backed by UIO,IGB_UIOor VFIO(with INTx).Signed-off-by Nithin Dabilpuram <[email protected]>---
v3:
* Change all PMD's that userte_intr_enable()in
rx_queue_intr_enable()or in irq handler to use
new unmask api.drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/avp/avp_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.c | 4 ++-- drivers/net/bnx2x/bnx2x_ethdev.c | 2 +- drivers/net/e1000/em_ethdev.c | 4 ++-- drivers/net/e1000/igb_ethdev.c | 6 +++--- drivers/net/fm10k/fm10k_ethdev.c | 6 +++--- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/iavf/iavf_ethdev.c | 2 +- drivers/net/ice/ice_ethdev.c | 4 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 6 +++--- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/qede/qede_ethdev.c | 8 ++++---- drivers/net/sfc/sfc_intr.c | 4 ++-- drivers/net/virtio/virtio_ethdev.c | 16 +++++++++++++++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- 16 files changed, 43 insertions(+), 29 deletions(-)
[...]
drivers/net/nfp/nfp_net.c nfp_net_irq_unmask(struct rte_eth_dev *dev) · line 1415
Quoted 10 lines
drivers/net/nfp/nfp_net.c +1
-1@@ -1412,7 +1412,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)if (hw->ctrl &NFP_NET_CFG_CTRL_MSIXAUTO ) {/* If MSI-X auto-masking is used, clear the entry */ rte_wmb (); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle);
I mentioned this part earlier. The comment suggests the driver really needs to clear Mask bit in MSI-X Table, if MSI-X is used? rte_intr_unmask() + vfio-pci does not do that. The maintainers should say something..
[...]
Quoted 17 lines
drivers/net/qede/qede_ethdev.c +2
-2@@ -248,8 +248,8 @@ qede_interrupt_handler_intx(void *param)if (status &0x1 ) {qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); } }
drivers/net/qede/qede_ethdev.c qede_interrupt_handler(void *param) · line 266
Quoted 8 lines
drivers/net/qede/qede_ethdev.c +2
-2@@ -261,8 +261,8 @@ qede_interrupt_handler(void *param)struct ecore_dev *edev = &qdev->edev;qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); }
I thought you were going to remove rte_intr_enable from this handler altogether.
[...]
Thanks.
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 3/3] drivers/net: use unmask API in interrupt handlers
Quoted 40 lines · Hyong Youb Kim (hyonkim)
Quoted 3 lines
-----Original Message-----
From: Nithin Dabilpuram <[email protected]>
Sent: Wednesday, July 17, 2019 1:44 AM[...]
Quoted 35 lines
Subject: [RFC PATCH v3 3/3]
drivers/net: use unmask API in interrupt handlersReplace
rte_intr_enable()withrte_intr_unmask()API
for unmasking in interrupt handlers andrx_queue_intr_enable()in callbacks of PMD's whose original intent was to unmask interrupts after handling is completed if device is backed by UIO,IGB_UIOor VFIO(with INTx).Signed-off-by Nithin Dabilpuram <[email protected]>---
v3:
* Change all PMD's that userte_intr_enable()in
rx_queue_intr_enable()or in irq handler to use
new unmask api.drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/avp/avp_ethdev.c | 2 +- drivers/net/axgbe/axgbe_ethdev.c | 4 ++-- drivers/net/bnx2x/bnx2x_ethdev.c | 2 +- drivers/net/e1000/em_ethdev.c | 4 ++-- drivers/net/e1000/igb_ethdev.c | 6 +++--- drivers/net/fm10k/fm10k_ethdev.c | 6 +++--- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/iavf/iavf_ethdev.c | 2 +- drivers/net/ice/ice_ethdev.c | 4 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 6 +++--- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/qede/qede_ethdev.c | 8 ++++---- drivers/net/sfc/sfc_intr.c | 4 ++-- drivers/net/virtio/virtio_ethdev.c | 16 +++++++++++++++- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- 16 files changed, 43 insertions(+), 29 deletions(-)[...]
Quoted 16 lines
drivers/net/nfp/nfp_net.c nfp_net_irq_unmask(struct rte_eth_dev *dev) · line 1415
Quoted 10 lines
drivers/net/nfp/nfp_net.c +1
-1@@ -1412,7 +1412,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)if (hw->ctrl &NFP_NET_CFG_CTRL_MSIXAUTO ) {/* If MSI-X auto-masking is used, clear the entry */ rte_wmb (); -rte_intr_enable (&pci_dev->intr_handle); +rte_intr_unmask (&pci_dev->intr_handle);I mentioned this part earlier. The comment suggests the driver really needs to clear Mask bit in MSI-X Table, if MSI-X is used?
rte_intr_unmask()+ vfio-pci does not do that. The maintainers should say something..
Ok, if this comment meant that rte_intr_enable() is a must even with VFIO-MSIX, then I can leave it as it is with rte_intr_unmask(). If it for MSIX interrupts via IGB_UIO, then rte_intr_unmask() will work.
Quoted 20 lines
[...]
Quoted 19 lines
drivers/net/qede/qede_ethdev.c +2
-2@@ -248,8 +248,8 @@ qede_interrupt_handler_intx(void *param)if (status &0x1 ) {qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); } }@@ -261,8 +261,8 @@ qede_interrupt_handler(void *param)struct ecore_dev *edev = &qdev->edev;
Quoted 10 lines
drivers/net/qede/qede_ethdev.c qede_interrupt_handler_intx(void *param) · line 253
Quoted 6 lines
drivers/net/qede/qede_ethdev.c +2
-2qede_interrupt_action (ECORE_LEADING_HWFN (edev)); -if (rte_intr_enable (eth_dev->intr_handle)) -DP_ERR (edev,"rte_intr_enable failed\n" ); +if (rte_intr_unmask (eth_dev->intr_handle)) +DP_ERR (edev,"rte_intr_unmask failed\n" ); }I thought you were going to remove
rte_intr_enablefrom this handler altogether.
Here again, if it was done for case of IGB_UIO with MSIx, then I think it is needed. If maintainer confirms that it is not needed in this i.e qede_interrupt_handler(), then I can remove this unmask.
Quoted 5 lines
[...]
Thanks.
-Hyong
Re: [dpdk-dev] [RFC PATCH v3 1/3] vfio: revert change that does intr eventfd setup at probe
In reply to Nithin DabilpuramQuoted 20 lines · On Tue, 16 Jul 2019 22:14:22 +0530 Nithin Dabilpuram <[email protected]>…
This reverts commit
89aac60e0be9ed95a87b16e3595f102f9faaffb4. "vfio: fix interrupts race condition"The above mentioned commit moves the interrupt's eventfd setup to probe time but only enables one interrupt for all types of interrupt handles i.e
VFIO_MSI,VFIO_LEGACY,VFIO_MSIX, UIO. It works fine with default case but breaks below cases specifically for MSIX based interrupt handles.* Applications like l3fwd-power that request rxq interrupts while ethdev setup.
* Drivers that need > 1 MSIx interrupts to be configured for functionality to work.VFIO PCI for MSIx expects all the possible vectors to be setup up when using
VFIO_IRQ_SET_ACTION_TRIGGERso that they can be allocated from kernel pci subsystem. Only way to increase the number of vectors later is first free all by usingVFIO_IRQ_SET_DATA_NONEwith action trigger and then enable new vector count.
Quoted 8 lines
Above commit changes the behavior of rte_intr_[enable|disable] to only mask and unmask unlike earlier behavior and thereby breaking above two scenarios.
Fixes 89aac60e0be9 ("vfio: fix interrupts race condition")Signed-off-by Nithin Dabilpuram <[email protected]>
This fixes the problem I am seeing with MSI-X.
Even with testpmd...
EAL: Error enabling MSI-X interrupts for fd 39