diff mbox series

eal/windows: cleanup virt2phys handle

Message ID 20210726213632.143296-1-dmitry.kozliuk@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series eal/windows: cleanup virt2phys handle | expand

Checks

Context Check Description
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot success github build: passed
ci/checkpatch success coding style OK

Commit Message

Dmitry Kozlyuk July 26, 2021, 9:36 p.m. UTC
eal_mem_virt2phys_init() opens a handle for use by rte_mem_virt2phy().
Close this handle on EAL cleanup.

Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/eal/windows/eal.c         | 1 +
 lib/eal/windows/eal_memory.c  | 7 +++++++
 lib/eal/windows/eal_windows.h | 5 +++++
 3 files changed, 13 insertions(+)

Comments

Menon, Ranjit July 27, 2021, 5:43 a.m. UTC | #1
On 7/26/2021 2:36 PM, Dmitry Kozlyuk wrote:
> eal_mem_virt2phys_init() opens a handle for use by rte_mem_virt2phy().
> Close this handle on EAL cleanup.
>
> Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
> Cc: stable@dpdk.org
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
>   lib/eal/windows/eal.c         | 1 +
>   lib/eal/windows/eal_memory.c  | 7 +++++++
>   lib/eal/windows/eal_windows.h | 5 +++++
>   3 files changed, 13 insertions(+)
>
> diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
> index 5413d4d87f..3d8c520412 100644
> --- a/lib/eal/windows/eal.c
> +++ b/lib/eal/windows/eal.c
> @@ -261,6 +261,7 @@ rte_eal_cleanup(void)
>   		eal_get_internal_configuration();
>   
>   	eal_intr_thread_cancel();
> +	eal_mem_virt2iova_cleanup();
>   	/* after this point, any DPDK pointers will become dangling */
>   	rte_eal_memory_detach();
>   	eal_cleanup_config(internal_conf);
> diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
> index 4db048ccb5..71741fc07e 100644
> --- a/lib/eal/windows/eal_memory.c
> +++ b/lib/eal/windows/eal_memory.c
> @@ -198,6 +198,13 @@ eal_mem_virt2iova_init(void)
>   	return ret;
>   }
>   
> +void
> +eal_mem_virt2iova_cleanup(void)
> +{
> +	if (virt2phys_device != INVALID_HANDLE_VALUE)
> +		CloseHandle(virt2phys_device);
> +}
> +
>   phys_addr_t
>   rte_mem_virt2phy(const void *virt)
>   {
> diff --git a/lib/eal/windows/eal_windows.h b/lib/eal/windows/eal_windows.h
> index 7cc811485d..23ead6d30c 100644
> --- a/lib/eal/windows/eal_windows.h
> +++ b/lib/eal/windows/eal_windows.h
> @@ -79,6 +79,11 @@ void eal_intr_thread_cancel(void);
>    */
>   int eal_mem_virt2iova_init(void);
>   
> +/**
> + * Cleanup resources used for virtual to physical address translation.
> + */
> +void eal_mem_virt2iova_cleanup(void);
> +
>   /**
>    * Locate Win32 memory management routines in system libraries.
>    *
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
Thomas Monjalon July 30, 2021, 4:41 p.m. UTC | #2
27/07/2021 07:43, Menon, Ranjit:
> On 7/26/2021 2:36 PM, Dmitry Kozlyuk wrote:
> > eal_mem_virt2phys_init() opens a handle for use by rte_mem_virt2phy().
> > Close this handle on EAL cleanup.
> >
> > Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Acked-by: Ranjit Menon <ranjit.menon@intel.com>

Applied, thanks.
diff mbox series

Patch

diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c
index 5413d4d87f..3d8c520412 100644
--- a/lib/eal/windows/eal.c
+++ b/lib/eal/windows/eal.c
@@ -261,6 +261,7 @@  rte_eal_cleanup(void)
 		eal_get_internal_configuration();
 
 	eal_intr_thread_cancel();
+	eal_mem_virt2iova_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
 	eal_cleanup_config(internal_conf);
diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 4db048ccb5..71741fc07e 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/eal/windows/eal_memory.c
@@ -198,6 +198,13 @@  eal_mem_virt2iova_init(void)
 	return ret;
 }
 
+void
+eal_mem_virt2iova_cleanup(void)
+{
+	if (virt2phys_device != INVALID_HANDLE_VALUE)
+		CloseHandle(virt2phys_device);
+}
+
 phys_addr_t
 rte_mem_virt2phy(const void *virt)
 {
diff --git a/lib/eal/windows/eal_windows.h b/lib/eal/windows/eal_windows.h
index 7cc811485d..23ead6d30c 100644
--- a/lib/eal/windows/eal_windows.h
+++ b/lib/eal/windows/eal_windows.h
@@ -79,6 +79,11 @@  void eal_intr_thread_cancel(void);
  */
 int eal_mem_virt2iova_init(void);
 
+/**
+ * Cleanup resources used for virtual to physical address translation.
+ */
+void eal_mem_virt2iova_cleanup(void);
+
 /**
  * Locate Win32 memory management routines in system libraries.
  *