From: Stephen Boyd <sboyd@codeaurora.org>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>,
Saravana Kannan <skannan@codeaurora.org>,
Colin Cross <ccross@android.com>,
Kevin Hilman <khilman@deeprootsystems.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too)
Date: Tue, 7 Sep 2010 11:23:51 -0700 [thread overview]
Message-ID: <1283883834-4693-1-git-send-email-sboyd@codeaurora.org> (raw)
(Sorry, resending due to stray comma...)
These patches are another attempt at fixing the udelay()
issue pointed out on arm-lkml[1][2]. A quick recap: some SMP
machines can scale their CPU frequencies independent of one
another. loops_per_jiffy is calibrated globally and used in
__const_udelay(). If one CPU is running faster than what the
loops_per_jiffy is calculated (or scaled) for, udelay() will
be incorrect and not wait long enough (or too long). A similar
problem occurs if the cpu frequency is scaled during a udelay()
call.
We could fix this issue a couple ways, wholesale replacement
of __udelay() and __const_udelay() (see [2] for that approach),
or replacement of __delay() (this series). Option 1 can fail if
anybody uses udelay() before memory is mapped and also duplicates
most of the code in asm/delay.h. It also needs to hardcode the
timer tick frequency, which can sometimes be inaccurate. The
benefit is that loops_per_jiffy stays the same and thus BogoMIPS
is unchanged. Option 2 can't fail since the __delay() loop is
replaced after memory is mapped in, but it suffers from a low
BogoMIPS when timers are clocked slowly. It also more accurately
calculates the timer tick frequency through the use of
calibrate_delay_direct().
-- Reference --
[1] http://article.gmane.org/gmane.linux.kernel/977567
[2] http://article.gmane.org/gmane.linux.ports.arm.kernel/78496
Stephen Boyd (3):
[ARM] Translate delay.S into (mostly) C
[ARM] Allow machines to override __delay()
[ARM] Implement a timer based __delay() loop
arch/arm/include/asm/delay.h | 5 ++-
arch/arm/kernel/armksyms.c | 4 --
arch/arm/lib/delay.S | 65 ------------------------------
arch/arm/lib/delay.c | 90 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 94 insertions(+), 70 deletions(-)
delete mode 100644 arch/arm/lib/delay.S
create mode 100644 arch/arm/lib/delay.c
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too)
Date: Tue, 7 Sep 2010 11:23:51 -0700 [thread overview]
Message-ID: <1283883834-4693-1-git-send-email-sboyd@codeaurora.org> (raw)
(Sorry, resending due to stray comma...)
These patches are another attempt at fixing the udelay()
issue pointed out on arm-lkml[1][2]. A quick recap: some SMP
machines can scale their CPU frequencies independent of one
another. loops_per_jiffy is calibrated globally and used in
__const_udelay(). If one CPU is running faster than what the
loops_per_jiffy is calculated (or scaled) for, udelay() will
be incorrect and not wait long enough (or too long). A similar
problem occurs if the cpu frequency is scaled during a udelay()
call.
We could fix this issue a couple ways, wholesale replacement
of __udelay() and __const_udelay() (see [2] for that approach),
or replacement of __delay() (this series). Option 1 can fail if
anybody uses udelay() before memory is mapped and also duplicates
most of the code in asm/delay.h. It also needs to hardcode the
timer tick frequency, which can sometimes be inaccurate. The
benefit is that loops_per_jiffy stays the same and thus BogoMIPS
is unchanged. Option 2 can't fail since the __delay() loop is
replaced after memory is mapped in, but it suffers from a low
BogoMIPS when timers are clocked slowly. It also more accurately
calculates the timer tick frequency through the use of
calibrate_delay_direct().
-- Reference --
[1] http://article.gmane.org/gmane.linux.kernel/977567
[2] http://article.gmane.org/gmane.linux.ports.arm.kernel/78496
Stephen Boyd (3):
[ARM] Translate delay.S into (mostly) C
[ARM] Allow machines to override __delay()
[ARM] Implement a timer based __delay() loop
arch/arm/include/asm/delay.h | 5 ++-
arch/arm/kernel/armksyms.c | 4 --
arch/arm/lib/delay.S | 65 ------------------------------
arch/arm/lib/delay.c | 90 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 94 insertions(+), 70 deletions(-)
delete mode 100644 arch/arm/lib/delay.S
create mode 100644 arch/arm/lib/delay.c
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next reply other threads:[~2010-09-07 18:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 18:23 Stephen Boyd [this message]
2010-09-07 18:23 ` [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too) Stephen Boyd
2010-09-07 18:23 ` [PATCH 1/3] [ARM] Translate delay.S into (mostly) C Stephen Boyd
2010-09-07 18:23 ` Stephen Boyd
2010-09-07 18:23 ` [PATCH 2/3] [ARM] Allow machines to override __delay() Stephen Boyd
2010-09-07 18:23 ` Stephen Boyd
2010-09-07 18:23 ` [PATCH 3/3] [ARM] Implement a timer based __delay() loop Stephen Boyd
2010-09-07 18:23 ` Stephen Boyd
2010-09-22 21:54 ` [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too) Daniel Walker
2010-09-22 21:54 ` Daniel Walker
-- strict thread matches above, loose matches on Subject: below --
2010-09-28 3:33 Stephen Boyd
2010-09-28 3:33 ` Stephen Boyd
2010-09-04 4:28 Stephen Boyd
2010-08-19 2:24 Stephen Boyd
2010-08-19 2:24 ` Stephen Boyd
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=1283883834-4693-1-git-send-email-sboyd@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=ccross@android.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=santosh.shilimkar@ti.com \
--cc=skannan@codeaurora.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.