timer problem

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

 



Hi,

I am test out a simple schedule_timeout() code. When I insert the
module kernel goes in a infinite loop printing this in the log :

Jul  6 22:04:35 ubuntupc kernel: [ 5738.281659] Pid: 0, comm: swapper
Not tainted 2.6.35-22-generic #33-Ubuntu
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281663] Call Trace:
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281671]  [<ffffffff8104d15a>]
dequeue_task_idle+0x3a/0x50
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281679]  [<ffffffff81052d6a>]
dequeue_task+0x9a/0xb0
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281687]  [<ffffffff81052dae>]
deactivate_task+0x2e/0x40
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281693]  [<ffffffff81586ba9>]
schedule+0x4a9/0x830
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281702]  [<ffffffff81008ddb>]
cpu_idle+0xeb/0x110
Jul  6 22:04:35 ubuntupc kernel: [ 5738.281710]  [<ffffffff815832ad>]
start_secondary+0x100/0x102

Any ideas on what is going on ?

---------------------------------- <testmod.c>
----------------------------------

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/sched.h>

struct timer_list tim;

void timfunc(unsigned long data)
{
        printk("hi this is a timer %lu\n", data);
        set_current_state(TASK_INTERRUPTIBLE);
        schedule_timeout(10 * HZ);
        printk("hi again this is a timer after timeout %lu\n", data);
}

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;
}

static void __exit exit_testmod(void)
{
        printk("end of module\n");
        return;
}

module_init(init_testmod);
module_exit(exit_testmod);
MODULE_LICENSE("GPL");

------------------------------ </testmod.c> ----------------------------------

---------------------------------- <Makefile> ----------------------------------

obj-m += testmod.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

default:
	        $(MAKE) -C $(KERNELDIR) M=$(PWD)

clean:
	        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

depend .depend dep:
	        $(CC) $(CFLAGS) -M *.c > .depend

ifeq (.depend,$(wildcard .depend))
	include .depend
endif
---------------------------------- </Makefile>
----------------------------------

_______________________________________________
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