[dpdk-dev,2/2] app/tesetpmd: disable memory locking for bsdapp

Message ID 151ad7a96d31c881c28379b66c740cf96f5d2635.1525350577.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

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

Commit Message

Anatoly Burakov May 3, 2018, 12:38 p.m. UTC
  If mlockall() is called while allocated VA space is bigger than
amount of available RAM, FreeBSD kernel will deadlock and need
a hard reboot. We do allocate big amounts of memory because of
how new memory subsystem works, so calling mlockall() will cause
a deadlock. So, disable mlockall() by default on FreeBSD.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 app/test-pmd/testpmd.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Ananyev, Konstantin May 10, 2018, 2:33 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov
> Sent: Thursday, May 3, 2018 1:38 PM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Tan, Jianfeng <jianfeng.tan@intel.com>
> Subject: [dpdk-dev] [PATCH 2/2] app/tesetpmd: disable memory locking for bsdapp
> 
> If mlockall() is called while allocated VA space is bigger than
> amount of available RAM, FreeBSD kernel will deadlock and need
> a hard reboot. We do allocate big amounts of memory because of
> how new memory subsystem works, so calling mlockall() will cause
> a deadlock. So, disable mlockall() by default on FreeBSD.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  app/test-pmd/testpmd.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 77490be..38b8b7a 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2615,6 +2615,13 @@ main(int argc, char** argv)
>  	latencystats_enabled = 0;
>  #endif
> 
> +	/* on FreeBSD, mlockall() is disabled by default */
> +#ifdef RTE_EXEC_ENV_BSDAPP
> +	do_mlockall = 0;
> +#else
> +	do_mlockall = 1;
> +#endif
> +
>  	argc -= diag;
>  	argv += diag;
>  	if (argc > 1)
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.7.4
  
Thomas Monjalon May 14, 2018, 1:55 a.m. UTC | #2
> > If mlockall() is called while allocated VA space is bigger than
> > amount of available RAM, FreeBSD kernel will deadlock and need
> > a hard reboot. We do allocate big amounts of memory because of
> > how new memory subsystem works, so calling mlockall() will cause
> > a deadlock. So, disable mlockall() by default on FreeBSD.
> > 
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Series applied, thanks
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 77490be..38b8b7a 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2615,6 +2615,13 @@  main(int argc, char** argv)
 	latencystats_enabled = 0;
 #endif
 
+	/* on FreeBSD, mlockall() is disabled by default */
+#ifdef RTE_EXEC_ENV_BSDAPP
+	do_mlockall = 0;
+#else
+	do_mlockall = 1;
+#endif
+
 	argc -= diag;
 	argv += diag;
 	if (argc > 1)