DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
From: Jim Harris <james.r.harris@intel.com>
To: dev@dpdk.org, anatoly.burakov@intel.com
Subject: [dpdk-dev] [PATCH 2/2] timer: don't check tsc flags in secondary processes
Date: Thu, 15 Aug 2019 04:27:40 -0700
Message-ID: <156586846064.44449.9348520751731980354.stgit@jrharri1-skx> (raw)
In-Reply-To: <156586845525.44449.11798632267644345382.stgit@jrharri1-skx>

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

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 <james.r.harris@intel.com>
 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");

  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 11:27 [dpdk-dev] [PATCH 1/2] timer: use rte_mp_msg to pass TSC hz to secondary procs Jim Harris
2019-08-15 11:27 ` Jim Harris [this message]
2019-08-16  7:56 ` Burakov, Anatoly
2019-08-16 19:01   ` Harris, James R
2019-08-26  9:54 ` Bruce Richardson

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156586846064.44449.9348520751731980354.stgit@jrharri1-skx \
    --to=james.r.harris@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/ public-inbox