linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Don't ever downscale loops_per_jiffy in SMP systems
Date: Fri, 9 May 2014 01:23:35 +0100	[thread overview]
Message-ID: <20140509002334.GK3693@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAD=FV=ViOie+E_mxgcE51oNL0HY1zF9KYG_TDSbKjMzE2GZZMw@mail.gmail.com>

On Thu, May 08, 2014 at 05:02:02PM -0700, Doug Anderson wrote:
> Russel,
> 
> On Thu, May 8, 2014 at 1:55 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Thu, May 08, 2014 at 11:06:24AM -0700, Doug Anderson wrote:
> >> I guess I would say that my patch is unhacking the this code.  The
> >> code after my patch is simpler.  I would perhaps argue that (ec971ea
> >> ARM: add cpufreq transiton notifier to adjust loops_per_jiffy for smp)
> >> should never have landed to begin with.
> >
> > That depends on your point of view.  As I've already pointed out through
> > the examples of why udelay() is inaccurate, for driver authors, they
> > should assume that udelay() just gives you an "approximate" delay and
> > it has no accuracy.
> 
> That disagrees with what Thomas Gleixner says at
> <http://lkml.iu.edu//hypermail/linux/kernel/1203.1/01034.html>.  It
> also seems like perhaps the regulator core is broken, then...  If a
> udelay(30) can end up as a udelay(20) then we may return from a
> regulator code 10us earlier than we should and we'll assume that a
> regulator is ramped before it really is...
> 
> I'm out tomorrow but I can confirm on Monday that I was really seeing
> udelay(30) be a udelay(20) without this patch.

Thomas is wrong - when I researched this topic, I ended up finding
that udelay() does delay _less_ than requested, and I mailed Linus
about it...  This is whe way udelay() is - it's an approximate delay,
it's *not* accurate.

It's also fairly obvious when you stop and consider how it's calibrated.

Take a moment to wonder when we used to recalibrate each CPU individally,
why the boot CPU bogomips would be slightly lower than the secondary
CPU bogomips.  This is all down to the boot CPU having to run timer
interrupts while the secondary CPUs weren't at the time they calibrated.

Linus doesn't give a damn about udelay() being slightly short in this
way.  Neither do I.

Let me repeat again: use a timer.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

  reply	other threads:[~2014-05-09  0:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 23:23 [PATCH] ARM: Don't ever downscale loops_per_jiffy in SMP systems Doug Anderson
2014-05-08 10:41 ` Viresh Kumar
2014-05-08 15:25   ` Doug Anderson
2014-05-08 16:04     ` Nicolas Pitre
2014-05-08 16:41       ` Doug Anderson
2014-05-08 17:43         ` Nicolas Pitre
2014-05-08 18:06           ` Doug Anderson
2014-05-08 19:59             ` Nicolas Pitre
2014-05-08 20:55             ` Russell King - ARM Linux
2014-05-09  0:02               ` Doug Anderson
2014-05-09  0:23                 ` Russell King - ARM Linux [this message]
2014-05-09  4:41                   ` Doug Anderson
2014-05-08 19:22           ` Russell King - ARM Linux
2014-05-08 20:12             ` Nicolas Pitre
2014-05-08 20:39               ` John Stultz
2014-05-08 20:52               ` Russell King - ARM Linux
2014-05-09  1:37                 ` Nicolas Pitre
2014-05-09  4:43                   ` Doug Anderson
2014-05-09  9:18                   ` [PATCH] ARM: Don't ever downscale loops_per_jiffy in SMP systems# Russell King - ARM Linux
2014-05-09 18:00                     ` Nicolas Pitre
2014-05-09 18:22                       ` Russell King - ARM Linux
2014-05-09 21:05                         ` Nicolas Pitre
2014-05-12 23:51                           ` Doug Anderson
2014-05-13 21:50                             ` Doug Anderson
2014-05-13 22:15                               ` Stephen Warren
2014-05-13 23:15                                 ` Nicolas Pitre
2014-05-13 23:29                                   ` Nicolas Pitre
2014-05-13 23:36                                     ` Russell King - ARM Linux
2014-05-14 21:42                                     ` Doug Anderson
2014-05-15  6:12                               ` Viresh Kumar
2014-05-09  9:25     ` [PATCH] ARM: Don't ever downscale loops_per_jiffy in SMP systems Viresh Kumar

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=20140509002334.GK3693@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).