From: Philippe Gerum <rpm@xenomai.org>
To: Ronny Meeus <ronny.meeus@gmail.com>
Cc: "martin.bielik.sk" <martin.bielik.sk@gmail.com>, xenomai@xenomai.org
Subject: Re: [Xenomai] [xenomai-forge] Task blocked in t_delete
Date: Fri, 01 May 2015 18:55:07 +0200 [thread overview]
Message-ID: <5543AFEB.2070808@xenomai.org> (raw)
In-Reply-To: <CAMJ=MEcC11C1Th6NjWMH6Ld3NthFvWpcSY+5tZAbk_akc6hS5g@mail.gmail.com>
On 04/30/2015 03:55 PM, Ronny Meeus wrote:
> On Thu, Apr 30, 2015 at 3:09 PM, Philippe Gerum <rpm@xenomai.org> wrote:
>> On 04/30/2015 02:39 PM, Ronny Meeus wrote:
>>> If I run the test I see:
>>>
>>> /tmp # ./task_delete
>>> Start of test
>>> Create and start main task:Create task M:
>>> Create task L:
>>> Start task M:
>>> Start task L:
>>> M: entry
>>> L: entry
>>> M: Dead loop starts
>>> Cleaning ..
>>> End of test
>>>
>>> Here is the piece of the code that goes wrong:
>>>
>>> printf("Cleaning ..\r\n");
>>> /* Remove tasks */
>>> t_delete(L_id);
>>> /* Followed code is not executed because t_delete is somehow blocked */
>>> printf("Removed L task id = 0x%lx\r\n", L_id);
>>> t_delete(M_id);
>>> printf("Removed M task id = 0x%lx\r\n", M_id);
>>> }
>>>
>>> Since the trace "Removed L task id..." is not generated, my assumption
>>> it that the t_delete(L_id) blocks.
>>>
>>>
>>
>> Could you attach GDB to the hung process, then dump a backtrace for all
>> the remaining threads?
>>
>> --
>> Philippe.
>
> Philippe
>
> I have put a breakpoint in main @ line 62:
>
> 57 printf("Create and start main task:");
> 58 t_create("MaIn",10, 16000, 16000,0,&tid);
> 59 ret = t_start(tid, 0, main_task, NULL);
> 60 if (0 != ret) {printf("Failed %lu\r\n",ret);return -1;}
> 61 sleep(10);
> 62 t_delete(tid);
> 63 printf("End of test\n\r");
> 64 return 0;
>
> and I generated a backtrace for all threads, see below.
> It looks like the "MaIn" task is wating on a semaphore.
[snip]
This is a priority inversion issue caused by the handshake mechanism
between the caller of t_delete() and the killed task finalizer. I
eventually reproduced it after I figured out that pinning all tasks on
the same CPU was required to trigger such bug. This patch should help:
http://git.xenomai.org/xenomai-3.git/commit/?h=next&id=8431d7149405235fb0aebb53ed32a537ad968c7e
--
Philippe.
next prev parent reply other threads:[~2015-05-01 16:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 8:14 [Xenomai] [xenomai-forge] Task blocked in t_delete Ronny Meeus
2015-04-30 10:01 ` Philippe Gerum
2015-04-30 12:39 ` Ronny Meeus
2015-04-30 13:09 ` Philippe Gerum
2015-04-30 13:55 ` Ronny Meeus
2015-05-01 16:55 ` Philippe Gerum [this message]
2015-05-02 18:48 ` Ronny Meeus
2015-05-05 6:04 ` Ronny Meeus
2015-05-06 9:41 ` 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=5543AFEB.2070808@xenomai.org \
--to=rpm@xenomai.org \
--cc=martin.bielik.sk@gmail.com \
--cc=ronny.meeus@gmail.com \
--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.