All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Re : Sporadic problem : rt_task_sleep locked after debugging
@ 2013-05-02 13:49 Paolo Minazzi
  2013-05-03  1:06 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 16+ messages in thread
From: Paolo Minazzi @ 2013-05-02 13:49 UTC (permalink / raw)
  To: xenomai

I'm Paolo Minazzi and some time ago I write you for a problem
related to xenomai and gdb.
After a long time I think to be near to a solution.
I'd like your help and opinions because maybe also other people
have the same problem.

In short, if I debug a xenomai user-space application,
sometimes after a rt_task_sleep the application seems locked.
After this condition, I have to restart my arm processor
because xenomai seems locked. Normal linux application instead
continue to work correctly.

A solution that works for me is to comment some lines in
xenomai-2.5.6/ksrc/nucleus/shadow.c:2620
Please see my comments that begin with "// COMMENT"

==================================================================================
if (xnthread_test_state(next, XNDEBUG)) {
         if (signal_pending(next_task)) {
                 sigset_t pending;
                 /*
                  * Do not grab the sighand lock here:
                  * it's useless, and we already own
                  * the runqueue lock, so this would
                  * expose us to deadlock situations on
                  * SMP.
                  */
                 wrap_get_sigpending(&pending, next_task);

                 // COMMENT if (sigismember(&pending, SIGSTOP) ||
                 // COMMENT     sigismember(&pending, SIGINT))
                 // COMMENT         goto no_ptrace;
         }
         xnthread_clear_state(next, XNDEBUG);
         unlock_timers();
}
no_ptrace:
==================================================================================

The source of my problem seems to be the locked timers.
If I unlock the timers (manually using a dirty hack) when I'm in the bug 
condition
I can repeair the problem and continue to use xenomai without any problems.

In xenomai-2.5.6/ksrc/nucleus/shadow.c:2615

                 /*
                  * Check whether we need to unlock the timers, each
                  * time a Linux task resumes from a stopped state,
                  * excluding tasks resuming shortly for entering a
                  * stopped state asap due to ptracing. To identify the
                  * latter, we need to check for SIGSTOP and SIGINT in
                  * order to encompass both the NPTL and LinuxThreads
                  * behaviours.
                  */

that explains why SIGINT and SIGSTOP are checked. I do not understand well
all this but it seems related to signal used by gdb.
Have you got an idea to solve in the right way the problem ?

Thanks for your time

Paolo Minazzi



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-06-17  7:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.