[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: jiffies
Arun Sharma forced the electrons to say:
> > Will the system go haywire if the uptime goes beyond this limit?
>
> It may. Specifically if your machine has a driver, that has the
> following code:
>
> now = jiffies;
> future = now + HZ * 2;
>
> /* Wait for two seconds */
> while (jiffies < future) /* do nothing */;
>
> Such code will hang for 497 days, locking up your system.
The reason I asked this question was, I downloaded the pcmcia-cs package, and
noticed this sort of thing in one of the modules it builds (specifically,
pcmcia-cs-3.1.11/clients/xirc2ps_cs.c):
static void
busy_loop(u_long len)
{
if (in_interrupt()) {
u_long timeout = jiffies + len;
u_long flags;
save_flags(flags);
sti();
while (timeout >= jiffies)
;
restore_flags(flags);
} else {
__set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(len);
}
}
Maybe they figured laptops won't have uptimes of 400+ days. :-)
> One common technique is to set jiffies to 0xffffffff - 1 hour, when you
> boot your system. A faulty driver will lock up in an hour.
How do you do that? set it in the kernel code itself and recompile?
Binand
--
The prompt for all occasions:
export PS1="F:\$(pwd | tr '/[a-z]' '\134\134[A-Z]')> "
--------------- Binand Raj S. (binand@xxxxxxxxxxxxxxxxxxxxx)