From: Thomas Gleixner <tglx@linutronix.de>
To: Stefan Agner <stefan@agner.ch>
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: I attached a test module to reproduce this bug. Does I miss something in my code or is there a bug?
Date: Mon, 12 Apr 2010 22:32:11 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1004122207300.18009@localhost.localdomain> (raw)
In-Reply-To: <20100412182325.161358ntday18s1o@limpopo.deheime.ch>
Stefan,
please use short and descriptive subject lines. "I attached a test
module to reproduce this bug ..." does not tell anything.
On Mon, 12 Apr 2010, Stefan Agner wrote:
> Unable to handle kernel paging request at kthread_should_stop
That would have been the real subject line :)
> I attached a test module to reproduce this bug. Does I miss something in my
> code or is there a bug?
There are several bugs in your code :)
> static int runloop(void *unused)
> {
>
> int ret;
>
> /* Daemonize */
> daemonize(MODULE_NAME);
Do not call daemonize() for a kthread created with kthread_create().
That was necessary for kthreads created with kernel_thread.
> /* Allow SIGTERM signal */
> allow_signal(SIGTERM);
Why do you want signals here ?
> /* Calculate first shot */
> now = ktime_get();
> thread_next = ktime_add_us(now, 500);
>
> do {
> set_current_state(TASK_UNINTERRUPTIBLE);
> ret = schedule_hrtimeout(&thread_next, HRTIMER_MODE_ABS);
> if(ret == -EINTR)
> {
That EINTR can never happen. You set the task to
TASK_UNINTERRUPTIBLE state, so it cannot be woken up by a signal.
> int __init init_test_module(void)
> {
> struct sched_param param = { .sched_priority = THREAD_PRIORITY };
>
> /* Kernel Thread erzeugen */
> if(thread == NULL)
> thread = kthread_create((void *)&runloop, NULL, "testthread");
The init code is called once, so no need to check for thread == NULL
before calling kthread_create().
But you miss to check thread _after_ the call ....
> // Realtime scheduler
> sched_setscheduler(thread, THREAD_SCHEDULER, ¶m);
Scheduler settings should happen in the thread.
> wake_up_process(thread);
Simply use kthread_run(....), which implies kthread_create() and
wake_up_process().
Thanks,
tglx
next prev parent reply other threads:[~2010-04-12 20:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-12 16:23 Stefan Agner
2010-04-12 20:32 ` Thomas Gleixner [this message]
2010-04-13 6:56 ` Stefan Agner
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=alpine.LFD.2.00.1004122207300.18009@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=stefan@agner.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®