From patchwork Wed Aug 21 10:18:05 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: 57779 X-Patchwork-Delegate: thomas@monjalon.net 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 8CF7E1BF09; Wed, 21 Aug 2019 19:23:12 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 64CC81BF02 for ; Wed, 21 Aug 2019 19:23:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 10:23:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,412,1559545200"; d="scan'208";a="181093538" Received: from jrharri1-skx.ch.intel.com (HELO [127.0.1.1]) ([143.182.137.73]) by orsmga003.jf.intel.com with ESMTP; 21 Aug 2019 10:23:10 -0700 From: Jim Harris To: dev@dpdk.org, anatoly.burakov@intel.com Date: Wed, 21 Aug 2019 03:18:05 -0700 Message-ID: <156638268505.9344.18339364696357608254.stgit@jrharri1-skx> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] timer: remove check_tsc_flags() 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" This code was added 7+ years ago: commit fb022b85bae4 ("timer: check TSC reliability") presumably when variant TSCs were still somewhat common? But this code doesn't do anything except print a warning, and the warning doesn't give any kind of advice to the user, so let's just remove it. While the warning has no functional meaning, the /proc/cpuinfo parsing consumes a non-trivial amount of time which is especially noticeable in secondary processes. On my test system, it consumes 21ms out of the 66ms total execution time for rte_eal_init() in a secondary process. Signed-off-by: Jim Harris --- lib/librte_eal/linux/eal/eal_timer.c | 36 ---------------------------------- 1 file changed, 36 deletions(-) diff --git a/lib/librte_eal/linux/eal/eal_timer.c b/lib/librte_eal/linux/eal/eal_timer.c index 76ec17034..a904a8297 100644 --- a/lib/librte_eal/linux/eal/eal_timer.c +++ b/lib/librte_eal/linux/eal/eal_timer.c @@ -192,41 +192,6 @@ rte_eal_hpet_init(int make_default) } #endif -static void -check_tsc_flags(void) -{ - char line[512]; - FILE *stream; - - stream = fopen("/proc/cpuinfo", "r"); - if (!stream) { - RTE_LOG(WARNING, EAL, "WARNING: Unable to open /proc/cpuinfo\n"); - return; - } - - while (fgets(line, sizeof line, stream)) { - char *constant_tsc; - char *nonstop_tsc; - - if (strncmp(line, "flags", 5) != 0) - continue; - - constant_tsc = strstr(line, "constant_tsc"); - nonstop_tsc = strstr(line, "nonstop_tsc"); - if (!constant_tsc || !nonstop_tsc) - RTE_LOG(WARNING, EAL, - "WARNING: cpu flags " - "constant_tsc=%s " - "nonstop_tsc=%s " - "-> using unreliable clock cycles !\n", - constant_tsc ? "yes":"no", - nonstop_tsc ? "yes":"no"); - break; - } - - fclose(stream); -} - uint64_t get_tsc_freq(void) { @@ -263,6 +228,5 @@ rte_eal_timer_init(void) eal_timer_source = EAL_TIMER_TSC; set_tsc_freq(); - check_tsc_flags(); return 0; }