Skip to contentSkip to conversation

vfio: eventfd should be non-block and not inherited

PATCH Applied Stephen Hemminger 3 participants 3 messages Apr 29, 2015 – May 11, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: eventfd should be non-block and not inherited

Set internal event file descriptor to be non-block and not inherited across exec. This prevents accidental hangs and passing in anothr thread.

---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +1 -1
index aea1fb1..426953a 100644
@@ -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));
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): 1430320545-16638-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org

#2 lore raw
Quoted 22 lines

Set internal event file descriptor to be non-block and not inherited across exec. This prevents accidental hangs and passing in anothr thread.

---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +1 -1
index aea1fb1..426953a 100644
@@ -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, "
Quoted 4 lines

"error %i (%s)\n", errno,
strerror(errno));
--
2.1.4