From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 5420C1B2F7 for ; Wed, 14 Feb 2018 04:59:49 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 19:59:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,510,1511856000"; d="scan'208";a="34520065" Received: from dpdk06.sh.intel.com ([10.67.110.196]) by orsmga002.jf.intel.com with ESMTP; 13 Feb 2018 19:59:48 -0800 From: Jianfeng Tan To: dev@dpdk.org Cc: Jianfeng Tan , wenzhuo.lu@intel.com, jingjing.wu@intel.com Date: Wed, 14 Feb 2018 04:01:31 +0000 Message-Id: <1518580892-32656-4-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518580892-32656-1-git-send-email-jianfeng.tan@intel.com> References: <1518580892-32656-1-git-send-email-jianfeng.tan@intel.com> Subject: [dpdk-dev] [PATCH 3/4] app/testpmd: add option to avoid lock all memory 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: Wed, 14 Feb 2018 03:59:49 -0000 In some cases, we don't want to lock all memory. Add an option --no-mlockall to avoid lock all memory. Cc: wenzhuo.lu@intel.com Cc: jingjing.wu@intel.com Signed-off-by: Jianfeng Tan --- app/test-pmd/parameters.c | 5 ++++- app/test-pmd/testpmd.c | 32 ++++++++++++++++++-------------- app/test-pmd/testpmd.h | 1 + 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 97d22b8..5060a6c 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -186,6 +186,7 @@ usage(char* progname) printf(" --flow-isolate-all: " "requests flow API isolated mode on all ports at initialization time.\n"); printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n"); + printf(" --no-mlockall: do not lock all memory\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -621,6 +622,7 @@ launch_args_parse(int argc, char** argv) { "print-event", 1, 0, 0 }, { "mask-event", 1, 0, 0 }, { "tx-offloads", 1, 0, 0 }, + { "no-mlockall", 0, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1102,7 +1104,8 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "invalid mask-event argument\n"); } - + if (!strcmp(lgopts[opt_idx].name, "no-mlockall")) + no_mlockall = 1; break; case 'h': usage(argv[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4c0e258..59bdc85 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -294,6 +294,10 @@ uint32_t event_print_mask = (UINT32_C(1) << RTE_ETH_EVENT_UNKNOWN) | (UINT32_C(1) << RTE_ETH_EVENT_INTR_RESET) | (UINT32_C(1) << RTE_ETH_EVENT_MACSEC) | (UINT32_C(1) << RTE_ETH_EVENT_INTR_RMV); +/* + * Decide if all memory are locked for performance. + */ +int no_mlockall = 0; /* * NIC bypass mode configuration options. @@ -2489,7 +2493,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 (!no_mlockall && mlockall(MCL_CURRENT | MCL_FUTURE)) { TESTPMD_LOG(NOTICE, "mlockall() failed with error \"%s\"\n", strerror(errno)); } @@ -2511,19 +2528,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 153abea..028b873 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -319,6 +319,7 @@ 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 int no_mlockall; /**< set by "--no-mlockall" parameter */ /**< set by "--print-event xxxx" and "--mask-event xxxx parameters */ #ifdef RTE_LIBRTE_IXGBE_BYPASS -- 2.7.4