Hi,
I code a kernel module which do some nop. When inserted into the
kernel, the kernel will be stuck and can not reponse my keypress
anymore. So, I have to reboot to get out. Why?
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
struct task_struct *ktask = NULL;
static int thread_func(void *data)
{
int i;
while (!kthread_should_stop()){
for (i = 0; i < 1000; i++){
asm volatile ("nop\n\t");
}
}
return 0;
}
static int tst_init(void)
{
ktask = kthread_run(thread_func, NULL, "mythread");
return 0;
}
static void tst_exit(void)
{
if (ktask){
kthread_stop(ktask);
ktask = NULL;
}
}
module_init(tst_init);
module_exit(tst_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Parmenides");
MODULE_DESCRIPTION("Something.");
_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies