incorrect get_tsc_freq_arch() due to integer truncation
http://bugs.dpdk.org/show_bug.cgi?id=1869
Bug ID: 1869
Summary: incorrect get_tsc_freq_arch() due to integer
truncation
Product: DPDK
Version: unspecified
Hardware: x86
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: core
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
There is a bug in
https://github.com/DPDK/dpdk/blob/main/lib/eal/x86/rte_cycles.c#L148
143 __cpuid(0x15, a, b, c, d);
...
146 /* EBX : TSC/Crystal ratio, ECX : Crystal Hz */
147 if (b && c)
148 return c * (b / a);
On one machine, line 143 returns a 10 b 23 c 1000000000 d 0, the division (b / a) returns 2 hence leading to
an incorrect value (2 GHz instead of 2.3 GHz)
The trivial fix is to replace line 148 with
return (uint64_t)c * b / a;
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
http://bugs.dpdk.org/show_bug.cgi?id=1869
Thomas Monjalon ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED--- Comment #4 from Thomas Monjalon ([email protected]) --- Resolved in http://git.dpdk.org/dpdk/commit/?id=a17499cf33
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.