Re: [RFC PATCH] x86: Add safe_udelay() and safe_msleep()

From: Yinghai Lu
Date: Thu Jan 13 2011 - 20:14:40 EST


On 01/13/2011 04:44 PM, Greg KH wrote:
> On Thu, Jan 13, 2011 at 04:31:04PM -0800, Yinghai Lu wrote:
>> there are some udelay() in drivers/usb/early/ehci-dbgp.c
>>
>> that is for early USB debug port console support.
>>
>> We should replace them with early version udelay()
>
> Again, I fail to see why. They work fine today, right?

did not test that for a while.

from code review, we should not use udelay() that early.

in arch/x86/lib/delay.c we have
inline void __const_udelay(unsigned long xloops)
{
int d0;

xloops *= 4;
asm("mull %%edx"
:"=d" (xloops), "=&a" (d0)
:"1" (xloops), "0"
(this_cpu_read(cpu_info.loops_per_jiffy) * (HZ/4)));

__delay(++xloops);
}
EXPORT_SYMBOL(__const_udelay);

that percpu cpu_info.loops_per_jiffy only have value after smp_prepare_cpus() is called.

>
> You _really_ need to prove what you are trying to do here, with lots of
> details and descriptions of what the problem is, as it's getting a bit
> annoying...

sorry for that.

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/