All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [BUG] rt_task_delete kills caller
Date: Fri, 21 Jul 2006 14:48:07 +0200	[thread overview]
Message-ID: <44C0CD07.4070708@domain.hid> (raw)
In-Reply-To: <44C0A083.6000101@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

Jan Kiszka wrote:
> Jan Kiszka wrote:
>> Hi,
>>
>> I stumbled over a strange behaviour of rt_task_delete for a created, set
>> periodic, but non-started task. The process gets killed on invocation,
> 
> More precisely:
> 
> (gdb) cont
> Program received signal SIG32, Real-time event 32.
> 
> Weird. No kernel oops BTW.
> 
>> but only if rt_task_set_periodic was called with a non-zero start time.
>> Here is the demo code:
>>
>> #include <stdio.h>
>> #include <sys/mman.h>
>> #include <native/task.h>
>>
>> main()
>> {
>> 	RT_TASK task;
>>
>> 	mlockall(MCL_CURRENT|MCL_FUTURE);
>>
>> 	printf("rt_task_create=%d\n",
>> 		rt_task_create(&task, "task", 8192*4, 10, 0));
>>
>> 	printf("rt_task_set_periodic=%d\n",
>> 		rt_task_set_periodic(&task, rt_timer_read()+1, 100000));
>>
>> 	printf("rt_task_delete=%d\n",
>> 		rt_task_delete(&task));
>> }
>>
>> Once you skip rt_task_set_periodic or call it like this
>> rt_task_set_periodic(&task, TM_NOW, 100000), everything is fine. Tested
>> over trunk, but I guess over versions should suffer as well.
>>
>> I noticed that the difference seems to be related to the
>> xnpod_suspend_thread in xnpod_set_thread_periodic. That suspend is not
>> called on idate == XN_INFINITE. What is it for then, specifically if you
>> would call xnpod_suspend_thread(thread, xnpod_get_time()+period, period)
>> which should have the same effect like xnpod_suspend_thread(thread, 0,
>> period)?

That difference is clear to me now: set_periodic with a start date !=
XN_INFINITE means "suspend the task immediately until the provided
release date" (RTFM...) while date == XN_INFINITE means "keep the task
running and schedule the first release on now+period".

The actual problem seems to be related to sending SIGKILL on
rt_task_delete to the dying thread. This happens only in the failing
case. When xnpod_suspend_thread was not called, the thread seems to
self-terminate first so that rt_task_delete becomes a nop (no more task
registered at that point). I think we had this issue before. Was it
solved? [/me querying the archive now...]

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-07-21 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-21  9:17 [Xenomai-core] [BUG] rt_task_delete kills caller Jan Kiszka
2006-07-21  9:38 ` Jan Kiszka
2006-07-21 12:48   ` Jan Kiszka [this message]
2006-07-21 15:31     ` Jan Kiszka
2006-07-21 16:08       ` Philippe Gerum
2006-07-30  9:23       ` Philippe Gerum
2006-07-30 16:48         ` Gilles Chanteperdrix
2006-07-30 16:57           ` Philippe Gerum

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=44C0CD07.4070708@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=xenomai@xenomai.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.