DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sangjin Han <sangjin@eecs.berkeley.edu>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] "No probed ethernet devices" caused by inaccurate msec_delay()
Date: Mon, 27 Jan 2014 17:16:59 -0800	[thread overview]
Message-ID: <CAPG33HQW9onUHh+M7w26hB-0+us2dtY1A3Bj68b-+K1fnEt5KA@mail.gmail.com> (raw)
In-Reply-To: <201401271019.00293.thomas.monjalon@6wind.com>

Hi,

>> It would be nice if I can bypass set_tsc_freq_from_cpuinfo() in
>> set_tsc_freq().
>
> I think it would not solve the problem because your clock is varying and the
> TSC calibration must be updated accordingly with different values by core.

Reasonably new Intel CPUs (including Nehalem) has a constant TSC rate,
regardless of the current P/C-state (constant_tsc and nonstop_tsc
flags in /proc/cpuinfo). So TSC calibration is unnecessary even with
variable clock frequency on those CPUs.

Also, it seems that there is no guarantee that the TSC rate is
identical to the CPU max clock frequency. While it happens to be true
for Intel CPUs, this article from AMD says,
(https://lkml.org/lkml/2005/11/4/173)

"The rate of the invariant TSC is implementation-dependent and will
likely *not* be the frequency of the processor core [...]"

It would be great if someone can actually measure TSC rate on AMD
processors to verify this.

I would like to suggest two possible options:

1. If we can assume that the TSC rate always equals to the max clock
frequency, then we can use
/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq instead of
/proc/cpuinfo (which reflects cpuinfo_cur_freq).

2. If we can't (AMD?), we can simply get rid of
set_tsc_freq_from_cpuinfo() and fall back to set_tsc_freq_from_clock()
or set_tsc_freq_ballback() instead. I always get reasonably good
accuracy with those two functions -- the only drawback is that it
takes 0.5 - 1 second for applications to boot up. Not sure if it is a
big deal or not, though.

---

Besides the TSC frequency, the 4ms * 10 delay in
ixgbe_reset_pipeline_82599() seems too tight. On my system, it
succeeds only after 7 (or so) iterations with correct msec_delay().
The per-iteration delay (4ms; in the kernel ixgbe driver, it is set to
be 4-8ms) and/or the number of iterations (10) should be increased, I
suppose.

Sangjin

  reply	other threads:[~2014-01-28  1:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  2:56 Sangjin Han
2014-01-27  9:19 ` Thomas Monjalon
2014-01-28  1:16   ` Sangjin Han [this message]
2014-01-28 16:23     ` Thomas Monjalon
2014-01-28 18:13       ` Stephen Hemminger

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=CAPG33HQW9onUHh+M7w26hB-0+us2dtY1A3Bj68b-+K1fnEt5KA@mail.gmail.com \
    --to=sangjin@eecs.berkeley.edu \
    --cc=dev@dpdk.org \
    --cc=thomas.monjalon@6wind.com \
    /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).