From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id D95A2201; Mon, 16 Jul 2018 18:34:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 09:34:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,361,1526367600"; d="scan'208";a="67418199" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 16 Jul 2018 09:34:05 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w6GGY4ZC010313; Mon, 16 Jul 2018 17:34:04 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w6GGY4MS015497; Mon, 16 Jul 2018 17:34:04 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w6GGY4q8015488; Mon, 16 Jul 2018 17:34:04 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: yu.y.liu@intel.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, stable@dpdk.org Date: Mon, 16 Jul 2018 17:34:04 +0100 Message-Id: <9220e130edbd5d8ca1d7dc0a2e06c8dadcf3a22f.1531758221.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test: ensure EAL flags autotest works properly on BSD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2018 16:34:08 -0000 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 --- 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 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