public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] eal/x86: fix TSC frequency query
@ 2026-01-30 17:10 Thomas Monjalon
  2026-01-30 18:15 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2026-01-30 17:10 UTC (permalink / raw)
  To: dev
  Cc: stable, Luigi Rizzo, Bruce Richardson, Konstantin Ananyev,
	Sergio Gonzalez Monroy, Harry van Haaren

After getting TSC information from cpuid instruction,
some values must be multiplied and divided.
We must multiply first to get the most accurate value.

Example:
	before: 1000000000 * (23 / 10) = 2 GHz
	after:  1000000000 * 23 / 10 = 2.3 GHz

Bugzilla ID: 1869
Fixes: ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")
Cc: stable@dpdk.org

Reported-by: Luigi Rizzo <rizzo.unipi@gmail.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/eal/x86/rte_cycles.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c
index f147a5231d..e8e805e710 100644
--- a/lib/eal/x86/rte_cycles.c
+++ b/lib/eal/x86/rte_cycles.c
@@ -145,7 +145,7 @@ get_tsc_freq_arch(void)
 
 		/* EBX : TSC/Crystal ratio, ECX : Crystal Hz */
 		if (b && c)
-			return c * (b / a);
+			return (uint64_t)c * b / a;
 	}
 
 #ifdef RTE_TOOLCHAIN_MSVC
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal/x86: fix TSC frequency query
  2026-01-30 17:10 [PATCH] eal/x86: fix TSC frequency query Thomas Monjalon
@ 2026-01-30 18:15 ` Stephen Hemminger
  2026-02-03 11:08   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-01-30 18:15 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: dev, stable, Luigi Rizzo, Bruce Richardson, Konstantin Ananyev,
	Sergio Gonzalez Monroy, Harry van Haaren

On Fri, 30 Jan 2026 18:10:26 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:

> After getting TSC information from cpuid instruction,
> some values must be multiplied and divided.
> We must multiply first to get the most accurate value.
> 
> Example:
> 	before: 1000000000 * (23 / 10) = 2 GHz
> 	after:  1000000000 * 23 / 10 = 2.3 GHz
> 
> Bugzilla ID: 1869
> Fixes: ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")
> Cc: stable@dpdk.org
> 
> Reported-by: Luigi Rizzo <rizzo.unipi@gmail.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal/x86: fix TSC frequency query
  2026-01-30 18:15 ` Stephen Hemminger
@ 2026-02-03 11:08   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-02-03 11:08 UTC (permalink / raw)
  To: Luigi Rizzo
  Cc: dev, stable, Bruce Richardson, Konstantin Ananyev,
	Sergio Gonzalez Monroy, Harry van Haaren, Stephen Hemminger

30/01/2026 19:15, Stephen Hemminger:
> On Fri, 30 Jan 2026 18:10:26 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > After getting TSC information from cpuid instruction,
> > some values must be multiplied and divided.
> > We must multiply first to get the most accurate value.
> > 
> > Example:
> > 	before: 1000000000 * (23 / 10) = 2 GHz
> > 	after:  1000000000 * 23 / 10 = 2.3 GHz
> > 
> > Bugzilla ID: 1869
> > Fixes: ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")
> > Cc: stable@dpdk.org
> > 
> > Reported-by: Luigi Rizzo <rizzo.unipi@gmail.com>
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>

Applied




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-03 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 17:10 [PATCH] eal/x86: fix TSC frequency query Thomas Monjalon
2026-01-30 18:15 ` Stephen Hemminger
2026-02-03 11:08   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox