From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: stable@dpdk.org, Luigi Rizzo <rizzo.unipi@gmail.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Konstantin Ananyev <konstantin.ananyev@huawei.com>,
Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>,
Harry van Haaren <harry.van.haaren@intel.com>
Subject: [PATCH] eal/x86: fix TSC frequency query
Date: Fri, 30 Jan 2026 18:10:26 +0100 [thread overview]
Message-ID: <20260130171026.277418-1-thomas@monjalon.net> (raw)
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
next reply other threads:[~2026-01-30 17:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 17:10 Thomas Monjalon [this message]
2026-01-30 18:15 ` [PATCH] eal/x86: fix TSC frequency query Stephen Hemminger
2026-02-03 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=20260130171026.277418-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=konstantin.ananyev@huawei.com \
--cc=rizzo.unipi@gmail.com \
--cc=sergio.gonzalez.monroy@intel.com \
--cc=stable@dpdk.org \
/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