From: Thomas Monjalon <thomas@monjalon.net>
To: gowrishankar.m@linux.vnet.ibm.com,
jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org,
sergio.gonzalez.monroy@intel.com, bruce.richardson@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/4] timer: honor arch-specific TSC frequency query
Date: Fri, 13 Oct 2017 02:02:44 +0200 [thread overview]
Message-ID: <20171013000247.4158-2-thomas@monjalon.net> (raw)
In-Reply-To: <20171013000247.4158-1-thomas@monjalon.net>
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
When calibrating the TSC frequency, first, probe the architecture specific
function. If not available, use the existing calibrate scheme.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
lib/librte_eal/bsdapp/eal/Makefile | 1 +
lib/librte_eal/common/arch/arm/rte_cycles.c | 7 +++++++
lib/librte_eal/common/arch/ppc_64/rte_cycles.c | 7 +++++++
lib/librte_eal/common/arch/x86/rte_cycles.c | 7 +++++++
lib/librte_eal/common/eal_common_timer.c | 5 ++++-
lib/librte_eal/common/eal_private.h | 11 +++++++++++
lib/librte_eal/linuxapp/eal/Makefile | 1 +
7 files changed, 38 insertions(+), 1 deletion(-)
create mode 100644 lib/librte_eal/common/arch/arm/rte_cycles.c
create mode 100644 lib/librte_eal/common/arch/ppc_64/rte_cycles.c
create mode 100644 lib/librte_eal/common/arch/x86/rte_cycles.c
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index 317a75ebc..b42306bc3 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -92,6 +92,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_service.c
# from arch dir
SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c
SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c
+SRCS-y += rte_cycles.c
CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)
diff --git a/lib/librte_eal/common/arch/arm/rte_cycles.c b/lib/librte_eal/common/arch/arm/rte_cycles.c
new file mode 100644
index 000000000..851fd0255
--- /dev/null
+++ b/lib/librte_eal/common/arch/arm/rte_cycles.c
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+ return 0;
+}
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cycles.c b/lib/librte_eal/common/arch/ppc_64/rte_cycles.c
new file mode 100644
index 000000000..851fd0255
--- /dev/null
+++ b/lib/librte_eal/common/arch/ppc_64/rte_cycles.c
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+ return 0;
+}
diff --git a/lib/librte_eal/common/arch/x86/rte_cycles.c b/lib/librte_eal/common/arch/x86/rte_cycles.c
new file mode 100644
index 000000000..851fd0255
--- /dev/null
+++ b/lib/librte_eal/common/arch/x86/rte_cycles.c
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+ return 0;
+}
diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c
index ed0b16d05..5980b294e 100644
--- a/lib/librte_eal/common/eal_common_timer.c
+++ b/lib/librte_eal/common/eal_common_timer.c
@@ -80,8 +80,11 @@ estimate_tsc_freq(void)
void
set_tsc_freq(void)
{
- uint64_t freq = get_tsc_freq();
+ uint64_t freq;
+ freq = get_tsc_freq_arch();
+ if (!freq)
+ freq = get_tsc_freq();
if (!freq)
freq = estimate_tsc_freq();
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index 597d82e44..6e0f85def 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -314,6 +314,17 @@ void set_tsc_freq(void);
*/
uint64_t get_tsc_freq(void);
+/**
+ * Get TSC frequency if the architecture supports.
+ *
+ * This function is private to the EAL.
+ *
+ * @return
+ * The number of TSC cycles in one second.
+ * Returns zero if the architecture support is not available.
+ */
+uint64_t get_tsc_freq_arch(void);
+
/**
* Prepare physical memory mapping
* i.e. hugepages on Linux and
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 21e0b4aad..140d1acfa 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -101,6 +101,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_service.c
# from arch dir
SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c
SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c
+SRCS-y += rte_cycles.c
CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)
--
2.14.1
next prev parent reply other threads:[~2017-10-13 0:02 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 ` [dpdk-dev] [PATCH v2 2/5] eal/ppc64: " Gowrishankar
2017-10-12 22:20 ` 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 ` Thomas Monjalon [this message]
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=20171013000247.4158-2-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=gowrishankar.m@linux.vnet.ibm.com \
--cc=jerin.jacob@caviumnetworks.com \
--cc=jianbo.liu@linaro.org \
--cc=sergio.gonzalez.monroy@intel.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).