[v2] eal: cleanup alarm and multiprocess hotplug before memory detach

Message ID 20221221034152.30628-1-changfengnan@bytedance.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] eal: cleanup alarm and multiprocess hotplug before memory detach |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Fengnan Chang Dec. 21, 2022, 3:41 a.m. UTC
  Alarm and multiprocess hotplug still need access hugepage memory,
if alarm event processed after memory detach, it may cause SEGV.
So cleanup alarm and multiprocess hotplug before memory detach.

Fixes: 90b13ab8d4f7 ("alarm: remove direct access to interrupt handle")
Fixes: a0cc7be20dd1 ("mem: cleanup multiprocess resources")

Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
---
 lib/eal/freebsd/eal.c | 2 +-
 lib/eal/linux/eal.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Fengnan Chang Jan. 6, 2023, 3 a.m. UTC | #1
Hi:
  is there any comments?

Fengnan Chang <changfengnan@bytedance.com> 于2022年12月21日周三 11:41写道:
>
> Alarm and multiprocess hotplug still need access hugepage memory,
> if alarm event processed after memory detach, it may cause SEGV.
> So cleanup alarm and multiprocess hotplug before memory detach.
>
> Fixes: 90b13ab8d4f7 ("alarm: remove direct access to interrupt handle")
> Fixes: a0cc7be20dd1 ("mem: cleanup multiprocess resources")
>
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> ---
>  lib/eal/freebsd/eal.c | 2 +-
>  lib/eal/linux/eal.c   | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> index 1b58cd3da6..83b99c601f 100644
> --- a/lib/eal/freebsd/eal.c
> +++ b/lib/eal/freebsd/eal.c
> @@ -897,9 +897,9 @@ rte_eal_cleanup(void)
>         eal_bus_cleanup();
>         rte_trace_save();
>         eal_trace_fini();
> +       rte_eal_alarm_cleanup();
>         /* after this point, any DPDK pointers will become dangling */
>         rte_eal_memory_detach();
> -       rte_eal_alarm_cleanup();
>         eal_cleanup_config(internal_conf);
>         return 0;
>  }
> diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> index 8c118d0d9f..c76f026023 100644
> --- a/lib/eal/linux/eal.c
> +++ b/lib/eal/linux/eal.c
> @@ -1372,11 +1372,11 @@ rte_eal_cleanup(void)
>         eal_bus_cleanup();
>         rte_trace_save();
>         eal_trace_fini();
> +       eal_mp_dev_hotplug_cleanup();
> +       rte_eal_alarm_cleanup();
>         /* after this point, any DPDK pointers will become dangling */
>         rte_eal_memory_detach();
> -       eal_mp_dev_hotplug_cleanup();
>         rte_eal_malloc_heap_cleanup();
> -       rte_eal_alarm_cleanup();
>         eal_cleanup_config(internal_conf);
>         rte_eal_log_cleanup();
>         return 0;
> --
> 2.37.0 (Apple Git-136)
>
  
Fengnan Chang Jan. 29, 2023, 9:58 a.m. UTC | #2
friendly ping

Fengnan Chang <changfengnan@bytedance.com> 于2023年1月6日周五 11:00写道:
>
> Hi:
>   is there any comments?
>
> Fengnan Chang <changfengnan@bytedance.com> 于2022年12月21日周三 11:41写道:
> >
> > Alarm and multiprocess hotplug still need access hugepage memory,
> > if alarm event processed after memory detach, it may cause SEGV.
> > So cleanup alarm and multiprocess hotplug before memory detach.
> >
> > Fixes: 90b13ab8d4f7 ("alarm: remove direct access to interrupt handle")
> > Fixes: a0cc7be20dd1 ("mem: cleanup multiprocess resources")
> >
> > Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
> > ---
> >  lib/eal/freebsd/eal.c | 2 +-
> >  lib/eal/linux/eal.c   | 4 ++--
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
> > index 1b58cd3da6..83b99c601f 100644
> > --- a/lib/eal/freebsd/eal.c
> > +++ b/lib/eal/freebsd/eal.c
> > @@ -897,9 +897,9 @@ rte_eal_cleanup(void)
> >         eal_bus_cleanup();
> >         rte_trace_save();
> >         eal_trace_fini();
> > +       rte_eal_alarm_cleanup();
> >         /* after this point, any DPDK pointers will become dangling */
> >         rte_eal_memory_detach();
> > -       rte_eal_alarm_cleanup();
> >         eal_cleanup_config(internal_conf);
> >         return 0;
> >  }
> > diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
> > index 8c118d0d9f..c76f026023 100644
> > --- a/lib/eal/linux/eal.c
> > +++ b/lib/eal/linux/eal.c
> > @@ -1372,11 +1372,11 @@ rte_eal_cleanup(void)
> >         eal_bus_cleanup();
> >         rte_trace_save();
> >         eal_trace_fini();
> > +       eal_mp_dev_hotplug_cleanup();
> > +       rte_eal_alarm_cleanup();
> >         /* after this point, any DPDK pointers will become dangling */
> >         rte_eal_memory_detach();
> > -       eal_mp_dev_hotplug_cleanup();
> >         rte_eal_malloc_heap_cleanup();
> > -       rte_eal_alarm_cleanup();
> >         eal_cleanup_config(internal_conf);
> >         rte_eal_log_cleanup();
> >         return 0;
> > --
> > 2.37.0 (Apple Git-136)
> >
  
Thomas Monjalon Feb. 15, 2023, 3:08 p.m. UTC | #3
21/12/2022 04:41, Fengnan Chang:
> Alarm and multiprocess hotplug still need access hugepage memory,
> if alarm event processed after memory detach, it may cause SEGV.
> So cleanup alarm and multiprocess hotplug before memory detach.
> 
> Fixes: 90b13ab8d4f7 ("alarm: remove direct access to interrupt handle")
> Fixes: a0cc7be20dd1 ("mem: cleanup multiprocess resources")
> 
> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>

Cc: stable@dpdk.org

Applied, thanks.
  

Patch

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 1b58cd3da6..83b99c601f 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -897,9 +897,9 @@  rte_eal_cleanup(void)
 	eal_bus_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
+	rte_eal_alarm_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
-	rte_eal_alarm_cleanup();
 	eal_cleanup_config(internal_conf);
 	return 0;
 }
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 8c118d0d9f..c76f026023 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1372,11 +1372,11 @@  rte_eal_cleanup(void)
 	eal_bus_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
+	eal_mp_dev_hotplug_cleanup();
+	rte_eal_alarm_cleanup();
 	/* after this point, any DPDK pointers will become dangling */
 	rte_eal_memory_detach();
-	eal_mp_dev_hotplug_cleanup();
 	rte_eal_malloc_heap_cleanup();
-	rte_eal_alarm_cleanup();
 	eal_cleanup_config(internal_conf);
 	rte_eal_log_cleanup();
 	return 0;