DPDK patches and discussions
 help / color / mirror / Atom feed
From: Matteo Lanzuisi <m.lanzuisi@resi.it>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] set_tsc_freq() wrong return value - bug?
Date: Wed, 28 Nov 2018 11:35:07 +0100	[thread overview]
Message-ID: <55824f2a-44b5-1245-47b7-b9e3fd1b92eb@resi.it> (raw)

Hi all,

during some tests with dpdk 18.02.2 on RedHat 7 kernel 
3.10.0-862.el7.x86_64 using Intel X710 and 2 x Intel(R) Xeon(R) Gold 
6130 CPU @ 2.10GHz I found the following.

I put some log in the function set_tsc_freq as you can see below

void
set_tsc_freq(void)
{
         uint64_t freq;

         freq = get_tsc_freq_arch();
         RTE_LOG(WARNING, EAL, "Function get_tsc_freq_arch() returns 
%lu\n", freq);
         if (!freq)
         {
                 freq = get_tsc_freq();
                 RTE_LOG(WARNING, EAL, "Function get_tsc_freq() returns 
%lu\n", freq);
         }
         if (!freq)
         {
                 freq = estimate_tsc_freq();
                 RTE_LOG(WARNING, EAL, "Function estimate_tsc_freq() 
returns %lu\n", freq);
         }
         RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq 
/ 1000);
         eal_tsc_resolution_hz = freq;
}

the output of this function is:

"EAL: Function get_tsc_freq_arch() returns 2100000000"

but with this value if I use the rte_get_timer_cycles() in my 
application and try to convert the return value into seconds I saw that 
the more time passes the more date is wrong.

Moreover, if I comment some rows in the set_tsc_freq function this way

void
set_tsc_freq(void)
{
         uint64_t freq;

         //freq = get_tsc_freq_arch();
         //RTE_LOG(WARNING, EAL, "Function get_tsc_freq_arch() returns 
%lu\n", freq);
         //if (!freq)
         //{
                 freq = get_tsc_freq();
                 RTE_LOG(WARNING, EAL, "Function get_tsc_freq() returns 
%lu\n", freq);
         //}
         if (!freq)
         {
                 freq = estimate_tsc_freq();
                 RTE_LOG(WARNING, EAL, "Function estimate_tsc_freq() 
returns %lu\n", freq);
         }
         RTE_LOG(DEBUG, EAL, "TSC frequency is ~%" PRIu64 " KHz\n", freq 
/ 1000);
         eal_tsc_resolution_hz = freq;
}

the result is

"EAL: Function get_tsc_freq() returns 2094994596"

with this value the conversion into seconds from rte_get_timer_cycles() 
is always correct.

Is this a bug? Or am I doing something wrong?

Regards,
Matteo

                 reply	other threads:[~2018-11-28 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=55824f2a-44b5-1245-47b7-b9e3fd1b92eb@resi.it \
    --to=m.lanzuisi@resi.it \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).