linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/3] ARM: Fixing udelay() for SMP and non-SMP systems
@ 2010-10-28 21:19 Stephen Boyd
  2010-10-28 21:19 ` [PATCHv2 1/3] ARM: Translate delay.S into (mostly) C Stephen Boyd
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Stephen Boyd @ 2010-10-28 21:19 UTC (permalink / raw)
  To: Russell King
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Daniel Walker,
	Saravana Kannan, Colin Cross, Kevin Hilman, Santosh Shilimkar,
	Nicolas Pitre

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().

Changes since v1:
 * likely() in delay.c
 * comment fixup for read_current_timer_delay_loop() 
 * cosmetic improvements to commit text

I didn't add any more comments to delay.c's functions since I
couldn't come up with anything worthwhile to say.

-- 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.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-11-08 18:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 21:19 [PATCHv2 0/3] ARM: Fixing udelay() for SMP and non-SMP systems Stephen Boyd
2010-10-28 21:19 ` [PATCHv2 1/3] ARM: Translate delay.S into (mostly) C Stephen Boyd
2010-11-03 17:57   ` Daniel Walker
2010-11-04  2:40     ` Nicolas Pitre
2010-11-03 18:27   ` Will Deacon
2010-11-03 23:15     ` Stephen Boyd
2010-11-03 23:17       ` Daniel Walker
2010-10-28 21:19 ` [PATCHv2 2/3] ARM: Allow machines to override __delay() Stephen Boyd
2010-11-04 19:30   ` Daniel Walker
2010-11-04 20:58     ` Stephen Boyd
2010-11-04 21:16       ` Daniel Walker
2010-11-05 21:51         ` Stephen Boyd
2010-11-05 23:43           ` Daniel Walker
2010-11-06  3:36             ` Stephen Boyd
2010-11-08 18:11               ` Daniel Walker
2010-10-28 21:19 ` [PATCHv2 3/3] ARM: Implement a timer based __delay() loop Stephen Boyd

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).