From patchwork Mon Aug 19 09:42:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Harris, James R" X-Patchwork-Id: 57755 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D46F51BE9F; Mon, 19 Aug 2019 19:02:31 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D64CC1BE9E for ; Mon, 19 Aug 2019 19:02:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Aug 2019 09:47:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,405,1559545200"; d="scan'208";a="353299034" Received: from jrharri1-skx.ch.intel.com (HELO [127.0.1.1]) ([143.182.137.73]) by orsmga005.jf.intel.com with ESMTP; 19 Aug 2019 09:47:16 -0700 From: Jim Harris To: dev@dpdk.org, anatoly.burakov@intel.com Date: Mon, 19 Aug 2019 02:42:10 -0700 Message-ID: <156620773023.46233.9134599999619749565.stgit@jrharri1-skx> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4] timer: don't check tsc flags in secondary processes 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" check_tsc_flags() parses /proc/cpuinfo and prints warning messages if any cores don't have constant_tsc and nonstop_tsc. It has no functional meaning. This consumes a noticeable amount of time in secondary processes - on my test system, it consumes 21ms out of the 66ms total execution time for rte_eal_init(). So let's just skip checking these flags in secondary processes. Since the primary process is already parsing the entirety of /proc/cpuinfo, the warning printed in the primary process should be sufficient. Signed-off-by: Jim Harris --- lib/librte_eal/linux/eal/eal_timer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal_timer.c b/lib/librte_eal/linux/eal/eal_timer.c index 76ec17034..ce447d43b 100644 --- a/lib/librte_eal/linux/eal/eal_timer.c +++ b/lib/librte_eal/linux/eal/eal_timer.c @@ -198,6 +198,15 @@ check_tsc_flags(void) char line[512]; FILE *stream; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + /* This function just prints warnings if TSC is not constant + * and has no functional meaning. It also checks *all* cores + * on the system, not just the ones configured for this process. + * So don't bother rechecking again in secondary processes. + */ + return; + } + stream = fopen("/proc/cpuinfo", "r"); if (!stream) { RTE_LOG(WARNING, EAL, "WARNING: Unable to open /proc/cpuinfo\n");