DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"Jacob,  Jerin" <Jerin.JacobKollanukkaran@cavium.com>
Cc: "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] eal: roundup tsc frequency when estimating it
Date: Fri, 30 Nov 2018 07:17:00 +0000	[thread overview]
Message-ID: <20181130071641.GA11625@ltp-pvn> (raw)
In-Reply-To: <20181129132152.754ce410@xeon-e3>

Hi Stephen,

On Thu, Nov 29, 2018 at 01:21:52PM -0800, Stephen Hemminger wrote:
> On Thu, 29 Nov 2018 08:32:03 +0000
> Pavan Nikhilesh <pbhagavatula@caviumnetworks.com> wrote:
>
> > When estimating tsc frequency using sleep/gettime round it up to the
> > nearest multiple of 10Mhz for more accuracy.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
>
> Rounding reduces accuracy.
>
> Why is this code being used?  Shouldn't get_tsc_freq_arch return a
> correct value?

This patch doesn't modify get_tsc_freq_arch(), it basically gives a more
accurate freq reading when we rely on sleep(1) i.e. only when
get_tsc_freq_arch() returns 0.

example:

static uint64_t
estimate_tsc_freq(void)
{
        RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
                " - clock timings may be less accurate.\n");
        /* assume that the sleep(1) will sleep for 1 second */
        uint64_t start = rte_rdtsc();
        sleep(1);
        return rte_rdtsc() - start;
}

This will not give the accurate cyc/sec in most cases, rounding it to 10Mhz wil
do the job.

In case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, get_tsc_freq_arch()
will return 0 as there is no instruction to determine the clk of PMU.

>
> How well does the rdmsr() logic work in VM?
> It looks like Hyper-V has special MSR's for TSC frequency determination.

Maybe bruce can give a more accurate answer to this as it is x86 specific.

Thanks,
Pavan.

  reply	other threads:[~2018-11-30  7:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29  8:32 Pavan Nikhilesh
2018-11-29  9:08 ` Jerin Jacob
2018-11-29 21:21 ` Stephen Hemminger
2018-11-30  7:17   ` Pavan Nikhilesh [this message]
2019-03-16  7:03 ` [dpdk-dev] [PATCH v2 1/2] eal: add macro to align value to the nearest multiple Pavan Nikhilesh Bhagavatula
2019-03-16  7:03   ` Pavan Nikhilesh Bhagavatula
2019-03-16  7:03   ` [dpdk-dev] [PATCH v2 2/2] eal: roundup tsc frequency when estimating it Pavan Nikhilesh Bhagavatula
2019-03-16  7:03     ` Pavan Nikhilesh Bhagavatula
2019-03-16 14:42     ` Wiles, Keith
2019-03-16 14:42       ` Wiles, Keith
2019-03-16 15:06       ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2019-03-16 15:06         ` Pavan Nikhilesh Bhagavatula
2019-03-16 17:18         ` Wiles, Keith
2019-03-16 17:18           ` Wiles, Keith
2019-03-16 17:56           ` Pavan Nikhilesh Bhagavatula
2019-03-16 17:56             ` Pavan Nikhilesh Bhagavatula
2019-03-16 18:22             ` Wiles, Keith
2019-03-16 18:22               ` Wiles, Keith
2019-03-16 18:27               ` Pavan Nikhilesh Bhagavatula
2019-03-16 18:27                 ` Pavan Nikhilesh Bhagavatula
2019-03-16 19:01 ` [dpdk-dev] [PATCH v3 1/2] eal: add macro to align value to the nearest multiple Pavan Nikhilesh Bhagavatula
2019-03-16 19:01   ` Pavan Nikhilesh Bhagavatula
2019-03-16 19:01   ` [dpdk-dev] [PATCH v3 2/2] eal: roundup tsc frequency when estimating Pavan Nikhilesh Bhagavatula
2019-03-16 19:01     ` Pavan Nikhilesh Bhagavatula
2019-03-27 22:43     ` Thomas Monjalon
2019-03-27 22:43       ` 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=20181130071641.GA11625@ltp-pvn \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=Jerin.JacobKollanukkaran@cavium.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.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).