[08/14] eal: vfio: cleanup the mp sync handle

Message ID 20200104013341.19809-9-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series cleanup resources on shutdown |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Stephen Hemminger Jan. 4, 2020, 1:33 a.m. UTC
  When rte_eal_cleanup is called the rte_mp_action for VFIO
should be freed.

Fixes: edf73dd33072 ("ipc: handle unsupported IPC in action register")
Cc: anatoly.burakov@intel.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_eal/linux/eal/eal.c              | 3 +++
 lib/librte_eal/linux/eal/eal_vfio.h         | 1 +
 lib/librte_eal/linux/eal/eal_vfio_mp_sync.c | 8 ++++++++
 3 files changed, 12 insertions(+)
  

Comments

Burakov, Anatoly April 27, 2020, 12:12 p.m. UTC | #1
On 04-Jan-20 1:33 AM, Stephen Hemminger wrote:
> When rte_eal_cleanup is called the rte_mp_action for VFIO
> should be freed.
> 
> Fixes: edf73dd33072 ("ipc: handle unsupported IPC in action register")
> Cc: anatoly.burakov@intel.com
> Cc: stable@dpdk.org
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  

Patch

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index eb95f4f0c317..9ad81378f23c 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1338,6 +1338,9 @@  rte_eal_cleanup(void)
 	}
 
 	rte_service_finalize();
+#ifdef VFIO_PRESENT
+	vfio_mp_sync_cleanup();
+#endif
 	rte_eal_intr_cleanup();
 	rte_eal_alarm_cleanup();
 	rte_mp_channel_cleanup();
diff --git a/lib/librte_eal/linux/eal/eal_vfio.h b/lib/librte_eal/linux/eal/eal_vfio.h
index cb2d35fb1206..bf7408a897a7 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.h
+++ b/lib/librte_eal/linux/eal/eal_vfio.h
@@ -132,6 +132,7 @@  int
 vfio_has_supported_extensions(int vfio_container_fd);
 
 int vfio_mp_sync_setup(void);
+void vfio_mp_sync_cleanup(void);
 
 #define EAL_VFIO_MP "eal_vfio_mp_sync"
 
diff --git a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
index 5f2a5fc1d94e..b8ae9c65892e 100644
--- a/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linux/eal/eal_vfio_mp_sync.c
@@ -120,4 +120,12 @@  vfio_mp_sync_setup(void)
 	return 0;
 }
 
+void
+vfio_mp_sync_cleanup(void)
+{
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return;
+
+	rte_mp_action_unregister(EAL_VFIO_MP);
+}
 #endif