I am starting to program Linux and trying to use some examples of device drivers during practice. The code below (shortened version of tiny_tty.c ) loads fine with insmod, and I can see it in /proc/tty/drivers , /proc/modules , and the device nodes are created in / dev. When I try to write to the device file, for example, echo "abcd" > /dev/ttyms0 (I hope this is good) or reads like cat /dev/ttyms0 , the kernel panics with a call trace on the screen. I am using the 3.5.0 kernel under Ubuntu. Unfortunately, I cannot fix the trace, because when it is panicky, I have no choice but to reboot with the power button. I believe that the problem with the timer is here, since the trace shows the line above: "*kernel bug at /build/buildd/linux-3.5.0/kernel/timer.c:901* ", then the trace of the call, followed by "*EIP is at add_timer+0x18/0x20*" The following is the complete code. Any guidance is greatly appreciated pending.
May 10, 2013 . I tried to initialize the timer in an open function, and this time below the call trace is shown for "kernel panic - not synchronization: a fatal error occurred in interrupting the interrupt, switching to the text console":
update_sd_lb_stats+0xcd/0x4b0 find_busiest_group+0x2e/0x420 enqueue_entity+0xcb/0x510 load_balance+0x7e/0x5e0 rebalance_domains+0xed/0x150 __do_softirq+0xdb/0x180 local_bh_enable_ip+0x90/0x90 <IRQ> copy_to_user0x41/0x60 sys_gettimeofday+0x2a/0x70 sysenter_do_call0x12/0x20 #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/kdev_t.h> #include <linux/wait.h> #include <linux/errno.h> #include <linux/slab.h> /* kmalloc() */
source share