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

From: Yinghai Lu
Date: Thu Jan 13 2011 - 20:01:30 EST


On 01/13/2011 04:40 PM, Benjamin Herrenschmidt wrote:
> On Thu, 2011-01-13 at 16:31 -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()
>
> Or have a reasonable default for lpj ...

x86 udelay is using percpu cpu_data.loops_per_jiffy, and it is not set yet.

when x86 boot with earlyprintk=dbgp, that early console is loaded quite before setup_percpu_areas()

maybe something like this could workaround it, if cpu_data(0) can be used before setup_percpu_areas().

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d3cfe26..333694a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -734,6 +734,7 @@ void __init setup_arch(char **cmdline_p)

early_trap_init();
early_cpu_init();
+ cpu_data(0).loops_per_jiffy = loops_per_jiffy;
early_ioremap_init();

setup_olpc_ofw_pgd();
--
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/