eal/x86: fix TSC frequency query
PATCH 1/1 eal/x86: fix TSC frequency query
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")
Reported-by Luigi Rizzo <[email protected]>
Signed-off-by Thomas Monjalon <[email protected]>
--- lib/eal/x86/rte_cycles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/x86/rte_cycles.c +1 -1
@@ -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
Signature · 1 line
2.52.0
Quoted 8 lines · On Fri, 30 Jan 2026 18:10:26 +0100 Thomas Monjalon <[email protected]> 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
Quoted 6 lines
Bugzilla ID: 1869
Fixes ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")Reported-by Luigi Rizzo <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
Reviewed-by Stephen Hemminger <[email protected]>
Thomas Monjalon
Applied30/01/2026 19:15, Stephen Hemminger:
Quoted 11 lines
Quoted 8 lines · On Fri, 30 Jan 2026 18:10:26 +0100 Thomas Monjalon <[email protected]> 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
Quoted 8 lines
Quoted 6 lines
Bugzilla ID: 1869
Fixes ad3516bb4ae1 ("eal/x86: implement arch-specific TSC freq query")Reported-by Luigi Rizzo <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Reviewed-by Stephen Hemminger <[email protected]>
Applied