linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] [ARM] Implement a timer based __delay() loop
Date: Tue, 05 Oct 2010 20:36:47 -0700	[thread overview]
Message-ID: <4CABEECF.9080009@codeaurora.org> (raw)
In-Reply-To: <1286300338.18791.26.camel@c-dwalke-linux.qualcomm.com>

 On 10/05/2010 10:38 AM, Daniel Walker wrote:
>>  
>> +#ifdef ARCH_HAS_READ_CURRENT_TIMER
>> +/*
>> + * Assuming read_current_timer() is monotonically increasing
>> + * across calls.
> You should add more comments here. You assuming that it's monotonic over
> a 2000us (2ms) period .. I'm not sure this is a good assumption this
> timer may not be monotonically increasing all the time, what happens
> then?

Ok I'll add that it shouldn't wrap more than once within 2000us (or
should I say 5ms since mdelay uses udelay?). Is that what you're saying
by it not being monotonically increasing? If a timer isn't increasing
the tick count it's broken and this call will loop forever. If the timer
wraps, we'll be safe due to unsigned maths as long as it wraps only once.

>> +void read_current_timer_delay_loop(unsigned long loops)
>> +{
>> +	unsigned long bclock, now;
>> +
>> +	read_current_timer(&bclock);
>> +	do {
>> +		read_current_timer(&now);
>> +	} while ((now - bclock) < loops);
> Have you looked at time_before()/time_after() ?

Nope. Wouldn't that require an addition though to make it work? I'd
rather just leave it like it is.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2010-10-06  3:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  3:33 [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too) Stephen Boyd
2010-09-28  3:33 ` [PATCH 1/3] [ARM] Translate delay.S into (mostly) C Stephen Boyd
2010-10-05 17:22   ` Daniel Walker
2010-10-06  3:36     ` Stephen Boyd
2010-10-06 13:38       ` Daniel Walker
2010-10-06 14:26       ` Nicolas Pitre
2010-10-06 18:30         ` Stephen Boyd
2010-10-06 19:35           ` Daniel Walker
2010-10-06 20:05             ` Nicolas Pitre
2010-10-08  0:11               ` Stephen Boyd
2010-10-08  1:12                 ` Nicolas Pitre
2010-10-06 20:24             ` Stephen Boyd
2010-09-28  3:33 ` [PATCH 2/3] [ARM] Allow machines to override __delay() Stephen Boyd
2010-10-05 17:29   ` Daniel Walker
2010-10-06  3:36     ` Stephen Boyd
2010-09-28  3:33 ` [PATCH 3/3] [ARM] Implement a timer based __delay() loop Stephen Boyd
2010-10-05 17:38   ` Daniel Walker
2010-10-06  3:36     ` Stephen Boyd [this message]
2010-10-06 13:44       ` Daniel Walker
  -- strict thread matches above, loose matches on Subject: below --
2010-09-07 18:23 [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too) Stephen Boyd
2010-09-07 18:23 ` [PATCH 3/3] [ARM] Implement a timer based __delay() loop Stephen Boyd
2010-08-19  2:24 [PATCH 0/3] Fixing udelay() on SMP (and non-SMP too) Stephen Boyd
2010-08-19  2:24 ` [PATCH 3/3] [ARM] Implement a timer based __delay() loop 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=4CABEECF.9080009@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --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).