Re: timer problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 6, 2011 at 11:48 PM, Daniel Baluta <daniel.baluta@xxxxxxxxx> wrote:
> Hello Prashant,
>
>> struct timer_list tim;
>>
>> void timfunc(unsigned long data)
>> {
> [..]
>>        schedule_timeout(10 * HZ);
> [..]
>> }
>>
>> static int __init init_testmod(void)
>> {
>>        init_timer(&tim);
>>        tim.expires = jiffies + HZ*5;
>>        tim.data = 1000;
>>        tim.function = timfunc;
>>        add_timer(&tim);
>>        return 0;
>> }
>
> You can find here ([1]) a good source for documenting
> on kernel timers API.
>
> Basically, the kernel has a list with registered timers and
> runs the associated handlers when timeout expires.
>
> Looking at your code, you've initialized the timer but you didn't
> added it to kernel timers list.
>
> You can find here a simple example of how to setup a timer ([2]).

Oh, so it seems you called add_timer :D, I just missed it. Then the problem
is the one pointed below (schedule_timeout called in interrupt context).

>
> Please read this [3], and figure out why even after you'll correctly
> setup the timer, your timer handler will cause you trouble.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux