From: Gowrishankar <gowrishankar.m@linux.vnet.ibm.com>
To: dev@dpdk.org
Cc: Chao Zhu <chaozhu@linux.vnet.ibm.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Konstantin Ananyev <konstantin.ananyev@intel.com>,
Jerin Jacob <jerin.jacob@caviumnetworks.com>,
viktorin@rehivetech.com, jianbo.liu@linaro.org
Subject: [dpdk-dev] [PATCH v2 2/5] eal/ppc64: define architecture specific rdtsc hz
Date: Fri, 22 Sep 2017 13:55:34 +0530 [thread overview]
Message-ID: <60996b50e628207157f1b7b6dab704b8224f3cae.1506058385.git.gowrishankar.m@linux.vnet.ibm.com> (raw)
In-Reply-To: <cover.1506058385.git.gowrishankar.m@linux.vnet.ibm.com>
In-Reply-To: <cover.1506058385.git.gowrishankar.m@linux.vnet.ibm.com>
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
In ppc_64, rte_rdtsc() returns timebase register value which increments
at independent timebase frequency and hence not related to lcore cpu
frequency to derive TSC hz. Hence, we stick with master lcore frequency.
CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
---
v2:
* add ppc_64 specific implementation
.../common/include/arch/ppc_64/rte_cycles.h | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
index 8fa6fc6..1b36587 100644
--- a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
+++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h
@@ -38,9 +38,13 @@
#endif
#include "generic/rte_cycles.h"
+#include "../../lib/librte_eal/common/eal_filesystem.h"
#include <rte_byteorder.h>
#include <rte_common.h>
+#include <rte_lcore.h>
+
+static const char sys_cpu_dir[] = "/sys/devices/system/cpu";
/**
* Read the time base register.
@@ -79,6 +83,26 @@
return tsc.tsc_64;
}
+/**
+ * Get the number of rdtsc cycles in one second.
+ *
+ * @return
+ * The number of rdtsc cycles in one second.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ unsigned long cpu_hz;
+ char path[PATH_MAX];
+
+ snprintf(path, sizeof(path), "%s/cpu%d/cpufreq/cpuinfo_cur_freq",
+ sys_cpu_dir, rte_get_master_lcore());
+ if (eal_parse_sysfs_value(path, &cpu_hz) < 0)
+ RTE_LOG(WARNING, EAL, "Unable to parse %s\n", path);
+
+ return cpu_hz*1000;
+}
+
static inline uint64_t
rte_rdtsc_precise(void)
{
--
1.9.1
next prev parent reply other threads:[~2017-09-22 8:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 8:25 [dpdk-dev] [PATCH v2 0/5] improve tsc frequency calibration Gowrishankar
2017-09-22 8:25 ` [dpdk-dev] [PATCH v2 1/5] eal/x86: define architecture specific rdtsc hz Gowrishankar
2017-09-22 8:25 ` Gowrishankar [this message]
2017-10-12 22:20 ` [dpdk-dev] [PATCH v2 2/5] eal/ppc64: " Thomas Monjalon
2017-09-22 8:25 ` [dpdk-dev] [PATCH v2 3/5] eal/armv7: " Gowrishankar
2017-09-22 8:25 ` [dpdk-dev] [PATCH v2 4/5] eal/armv8: " Gowrishankar
2017-09-22 8:25 ` [dpdk-dev] [PATCH v2 5/5] eal/timer: honor architecture specific rdtsc hz function Gowrishankar
2017-10-11 17:36 ` Thomas Monjalon
2017-10-11 18:57 ` Jerin Jacob
2017-10-11 19:25 ` Thomas Monjalon
2017-10-12 8:48 ` Bruce Richardson
2017-10-12 10:12 ` Thomas Monjalon
2017-10-12 10:25 ` Bruce Richardson
2017-10-12 10:16 ` Jerin Jacob
2017-10-13 0:02 ` [dpdk-dev] [PATCH 0/4] improve tsc frequency calibration Thomas Monjalon
2017-10-13 0:02 ` [dpdk-dev] [PATCH 1/4] timer: honor arch-specific TSC frequency query Thomas Monjalon
2017-10-13 0:02 ` [dpdk-dev] [PATCH 2/4] eal/armv8: implement arch-specific TSC freq query Thomas Monjalon
2017-10-13 0:02 ` [dpdk-dev] [PATCH 3/4] eal/ppc64: " Thomas Monjalon
2017-10-13 0:02 ` [dpdk-dev] [PATCH 4/4] eal/x86: " Thomas Monjalon
2017-10-13 3:47 ` Stephen Hemminger
2017-10-13 7:30 ` Thomas Monjalon
2017-10-13 15:13 ` Stephen Hemminger
2017-10-13 15:17 ` Bruce Richardson
2017-10-13 3:21 ` [dpdk-dev] [PATCH 0/4] improve tsc frequency calibration Jerin Jacob
2017-10-13 11:08 ` Thomas Monjalon
Reply instructions:
You may reply publicly 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60996b50e628207157f1b7b6dab704b8224f3cae.1506058385.git.gowrishankar.m@linux.vnet.ibm.com \
--to=gowrishankar.m@linux.vnet.ibm.com \
--cc=bruce.richardson@intel.com \
--cc=chaozhu@linux.vnet.ibm.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=jianbo.liu@linaro.org \
--cc=konstantin.ananyev@intel.com \
--cc=viktorin@rehivetech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).