From: Monica Puig-Pey <puigpeym@unican.es>
To: <linux-rt-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: kernel threads in drivers using the RT patch
Date: Sat, 4 Jun 2011 14:30:19 +0200 [thread overview]
Message-ID: <4DEA255B.2050503@unican.es> (raw)
In-Reply-To: <4DEA1F22.6000603@unican.es>
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-rt-users" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Monica Puig-Pey <puigpeym@unican.es>
To: <linux-rt-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: kernel threads in drivers using the RT patch
Date: Sat, 4 Jun 2011 14:30:19 +0200 [thread overview]
Message-ID: <4DEA255B.2050503@unican.es> (raw)
In-Reply-To: <4DEA1F22.6000603@unican.es>
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
next prev parent reply other threads:[~2011-06-04 12:29 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-04 11:48 One Interrupted Threads per Interrupt line? Monica Puig-Pey
2011-06-04 11:48 ` Monica Puig-Pey
2011-06-04 12:03 ` I/O operations priority in RTOS Monica Puig-Pey
2011-06-04 12:03 ` Monica Puig-Pey
2011-06-04 12:30 ` Monica Puig-Pey [this message]
2011-06-04 12:30 ` kernel threads in drivers using the RT patch Monica Puig-Pey
2011-06-06 11:47 ` Changing Kernel thread priorities Monica Puig-Pey
2011-06-06 11:54 ` Rolando Martins
2011-06-06 11:54 ` Rolando Martins
2011-06-06 11:58 ` Monica Puig-Pey
2011-06-06 11:58 ` Monica Puig-Pey
2011-06-06 16:49 ` Mark Hounschell
2011-06-06 16:49 ` Mark Hounschell
2011-06-07 8:40 ` Monica Puig-Pey
2011-06-07 8:40 ` Monica Puig-Pey
2011-06-07 9:14 ` Mark Hounschell
2011-06-07 9:14 ` Mark Hounschell
2011-06-07 9:46 ` Mark Hounschell
2011-06-07 9:46 ` Mark Hounschell
2011-06-07 18:34 ` Monica Puig-Pey
2011-06-07 18:55 ` Mark Hounschell
2011-06-07 18:55 ` Mark Hounschell
2011-06-10 10:12 ` Monica Puig-Pey
2011-06-10 10:12 ` Monica Puig-Pey
2011-06-06 18:20 ` Armin Steinhoff
2011-06-06 18:20 ` Armin Steinhoff
2011-06-04 23:42 ` I/O operations priority in RTOS Nicholas Mc Guire
2011-06-05 8:46 ` Armin Steinhoff
2011-06-05 9:25 ` Jan Kiszka
2011-06-05 22:39 ` Armin Steinhoff
2011-06-05 23:09 ` Jan Kiszka
2011-06-05 9:28 ` Nicholas Mc Guire
2011-06-05 9:44 ` Jan Kiszka
2011-06-05 22:29 ` Nicholas Mc Guire
2011-06-05 23:00 ` Jan Kiszka
2011-06-06 0:21 ` Nicholas Mc Guire
2011-06-06 20:35 ` Jan Kiszka
2011-06-06 7:41 ` Armin Steinhoff
2011-06-06 20:48 ` Jan Kiszka
2011-06-05 22:32 ` Armin Steinhoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DEA255B.2050503@unican.es \
--to=puigpeym@unican.es \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.