Re: timer causes kernel crash

From: Richard Zidlicky (Richard.Zidlicky@stud.informatik.uni-erlangen.de)
Date: Mon Mar 20 2000 - 18:19:11 EST


On Mon, Mar 20, 2000 at 06:07:02AM -0500, Badrinath Venkatachari wrote:
> Hi,
> I have a function fn1() in the kernel that does some processing. But as
> soon as I load a particular module, I want fn1() to start a timer
> (declared as struct timer_list) for a function fn2() that simply printk's
> messages and then continue with its normal processing.... (code enclosed
> below)
>
> Everytime I load the module, the kernel crashes after printing the
> message "Timer Added" and gives a stack trace. Can anyone explain why this
> is happening ??
>
> thanks in advance
>
> regards
> badri
>
> ------------ code starts here (somefile.c)----------------
>
>
> /* exported to the loadable module and called in the LKM's
> init_module() to set the flag so that the next time fn1() is called it
> starts a timer for fn2() */
>
> void setFlag()
> {
> flag_set = 1;
> }
>
> void fn2()
> {
> re-initializes the timer to call itself...
> printk("I am running !!!\n");
> }
>
> void fn1(args)
> {
> if (flag_set)
> {
> struct timer_list tl;
^^^^^^^^^^^^^^^

did you perhaps mean "static" ?

> init_timer(&tl);
> tl.function = fn2;
> tl.expires = RUN_AT(5*HZ);
> tl.data = 0L;
> add_timer(&tl);
> printk("Timer added\n");
> }
> normal_processing();
> }

Bye
Richard

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



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:31 EST