* [dpdk-dev] [PATCH 1/5] eal/x86: define architecture specific rdtsc hz
2017-08-13 7:03 [dpdk-dev] [PATCH 0/5] improve tsc frequency calibration Jerin Jacob
@ 2017-08-13 7:03 ` Jerin Jacob
2017-09-18 12:54 ` Burakov, Anatoly
2017-08-13 7:03 ` [dpdk-dev] [PATCH 2/5] eal/ppc64: " Jerin Jacob
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2017-08-13 7:03 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin,
jianbo.liu, chaozhu, Jerin Jacob
CC: Bruce Richardson <bruce.richardson@intel.com>
CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/include/arch/x86/rte_cycles.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/librte_eal/common/include/arch/x86/rte_cycles.h b/lib/librte_eal/common/include/arch/x86/rte_cycles.h
index 1bb3e1dbe..e2661e278 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_cycles.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_cycles.h
@@ -77,6 +77,19 @@ rte_rdtsc(void)
return tsc.tsc_64;
}
+/**
+ * Get the number of rdtsc cycles in one second if the architecture supports.
+ *
+ * @return
+ * The number of rdtsc cycles in one second. Return zero if the architecture
+ * support is not available.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ return 0;
+}
+
static inline uint64_t
rte_rdtsc_precise(void)
{
--
2.14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 2/5] eal/ppc64: define architecture specific rdtsc hz
2017-08-13 7:03 [dpdk-dev] [PATCH 0/5] improve tsc frequency calibration Jerin Jacob
2017-08-13 7:03 ` [dpdk-dev] [PATCH 1/5] eal/x86: define architecture specific rdtsc hz Jerin Jacob
@ 2017-08-13 7:03 ` Jerin Jacob
2017-09-28 1:53 ` Chao Zhu
2017-08-13 7:03 ` [dpdk-dev] [PATCH 3/5] eal/armv7: " Jerin Jacob
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2017-08-13 7:03 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin,
jianbo.liu, chaozhu, Jerin Jacob
CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h | 13 +++++++++++++
1 file changed, 13 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 8fa6fc60b..20243fb29 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
@@ -79,6 +79,19 @@ rte_rdtsc(void)
return tsc.tsc_64;
}
+/**
+ * Get the number of rdtsc cycles in one second if the architecture supports.
+ *
+ * @return
+ * The number of rdtsc cycles in one second. Return zero if the architecture
+ * support is not available.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ return 0;
+}
+
static inline uint64_t
rte_rdtsc_precise(void)
{
--
2.14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH 2/5] eal/ppc64: define architecture specific rdtsc hz
2017-08-13 7:03 ` [dpdk-dev] [PATCH 2/5] eal/ppc64: " Jerin Jacob
@ 2017-09-28 1:53 ` Chao Zhu
0 siblings, 0 replies; 9+ messages in thread
From: Chao Zhu @ 2017-09-28 1:53 UTC (permalink / raw)
To: 'Jerin Jacob', dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin, jianbo.liu
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: 2017年8月13日 15:04
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; bruce.richardson@intel.com;
> konstantin.ananyev@intel.com; viktorin@rehivetech.com;
> jianbo.liu@linaro.org; chaozhu@linux.vnet.ibm.com; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH 2/5] eal/ppc64: define architecture specific
rdtsc hz
>
> CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h | 13 +++++++++++++
> 1 file changed, 13 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 8fa6fc60b..20243fb29 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
> @@ -79,6 +79,19 @@ rte_rdtsc(void)
> return tsc.tsc_64;
> }
>
> +/**
> + * Get the number of rdtsc cycles in one second if the architecture
supports.
> + *
> + * @return
> + * The number of rdtsc cycles in one second. Return zero if the
architecture
> + * support is not available.
> + */
> +static inline uint64_t
> +rte_rdtsc_arch_hz(void)
> +{
> + return 0;
> +}
> +
> static inline uint64_t
> rte_rdtsc_precise(void)
> {
> --
> 2.14.0
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 3/5] eal/armv7: define architecture specific rdtsc hz
2017-08-13 7:03 [dpdk-dev] [PATCH 0/5] improve tsc frequency calibration Jerin Jacob
2017-08-13 7:03 ` [dpdk-dev] [PATCH 1/5] eal/x86: define architecture specific rdtsc hz Jerin Jacob
2017-08-13 7:03 ` [dpdk-dev] [PATCH 2/5] eal/ppc64: " Jerin Jacob
@ 2017-08-13 7:03 ` Jerin Jacob
2017-08-13 7:03 ` [dpdk-dev] [PATCH 4/5] eal/armv8: " Jerin Jacob
2017-08-13 7:03 ` [dpdk-dev] [PATCH 5/5] eal/timer: honor architecture specific rdtsc hz function Jerin Jacob
4 siblings, 0 replies; 9+ messages in thread
From: Jerin Jacob @ 2017-08-13 7:03 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin,
jianbo.liu, chaozhu, Jerin Jacob
CC: Jan Viktorin <viktorin@rehivetech.com>
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/include/arch/arm/rte_cycles_32.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h b/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
index 9c1be71ea..68d7462c4 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_32.h
@@ -104,6 +104,19 @@ __rte_rdtsc_pmccntr(void)
#endif /* RTE_ARM_EAL_RDTSC_USE_PMU */
+/**
+ * Get the number of rdtsc cycles in one second if the architecture supports.
+ *
+ * @return
+ * The number of rdtsc cycles in one second. Return zero if the architecture
+ * support is not available.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ return 0;
+}
+
static inline uint64_t
rte_rdtsc_precise(void)
{
--
2.14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 4/5] eal/armv8: define architecture specific rdtsc hz
2017-08-13 7:03 [dpdk-dev] [PATCH 0/5] improve tsc frequency calibration Jerin Jacob
` (2 preceding siblings ...)
2017-08-13 7:03 ` [dpdk-dev] [PATCH 3/5] eal/armv7: " Jerin Jacob
@ 2017-08-13 7:03 ` Jerin Jacob
2017-08-15 3:35 ` Jianbo Liu
2017-08-13 7:03 ` [dpdk-dev] [PATCH 5/5] eal/timer: honor architecture specific rdtsc hz function Jerin Jacob
4 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2017-08-13 7:03 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin,
jianbo.liu, chaozhu, Jerin Jacob
Use cntvct_el0 system register to get the system counter frequency.
If the system is configured with RTE_ARM_EAL_RDTSC_USE_PMU then
return 0(let the common code calibrate the tsc frequency).
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
.../common/include/arch/arm/rte_cycles_64.h | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
index 154576910..5b95cb67d 100644
--- a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
+++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
@@ -58,6 +58,23 @@ rte_rdtsc(void)
asm volatile("mrs %0, cntvct_el0" : "=r" (tsc));
return tsc;
}
+
+/**
+ * Get the number of rdtsc cycles in one second if the architecture supports.
+ *
+ * @return
+ * The number of rdtsc cycles in one second. Return zero if the architecture
+ * support is not available.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ uint64_t freq;
+
+ asm volatile("mrs %0, cntfrq_el0" : "=r" (freq));
+ return freq;
+}
+
#else
/**
* This is an alternative method to enable rte_rdtsc() with high resolution
@@ -85,6 +102,19 @@ rte_rdtsc(void)
asm volatile("mrs %0, pmccntr_el0" : "=r"(tsc));
return tsc;
}
+
+/**
+ * Get the number of rdtsc cycles in one second if the architecture supports.
+ *
+ * @return
+ * The number of rdtsc cycles in one second. Return zero if the architecture
+ * support is not available.
+ */
+static inline uint64_t
+rte_rdtsc_arch_hz(void)
+{
+ return 0;
+}
#endif
static inline uint64_t
--
2.14.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH 4/5] eal/armv8: define architecture specific rdtsc hz
2017-08-13 7:03 ` [dpdk-dev] [PATCH 4/5] eal/armv8: " Jerin Jacob
@ 2017-08-15 3:35 ` Jianbo Liu
0 siblings, 0 replies; 9+ messages in thread
From: Jianbo Liu @ 2017-08-15 3:35 UTC (permalink / raw)
To: Jerin Jacob
Cc: dev, Thomas Monjalon, Bruce Richardson, Ananyev, Konstantin,
Jan Viktorin, Chao Zhu
On 13 August 2017 at 15:03, Jerin Jacob <jerin.jacob@caviumnetworks.com> wrote:
> Use cntvct_el0 system register to get the system counter frequency.
>
> If the system is configured with RTE_ARM_EAL_RDTSC_USE_PMU then
> return 0(let the common code calibrate the tsc frequency).
>
> CC: Jianbo Liu <jianbo.liu@linaro.org>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> .../common/include/arch/arm/rte_cycles_64.h | 30 ++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> index 154576910..5b95cb67d 100644
> --- a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h
> @@ -58,6 +58,23 @@ rte_rdtsc(void)
> asm volatile("mrs %0, cntvct_el0" : "=r" (tsc));
> return tsc;
> }
> +
> +/**
> + * Get the number of rdtsc cycles in one second if the architecture supports.
> + *
> + * @return
> + * The number of rdtsc cycles in one second. Return zero if the architecture
> + * support is not available.
> + */
> +static inline uint64_t
> +rte_rdtsc_arch_hz(void)
> +{
> + uint64_t freq;
> +
> + asm volatile("mrs %0, cntfrq_el0" : "=r" (freq));
> + return freq;
> +}
> +
> #else
> /**
> * This is an alternative method to enable rte_rdtsc() with high resolution
> @@ -85,6 +102,19 @@ rte_rdtsc(void)
> asm volatile("mrs %0, pmccntr_el0" : "=r"(tsc));
> return tsc;
> }
> +
> +/**
> + * Get the number of rdtsc cycles in one second if the architecture supports.
> + *
> + * @return
> + * The number of rdtsc cycles in one second. Return zero if the architecture
> + * support is not available.
> + */
> +static inline uint64_t
> +rte_rdtsc_arch_hz(void)
> +{
> + return 0;
> +}
> #endif
>
> static inline uint64_t
> --
> 2.14.0
>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 5/5] eal/timer: honor architecture specific rdtsc hz function
2017-08-13 7:03 [dpdk-dev] [PATCH 0/5] improve tsc frequency calibration Jerin Jacob
` (3 preceding siblings ...)
2017-08-13 7:03 ` [dpdk-dev] [PATCH 4/5] eal/armv8: " Jerin Jacob
@ 2017-08-13 7:03 ` Jerin Jacob
4 siblings, 0 replies; 9+ messages in thread
From: Jerin Jacob @ 2017-08-13 7:03 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, konstantin.ananyev, viktorin,
jianbo.liu, chaozhu, Jerin Jacob
When calibrating the tsc frequency, first, probe the architecture specific
rdtsc hz function. if not available, use the existing calibrate scheme
to calibrate the tsc frequency.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
lib/librte_eal/common/eal_common_timer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_timer.c b/lib/librte_eal/common/eal_common_timer.c
index ed0b16d05..978edaed7 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 = rte_rdtsc_arch_hz();
+ if (!freq)
+ freq = get_tsc_freq();
if (!freq)
freq = estimate_tsc_freq();
--
2.14.0
^ permalink raw reply [flat|nested] 9+ messages in thread