All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/core Bug 1869] incorrect get_tsc_freq_arch() due to integer truncation
Date: Thu, 22 Jan 2026 18:03:47 +0000	[thread overview]
Message-ID: <bug-1869-3@http.bugs.dpdk.org/> (raw)

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: dev@dpdk.org
          Reporter: rizzo.unipi@gmail.com
  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;

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2026-01-22 18:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 18:03 bugzilla [this message]
2026-02-17 22:03 ` [DPDK/core Bug 1869] incorrect get_tsc_freq_arch() due to integer truncation bugzilla

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=bug-1869-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.