DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix device hotplug
@ 2021-11-02  7:52 David Marchand
  2021-11-02  9:35 ` Jiang, YuX
  2021-11-04 14:11 ` Maxime Coquelin
  0 siblings, 2 replies; 5+ messages in thread
From: David Marchand @ 2021-11-02  7:52 UTC (permalink / raw)
  To: dev; +Cc: yux.jiang, Harman Kalra

The device event interrupt handler was always freed.

Bugzilla ID: 845
Fixes: c2bd9367e18f ("lib: remove direct access to interrupt handle")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/eal/linux/eal_dev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index 06820a3666..925cdba553 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -317,10 +317,12 @@ rte_dev_event_monitor_start(void)
 		goto exit;
 	}
 
-	if (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_DEV_EVENT))
+	ret = rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_DEV_EVENT);
+	if (ret)
 		goto exit;
 
-	if (rte_intr_fd_set(intr_handle, -1))
+	ret = rte_intr_fd_set(intr_handle, -1);
+	if (ret)
 		goto exit;
 
 	ret = dev_uev_socket_fd_create();
@@ -339,7 +341,10 @@ rte_dev_event_monitor_start(void)
 	monitor_refcount++;
 
 exit:
-	rte_intr_instance_free(intr_handle);
+	if (ret) {
+		rte_intr_instance_free(intr_handle);
+		intr_handle = NULL;
+	}
 	rte_rwlock_write_unlock(&monitor_lock);
 	return ret;
 }
@@ -370,6 +375,7 @@ rte_dev_event_monitor_stop(void)
 
 	close(rte_intr_fd_get(intr_handle));
 	rte_intr_instance_free(intr_handle);
+	intr_handle = NULL;
 
 	monitor_refcount--;
 
-- 
2.23.0


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

end of thread, other threads:[~2021-11-04 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02  7:52 [dpdk-dev] [PATCH] eal: fix device hotplug David Marchand
2021-11-02  9:35 ` Jiang, YuX
2021-11-04 14:15   ` David Marchand
2021-11-04 14:11 ` Maxime Coquelin
2021-11-04 14:22   ` David Marchand

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