All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Paolo Minazzi <Paolo.Minazzi@mitrol.it>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Re : Sporadic problem : rt_task_sleep locked after debugging
Date: Wed, 08 May 2013 16:43:22 +0200	[thread overview]
Message-ID: <518A648A.7010705@xenomai.org> (raw)
In-Reply-To: <518A6195.7030206@mitrol.it>

On 05/08/2013 04:30 PM, Paolo Minazzi wrote:

> I have a xenomai application with 70 real-time threads.
> Suppose that thread 1 deletes thread 70 with rt_task_delete().
> This is my case.
> 
> I put a breakpoint and run my xenomai application.
> When my breakpoint is reached gdb stops all my xenomai threads.
> 
> If I press "c" to continue, gdb restarts my application,
> that is every thread, one by one (thread 1, thread 2, thread 3,
> .... , thread 70).
> 
> If I press "c" on gdb, the following scenario could happens :
> 
> 1) gdb start thread 1
> 2) thread 1 starts immediately
> 3)   thread 1 delete thread 70 by rt_task_delete()
> ...
> 4) gdb start thread 2
> 5) gdb start thread 3
> 6) gdb start thread 4
> 7) gdb start thread 5
> 8) gdb start thread 6
> ...
> .) gdb start thread 68
> .) gdb start thread 69
> .) gdb start thread 70
> 
> The thread 1 finds thread 70 in debug mode !
> 
> My patch adjust this problem.
> 
> I realize that it is a very special case, but it is my case.
> 
> I'd like to know if the patch is valid or can be written in a different way.
> For example, I could insert my patch directly in xnpod_delete_thread().
> 
> The function unlock_timers() cannot be called from 
> xenomai-2.5.6/ksrc/skins/native/task.c
> because it is defined static. This is a detail. There are simple ways to 
> solve this.


Hi Paolo,

this explanation makes the condition under which you observe the bug
more clear, but this case is supposed to be already handled by Xenomai code.

If you look at do_taskexit_event() in ksrc/nucleus/shadow.c you will see
at the very beginning a test which does exactly the same thing as your
patch.

Normally, any deletion of a xenomai thread should cause this function to
be called. So, some more debugging is necessary to understand what
happens when rt_task_delete is called in your case. Please try to
trigger an I-pipe tracer freeze in xnpod_delete_thread, and have a large
number of points in /proc/ipipe/trace/post_trace_points.

Regard.

-- 
                                                                Gilles.


  reply	other threads:[~2013-05-08 14:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 13:49 [Xenomai] Re : Sporadic problem : rt_task_sleep locked after debugging Paolo Minazzi
2013-05-03  1:06 ` Gilles Chanteperdrix
2013-05-03 14:46   ` Paolo Minazzi
2013-05-08  8:03     ` Paolo Minazzi
2013-05-08 12:58       ` Gilles Chanteperdrix
     [not found]         ` <518A505C.2090207@mitrol.it>
     [not found]           ` <518A52A7.5000801@xenomai.org>
     [not found]             ` <518A5600.20508@mitrol.it>
2013-05-08 14:30               ` Paolo Minazzi
2013-05-08 14:43                 ` Gilles Chanteperdrix [this message]
2013-05-08 16:06                 ` Philippe Gerum
2013-05-08 16:10                   ` Philippe Gerum
2013-05-09 13:36                     ` Philippe Gerum
2013-05-09 13:52                       ` Paolo Minazzi
2013-05-09 13:58                         ` Gilles Chanteperdrix
2013-05-09 14:04                           ` Philippe Gerum
2013-05-09 14:08                             ` Philippe Gerum
2013-05-10  6:47                               ` Paolo Minazzi
2013-06-17  7:20                                 ` 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=518A648A.7010705@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=Paolo.Minazzi@mitrol.it \
    --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.