[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DEA255B.2050503@unican.es>
Date: Sat, 4 Jun 2011 14:30:19 +0200
From: Monica Puig-Pey <puigpeym@...can.es>
To: <linux-rt-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: kernel threads in drivers using the RT patch
Hello,
I'm studying how to develop drivers in a real time OS and how do they
work. I'm using Ubuntu 10.04 with the 2.6.31-11-rt patch installed.
I'm trying to run a kernel thread from my driver (kernel context). I
create the kthread in the module_init, I change its real time priority
and then make it run .
Code shown below:
thread_handler=*(struct task_struct *)kthread_create(my_tasklet_handler,
(void*)&datos,"thread_handler");
if (IS_ERR(&thread_handler)){
return PTR_ERR(&thread_handler);
printk(KERN_WARNING "<pci> (init_module) Error creating Thread
handler\n");
}
params->sched_priority=20;
result = sched_setscheduler(&thread_handler, SCHED_FIFO, params);
result=wake_up_process(&thread_handler);
Params is global struct sched_param * and struct thread_handler a
global task_struct.
I stop the Kthread in the module_exit using
res=kthread_stop(&thread_handler);
The kthread "thread_handler" has a while (1) loop and it is stopped in a
semaphore, waiting for the interrupt handler. When it wakes up each time
it calls kthread_should_stop() and depending on that break out of the
loop or run.
My problem is, when trying to establish the rtprio kthread, the whole
computer get blocked and I only can restart it. If I delete this part,
then kthread runs, and works well. With the ps command I can see it has
a 24 NON real time priority. Then the problem come when uninstalling my
module with rmmod. In the kthread_stop function, everything gets blocked.
Could someone tell what am I doing wrong? Or just give me some help
about kernel threads in the RT Patch?
Thanks a lot
Mónica
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists