From: J. William Campbell <jwilliamcampbell@comcast.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/
Date: Mon, 23 May 2011 14:15:11 -0700 [thread overview]
Message-ID: <4DDACE5F.20909@comcast.net> (raw)
In-Reply-To: <4DDACB4C.6040001@gmail.com>
On 5/23/2011 2:02 PM, Graeme Russ wrote:
> On 24/05/11 06:49, J. William Campbell wrote:
>> On 5/23/2011 1:10 PM, Graeme Russ wrote:
>>> On 24/05/11 04:29, Scott McNutt wrote:
>>>> Hi Bill,
>>>>
>>>> J. William Campbell wrote:
>>>>> On 5/23/2011 6:12 AM, Scott McNutt wrote:
>>>>>> Dear Graeme,
>>>>>>
>>>>>> Graeme Russ wrote:
>>>>>>> On 23/05/11 22:19, Scott McNutt wrote:
>>>>>>>> Hi Graeme,
>>>>>>>>
>>>>>>>> Graeme Russ wrote:
>>>>>>>>> There is no need to use get_timer() and reset_timer() and there are
>>>>>>>>> build
>>>>>>>> I must have missed something WRT reset_timer() -- my apologies
>>>>>>>> if I'm covering old ground.
>>>>>>>>
>>>>>>>> When the timestamp is incremented using an interrupt that occurs with
>>>>>>>> a period greater than 1 ms, we can get early timeouts. reset_timer()
>>>>>>>> solved the problem. What's the recommended approach for dealing with
>>>>>>>> this without reset_timer() ?
>>>>> Hi Scott,
>>>>> Are you saying that the interrupt frequency is greater than
>>>>> 1000 times per second, or as I read it, the frequency is less than 1000
>>>>> per second (period greater than 1 ms). If anything, that should make the
>>>>> timer run slow, not fast.
>>>>> I wonder if it is a resolution issue. What are the typical delays in ms
>>>>> you are using?
>>>> Some older nios2 implementations have _fixed_ 10 msec timers.
>>>> Basically, the timestamp is incremented asynchronous to get_timer(0).
>>>> So a 10 msec timeout can occur, for example, almost immediately if
>>>> the timer isn't reset just prior to calling get_timer(0). There are
>>>> more details in the comments for the following commits:
>>>>
>>>> nios2: Reload timer count in reset_timer():
>>>> d8bc0a2889700ba063598de6d4e7d135360b537e
>>>>
>>>> cfi_flash: reset timer in flash status check:
>>>> 22d6c8faac4e9fa43232b0cf4da427ec14d72ad3
>>>>
>>>> I'm totally in favor of cleaning this stuff up. It caused some
>>>> headaches (and wasted time) about 13 months ago. My primary concern
>>>> is to avoid breaking things that currently work for us nios2
>>>> weenies ... at least for any length of time.
>>>>
>>>> Things are a bit tight for me until next week or so. I'll probably
>>>> come up for air around June 1st ... and I'll be glad to help out.
>>>>
>>> Is there any reason why we cannot silently perform a reset_timer() any time
>>> set_timer() is called with a parameter of 0?
>> Hi All,
>> I assume you mean get_timer(0)? In principle, you cannot do this
> Yes - it's early, no coffee yet ;)
>> because it could be inside another get_timer(0) loop that has already some
>> time elapsed before you hit the inner get_timer(0). I think what needs to
> Correct, but that is what is already happening for ALL arches in cfi due to
> the reset_timer() before get_timer(0) - I am suggesting sandboxing the
> problem to NIOS until we sort out the timer API properly
>
>> happen on the old NIOS with 10 ms resolution on the interrupt times is that
>> all timer intervals must have 10 ms added and then rounded up to the
>> nearest multiple of 10. Thus, if you wanted to wait for 1 millisecond, you
>> must use an argument of 20 ms to be sure you wait at all! If you use an
>> argument of 10, it won't help because you could get an interrupt right away
>> and exit. If these routines are nios2 specific, you could add a local
>> reset_timer, but I assume they are generic. . Note that if these routines
>> are not nios2 specific, is there any harm in waiting "too long"?
> Well, we have no control over the argument in cfi driver (unless you plan
> to put #ifdef NIOS all over the place)
>
> Maybe we could round up the parameter inside get_timer() itself?
Hi All,
That would probably be the best way to go for now. It might slow
things down a bit though, if these delays are all desired to be "short",
like 1 ms. We would expand the 1 ms delay to 15 ms (average) while the
current (illegal) solution would expand a 1 ms delay to 10 ms always. It
is worth trying I think. It is also true that any other delays in the
program will suffer from the 10 ms resolution problem, so your idea is I
think a good one.
Best Regards,
Bill Campbell
> Regards,
>
> Graeme
>
>
>
next prev parent reply other threads:[~2011-05-23 21:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 11:54 [U-Boot] [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/ Graeme Russ
2011-05-23 12:19 ` Scott McNutt
2011-05-23 12:32 ` Graeme Russ
2011-05-23 13:12 ` Scott McNutt
[not found] ` <4DDA9CDA.1080401@comcast.net>
[not found] ` <4DDAA77F.7020708@psyent.com>
2011-05-23 20:10 ` Graeme Russ
2011-05-23 20:49 ` J. William Campbell
2011-05-23 21:02 ` Graeme Russ
2011-05-23 21:15 ` J. William Campbell [this message]
2011-05-24 5:13 ` Graeme Russ
2011-05-24 15:41 ` J. William Campbell
2011-05-23 21:53 ` Wolfgang Denk
2011-05-23 22:44 ` Graeme Russ
2011-05-24 3:20 ` Mike Frysinger
2011-05-23 12:31 ` Jens Scharsig
2011-05-23 13:22 ` Wolfgang Denk
2011-05-23 14:05 ` [U-Boot] Formal acks and patchwork (was: [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/) Albert ARIBAUD
2011-05-23 18:44 ` Wolfgang Denk
2011-05-23 19:19 ` [U-Boot] Formal acks and patchwork Albert ARIBAUD
2011-05-23 19:42 ` Wolfgang Denk
2011-05-23 20:15 ` Albert ARIBAUD
2011-05-23 13:34 ` [U-Boot] [PATCH] [Timer]Remove calls to [get, reset]_timer outside arch/ Jens Scharsig
[not found] ` <BANLkTik3W7WJbRuiKsC8m0f8iof7JL-ZMg@mail.gmail.com>
2011-05-23 20:09 ` Graeme Russ
2011-05-24 10:54 ` Graeme Russ
2011-05-24 11:13 ` Graeme Russ
2011-05-25 12:17 ` Graeme Russ
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=4DDACE5F.20909@comcast.net \
--to=jwilliamcampbell@comcast.net \
--cc=u-boot@lists.denx.de \
/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.