From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C56AC2A66 for ; Thu, 3 May 2018 14:38:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 05:38:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="55669103" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 03 May 2018 05:38:21 -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 w43CcKPZ028010; Thu, 3 May 2018 13:38:20 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w43CcKT8004480; Thu, 3 May 2018 13:38:20 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w43CcKNJ004476; Thu, 3 May 2018 13:38:20 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: Wenzhuo Lu , Jingjing Wu , John McNamara , Marko Kovacevic , jianfeng.tan@intel.com Date: Thu, 3 May 2018 13:38:19 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH 1/2] app/testpmd: make locking memory configurable 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: Thu, 03 May 2018 12:38:24 -0000 Add two new command-line parameters for either enabling or disabling locking all memory at app startup. Cc: wenzhuo.lu@intel.com Cc: jingjing.wu@intel.com Signed-off-by: Jianfeng Tan Signed-off-by: Anatoly Burakov --- app/test-pmd/parameters.c | 8 ++++++++ app/test-pmd/testpmd.c | 32 ++++++++++++++++++-------------- app/test-pmd/testpmd.h | 4 ++-- doc/guides/testpmd_app_ug/run_app.rst | 8 ++++++++ 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index aea8af8..6489bf4 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -188,6 +188,8 @@ usage(char* progname) printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); printf(" --hot-plug: enable hot plug for device.\n"); printf(" --vxlan-gpe-port=N: UPD port of tunnel VXLAN-GPE\n"); + printf(" --mlockall: lock all memory\n"); + printf(" --no-mlockall: do not lock all memory\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -629,6 +631,8 @@ launch_args_parse(int argc, char** argv) { "tx-offloads", 1, 0, 0 }, { "hot-plug", 0, 0, 0 }, { "vxlan-gpe-port", 1, 0, 0 }, + { "mlockall", 0, 0, 0 }, + { "no-mlockall", 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1145,6 +1149,10 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "hot-plug")) hot_plug = 1; + if (!strcmp(lgopts[opt_idx].name, "mlockall")) + do_mlockall = 1; + if (!strcmp(lgopts[opt_idx].name, "no-mlockall")) + do_mlockall = 0; break; case 'h': usage(argv[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index db23f23..77490be 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -299,6 +299,10 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) | (UINT32_C(1) << RTE_ETH_EVENT_IPSEC) | (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) | (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV); +/* + * Decide if all memory are locked for performance. + */ +int do_mlockall = 0; /* * NIC bypass mode configuration options. @@ -2603,7 +2607,20 @@ main(int argc, char** argv) rte_panic("Cannot register log type"); rte_log_set_level(testpmd_logtype, RTE_LOG_DEBUG); - if (mlockall(MCL_CURRENT | MCL_FUTURE)) { + /* Bitrate/latency stats disabled by default */ +#ifdef RTE_LIBRTE_BITRATE + bitrate_enabled = 0; +#endif +#ifdef RTE_LIBRTE_LATENCY_STATS + latencystats_enabled = 0; +#endif + + argc -= diag; + argv += diag; + if (argc > 1) + launch_args_parse(argc, argv); + + if (do_mlockall && mlockall(MCL_CURRENT | MCL_FUTURE)) { TESTPMD_LOG(NOTICE, "mlockall() failed with error \"%s\"\n", strerror(errno)); } @@ -2625,19 +2642,6 @@ main(int argc, char** argv) rte_panic("Empty set of forwarding logical cores - check the " "core mask supplied in the command parameters\n"); - /* Bitrate/latency stats disabled by default */ -#ifdef RTE_LIBRTE_BITRATE - bitrate_enabled = 0; -#endif -#ifdef RTE_LIBRTE_LATENCY_STATS - latencystats_enabled = 0; -#endif - - argc -= diag; - argv += diag; - if (argc > 1) - launch_args_parse(argc, argv); - if (tx_first && interactive) rte_exit(EXIT_FAILURE, "--tx-first cannot be used on " "interactive mode.\n"); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1af87b8..f7bc58e 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -334,9 +334,9 @@ extern volatile int test_done; /* stop packet forwarding when set to 1. */ extern uint8_t lsc_interrupt; /**< disabled by "--no-lsc-interrupt" parameter */ extern uint8_t rmv_interrupt; /**< disabled by "--no-rmv-interrupt" parameter */ extern uint32_t event_print_mask; -extern uint8_t hot_plug; /**< enable by "--hot-plug" parameter */ - /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */ +extern uint8_t hot_plug; /**< enable by "--hot-plug" parameter */ +extern int do_mlockall; /**< set by "--mlockall" or "--no-mlockall" parameter */ #ifdef RTE_LIBRTE_IXGBE_BYPASS extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */ diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 351d826..f301c2b 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -490,3 +490,11 @@ The commandline options are: Set the UDP port number of tunnel VXLAN-GPE to N. The default value is 4790. + +* ``--mlockall`` + + Enable locking all memory. + +* ``--no-mlockall`` + + Disable locking all memory. -- 2.7.4