[Top] [All Lists]

Re: possible overflow in __udelay

Subject: Re: possible overflow in __udelay
From: Atsushi Nemoto <>
Date: Wed, 07 Jul 2004 23:57:23 +0900 (JST)
In-reply-to: <>
Original-recipient: rfc822;
References: <>
>>>>> On Thu, 01 Jul 2004 21:14:56 +0900 (JST), Atsushi Nemoto 
>>>>> <> said:

anemo> Current __udelay implementation will cause internal overflow on
anemo> the first multiplication.

anemo> Basically, the multiplication is:

anemo> X = usecs * 2**64 / (100000 / HZ)

anemo> And maximum input usecs value is 5000 (MAX_UDELAY_MS * 1000).

anemo> If usecs == 5000 and HZ == 1000, X is 5 * 2**64.  Of course
anemo> this can not be held in 64bit variable.

anemo> How should we avoid the overflow?

anemo> ....

Don't you really have any comments?

I believe, for example, mdelay(10) does not work properly on most MIPS
ports (except for DECSTATION and JAZZ which have smaller HZ value).

Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>