DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD
@ 2018-07-16 16:34 Anatoly Burakov
  2018-07-18  2:38 ` Zhao, MeijuanX
  0 siblings, 1 reply; 3+ messages in thread
From: Anatoly Burakov @ 2018-07-16 16:34 UTC (permalink / raw)
  To: dev; +Cc: yu.y.liu, bruce.richardson, konstantin.ananyev, stable

FreeBSD does not support running multiple primary processes
concurrently, because all DPDK instances will allocate memory
from the same place (memory provided by contigmem driver).
While it is technically possible to launch a DPDK process
using no-shconf switch, it will actually corrupt main process'
for the above reason.

Fix EAL flags autotest to not run primary processes unless
both no-shconf and no-huge are specified.

Cc: stable@dpdk.org

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

Notes:
    Testing of this patch is a little tricky. The issue was
    initially discovered because of a different patch:
    
    http://patches.dpdk.org/patch/36946/
    
    merged as:
    
    commit a3d6026711d00183e308f1dd79933f6161840e04
    Author: Olivier Matz <olivier.matz@6wind.com>
        ring: relax alignment constraint on ring structure
    
    On some machines with FreeBSD, this resulted in weird
    behavior of EAL flags autotest [1], and, following
    investigation it was discoevered that the root cause
    was not that patch, but rather corrupted main memory
    of the test process. The reason for this corruption was
    eventially narrowed down to running one of the tests
    with a primary process, with no-shconf, but without
    no-huge, which resulted in second primary process
    attaching to the same contigmem segments and corrupting
    memory of the test process.
    
    After applying this patch, this issue goes away on my
    FreeBSD machine. This patch applies directly atop of
    that commit, so it can be tested against it.
    
    [1] http://patches.dpdk.org/patch/36946/#81432

 test/test/test_eal_flags.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/test/test/test_eal_flags.c b/test/test/test_eal_flags.c
index f840ca50b..8d1da2c60 100644
--- a/test/test/test_eal_flags.c
+++ b/test/test/test_eal_flags.c
@@ -376,17 +376,17 @@ test_invalid_vdev_flag(void)
 #endif
 
 	/* Test with invalid vdev option */
-	const char *vdevinval[] = {prgname, prefix, "-n", "1",
+	const char *vdevinval[] = {prgname, prefix, no_huge, "-n", "1",
 				"-c", "1", vdev, "eth_dummy"};
 
 	/* Test with valid vdev option */
-	const char *vdevval1[] = {prgname, prefix, "-n", "1",
+	const char *vdevval1[] = {prgname, prefix, no_huge, "-n", "1",
 	"-c", "1", vdev, "net_ring0"};
 
-	const char *vdevval2[] = {prgname, prefix, "-n", "1",
+	const char *vdevval2[] = {prgname, prefix, no_huge, "-n", "1",
 	"-c", "1", vdev, "net_ring0,args=test"};
 
-	const char *vdevval3[] = {prgname, prefix, "-n", "1",
+	const char *vdevval3[] = {prgname, prefix, no_huge, "-n", "1",
 	"-c", "1", vdev, "net_ring0,nodeaction=r1:0:CREATE"};
 
 	if (launch_proc(vdevinval) == 0) {
@@ -849,13 +849,10 @@ test_misc_flags(void)
 	const char *argv4[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog"};
 	/* With invalid --syslog */
 	const char *argv5[] = {prgname, prefix, mp_flag, "-c", "1", "--syslog", "error"};
-	/* With no-sh-conf */
+	/* With no-sh-conf, also use no-huge to ensure this test runs on BSD */
 	const char *argv6[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE,
-			no_shconf, nosh_prefix };
+			no_shconf, nosh_prefix, no_huge};
 
-#ifdef RTE_EXEC_ENV_BSDAPP
-	return 0;
-#endif
 	/* With --huge-dir */
 	const char *argv7[] = {prgname, "-c", "1", "-n", "2", "-m", DEFAULT_MEM_SIZE,
 			"--file-prefix=hugedir", "--huge-dir", hugepath};
@@ -889,6 +886,7 @@ test_misc_flags(void)
 	const char *argv15[] = {prgname, "--file-prefix=intr",
 			"-c", "1", "-n", "2", "--vfio-intr=invalid"};
 
+	/* run all tests also applicable to FreeBSD first */
 
 	if (launch_proc(argv0) == 0) {
 		printf("Error - process ran ok with invalid flag\n");
@@ -902,6 +900,16 @@ test_misc_flags(void)
 		printf("Error - process did not run ok with -v flag\n");
 		return -1;
 	}
+	if (launch_proc(argv6) != 0) {
+		printf("Error - process did not run ok with --no-shconf flag\n");
+		return -1;
+	}
+
+#ifdef RTE_EXEC_ENV_BSDAPP
+	/* no more tests to be done on FreeBSD */
+	return 0;
+#endif
+
 	if (launch_proc(argv3) != 0) {
 		printf("Error - process did not run ok with --syslog flag\n");
 		return -1;
@@ -914,13 +922,6 @@ test_misc_flags(void)
 		printf("Error - process run ok with invalid --syslog flag\n");
 		return -1;
 	}
-	if (launch_proc(argv6) != 0) {
-		printf("Error - process did not run ok with --no-shconf flag\n");
-		return -1;
-	}
-#ifdef RTE_EXEC_ENV_BSDAPP
-	return 0;
-#endif
 	if (launch_proc(argv7) != 0) {
 		printf("Error - process did not run ok with --huge-dir flag\n");
 		return -1;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD
  2018-07-16 16:34 [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD Anatoly Burakov
@ 2018-07-18  2:38 ` Zhao, MeijuanX
  2018-07-26 19:26   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Zhao, MeijuanX @ 2018-07-18  2:38 UTC (permalink / raw)
  To: Burakov, Anatoly, dev
  Cc: Liu, Yu Y, Richardson, Bruce, Ananyev, Konstantin, stable



-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov
Sent: Tuesday, July 17, 2018 12:34 AM
To: dev@dpdk.org
Cc: Liu, Yu Y <yu.y.liu@intel.com>; Richardson, Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin <konstantin.ananyev@intel.com>; stable@dpdk.org
Subject: [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD

FreeBSD does not support running multiple primary processes concurrently, because all DPDK instances will allocate memory from the same place (memory provided by contigmem driver).
While it is technically possible to launch a DPDK process using no-shconf switch, it will actually corrupt main process'
for the above reason.

Fix EAL flags autotest to not run primary processes unless both no-shconf and no-huge are specified.

Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Wu, ChangqingX <changqingx.wu@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD
  2018-07-18  2:38 ` Zhao, MeijuanX
@ 2018-07-26 19:26   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-07-26 19:26 UTC (permalink / raw)
  To: Burakov, Anatoly
  Cc: dev, Zhao, MeijuanX, Liu, Yu Y, Richardson, Bruce, Ananyev,
	Konstantin, stable

> FreeBSD does not support running multiple primary processes concurrently, because all DPDK instances will allocate memory from the same place (memory provided by contigmem driver).
> While it is technically possible to launch a DPDK process using no-shconf switch, it will actually corrupt main process'
> for the above reason.
> 
> Fix EAL flags autotest to not run primary processes unless both no-shconf and no-huge are specified.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Tested-by: Wu, ChangqingX <changqingx.wu@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-26 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 16:34 [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD Anatoly Burakov
2018-07-18  2:38 ` Zhao, MeijuanX
2018-07-26 19:26   ` Thomas Monjalon

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).