[dpdk-dev] vfio: eventfd should be non-block and not inherited

Message ID 1430320545-16638-1-git-send-email-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Stephen Hemminger April 29, 2015, 3:15 p.m. UTC
  Set internal event file descriptor to be non-block and not
inherited across exec.  This prevents accidental hangs and
passing in anothr thread.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Anatoly Burakov April 29, 2015, 4:15 p.m. UTC | #1
> Set internal event file descriptor to be non-block and not inherited across
> exec.  This prevents accidental hangs and passing in anothr thread.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> index aea1fb1..426953a 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
> @@ -294,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device
> *dev, int vfio_dev_fd)
>  		}
> 
>  		/* set up an eventfd for interrupts */
> -		fd = eventfd(0, 0);
> +		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));
> --
> 2.1.4

Acked-by: Anatoly  Burakov <anatoly.burakov@intel.com>
  
Thomas Monjalon May 11, 2015, 3:16 p.m. UTC | #2
> > Set internal event file descriptor to be non-block and not inherited across
> > exec.  This prevents accidental hangs and passing in anothr thread.
> > 
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Acked-by: Anatoly  Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index aea1fb1..426953a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -294,7 +294,7 @@  pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		}
 
 		/* set up an eventfd for interrupts */
-		fd = eventfd(0, 0);
+		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));