eal: fix device hotplug
PATCH 1/1 eal: fix device hotplug
The device event interrupt handler was always freed.
Bugzilla ID: 845
--- lib/eal/linux/eal_dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
lib/eal/linux/eal_dev.c +9 -3
@@ -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--;
Signature · 1 line
2.23.0
Quoted 58 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, November 2, 2021 3:53 PM
To: [email protected]
Cc: Jiang, YuX <[email protected]>; Harman Kalra <[email protected]>
Subject: [PATCH] eal: fix device hotplugThe device event interrupt handler was always freed.
Bugzilla ID: 845
Fixes c2bd9367e18f ("lib: remove direct access to interrupt handle")Signed-off-by David Marchand <[email protected]>--- lib/eal/linux/eal_dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)lib/eal/linux/eal_dev.c index renamed from lib/eal/linux/eal_dev.c +0
-0
06820a3666..925cdba553100644lib/eal/linux/eal_dev.c +4
-2@@ -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;lib/eal/linux/eal_dev.c +5
-2ret =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--; --
Quoted 1 line
2.23.0
Hi David,
The patch https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
failed to verify.
after executing "device_del dev1" in the qemu window, the testpmd window hangs to death and output as following:
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
Quoted 64 lines · YuX
Quoted 58 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, November 2, 2021 3:53 PM
To: [email protected]
Cc: Jiang, YuX <[email protected]>; Harman Kalra <[email protected]>
Subject: [PATCH] eal: fix device hotplugThe device event interrupt handler was always freed.
Bugzilla ID: 845
Fixes c2bd9367e18f ("lib: remove direct access to interrupt handle")Signed-off-by David Marchand <[email protected]>--- lib/eal/linux/eal_dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)lib/eal/linux/eal_dev.c index renamed from lib/eal/linux/eal_dev.c +0
-0
06820a3666..925cdba553100644lib/eal/linux/eal_dev.c +4
-2@@ -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();lib/eal/linux/eal_dev.c +5
-2@@ -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--; --Quoted 1 line
2.23.0
Hi David,
The patch https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
failed to verify.
Quoted 16 lines
after executing "
device_deldev1" in the qemu window, the testpmd window hangs to death and output as following:
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
EAL: Cannot find bus for device (0000:00:05.0)
Replying on the ml, since the discussion mainly happened in bugzilla. This first patch was not enough, another issue was caught in the pci bus hotplug code.
Signature · 1 line
David Marchand
Quoted 43 lines · David Marchand
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 <[email protected]>--- lib/eal/linux/eal_dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)lib/eal/linux/eal_dev.c +8
-3@@ -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; }
lib/eal/linux/eal_dev.c rte_dev_event_monitor_stop(void) · line 381
Quoted 7 lines
lib/eal/linux/eal_dev.c +1
-0@@ -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--;
Thanks,
Maxime
Quoted 7 lines · Maxime Coquelin
Quoted 6 lines · David Marchand
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 <[email protected]>
Quoted 1 line
Reviewed-by Maxime Coquelin <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand