* [PATCH] examples/vdpa: fix devices cleanup
@ 2022-12-26 6:51 Yajun Wu
2022-12-26 18:05 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Yajun Wu @ 2022-12-26 6:51 UTC (permalink / raw)
To: matan, Maxime Coquelin, Chenbo Xia, Chengchang Tang; +Cc: dev, stable
Move rte_eal_cleanup to function vdpa_sample_quit which
handling all example app quit.
Otherwise rte_eal_cleanup won't be called on receiving signal
like SIGINT(control + c).
Fixes: 10aa3757 ("examples: add eal cleanup to examples")
Cc: stable@dpdk.org
Signed-off-by: Yajun Wu <yajunw@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
examples/vdpa/main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 4c7e81d7b6..9149b66538 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -287,6 +287,8 @@ vdpa_sample_quit(void)
if (vports[i].ifname[0] != '\0')
close_vdpa(&vports[i]);
}
+ /* clean up the EAL */
+ rte_eal_cleanup();
}
static void
@@ -633,8 +635,5 @@ main(int argc, char *argv[])
vdpa_sample_quit();
}
- /* clean up the EAL */
- rte_eal_cleanup();
-
return 0;
}
--
2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] examples/vdpa: fix devices cleanup
2022-12-26 6:51 [PATCH] examples/vdpa: fix devices cleanup Yajun Wu
@ 2022-12-26 18:05 ` Stephen Hemminger
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2022-12-26 18:05 UTC (permalink / raw)
To: Yajun Wu; +Cc: matan, Maxime Coquelin, Chenbo Xia, Chengchang Tang, dev, stable
On Mon, 26 Dec 2022 14:51:06 +0800
Yajun Wu <yajunw@nvidia.com> wrote:
> Move rte_eal_cleanup to function vdpa_sample_quit which
> handling all example app quit.
> Otherwise rte_eal_cleanup won't be called on receiving signal
> like SIGINT(control + c).
>
> Fixes: 10aa3757 ("examples: add eal cleanup to examples")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yajun Wu <yajunw@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
NAK
rte_eal_cleanup is not signal safe.
This (and several other applications) are not managing termination
signals correctly. It is not safe to call many DPDK functions
from a signal handler. Imagine the case of getting SIGINT in
the middle of a driver holding a spin lock, then calling the
close function of that driver which then acquires the same lock.
The only safe way to handle signals is to set a flag
and do the shutdown and cleanup from the main loop.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] examples/vdpa: fix devices cleanup
@ 2022-12-26 6:25 Yajun Wu
0 siblings, 0 replies; 3+ messages in thread
From: Yajun Wu @ 2022-12-26 6:25 UTC (permalink / raw)
To: stable; +Cc: Matan Azrad
Move rte_eal_cleanup to function vdpa_sample_quit which
handling all example app quit.
Otherwise rte_eal_cleanup won't be called on receiving signal
like SIGINT(control + c).
Fixes: 10aa3757 ("examples: add eal cleanup to examples")
Cc: stable@dpdk.org
Signed-off-by: Yajun Wu <yajunw@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
examples/vdpa/main.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 4c7e81d7b6..9149b66538 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -287,6 +287,8 @@ vdpa_sample_quit(void)
if (vports[i].ifname[0] != '\0')
close_vdpa(&vports[i]);
}
+ /* clean up the EAL */
+ rte_eal_cleanup();
}
static void
@@ -633,8 +635,5 @@ main(int argc, char *argv[])
vdpa_sample_quit();
}
- /* clean up the EAL */
- rte_eal_cleanup();
-
return 0;
}
--
2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-26 18:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 6:51 [PATCH] examples/vdpa: fix devices cleanup Yajun Wu
2022-12-26 18:05 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2022-12-26 6:25 Yajun Wu
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).