Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Gilles Chanteperdrix
On Fri, May 9, 2008 at 12:06 PM, Philippe Gerum <[EMAIL PROTECTED]> wrote:
> Gilles Chanteperdrix wrote:
>> On Fri, May 9, 2008 at 11:44 AM, Philippe Gerum <[EMAIL PROTECTED]> wrote:
>>> Jan Kiszka wrote:
 I expressed my skepticism about this global timer freeze before :->, and
>>> Just try debugging periodic code without it...
>>>
>>> We should have an opt-out mechanism to hide timers from the auto-freeze 
>>> feature,
>>>  that is the real issue yet to be fixed.
>>
>> Here is a patch I use at work.
>>
>
> Please merge this one (v2.4 and trunk). At some point (i.e. asap), we will 
> need
> an interface to set the NOLOCK bit on the thread's ptimer. The *_set_mode()
> calls are good candidates to support that feature.

It was already in the trunk but not yet in v2.4.

-- 
 Gilles

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Philippe Gerum
Gilles Chanteperdrix wrote:
> On Fri, May 9, 2008 at 11:44 AM, Philippe Gerum <[EMAIL PROTECTED]> wrote:
>> Jan Kiszka wrote:
>>> I expressed my skepticism about this global timer freeze before :->, and
>> Just try debugging periodic code without it...
>>
>> We should have an opt-out mechanism to hide timers from the auto-freeze 
>> feature,
>>  that is the real issue yet to be fixed.
> 
> Here is a patch I use at work.
> 

Please merge this one (v2.4 and trunk). At some point (i.e. asap), we will need
an interface to set the NOLOCK bit on the thread's ptimer. The *_set_mode()
calls are good candidates to support that feature.

-- 
Philippe.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Gilles Chanteperdrix
On Fri, May 9, 2008 at 11:44 AM, Philippe Gerum <[EMAIL PROTECTED]> wrote:
> Jan Kiszka wrote:
>> I expressed my skepticism about this global timer freeze before :->, and
>
> Just try debugging periodic code without it...
>
> We should have an opt-out mechanism to hide timers from the auto-freeze 
> feature,
>  that is the real issue yet to be fixed.

Here is a patch I use at work.

-- 
 Gilles


xeno-timer-nolock.diff
Description: Binary data
___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Philippe Gerum
Gilles Chanteperdrix wrote:
> On Fri, May 9, 2008 at 11:29 AM, Jan Kiszka <[EMAIL PROTECTED]> wrote:
>> +   if (xnthread_test_info(thread, XNDEBUG))
>> +   unlock_timers();
>> +
> 
> Will this work if several threads are currently being debugged ?
> 

Yes, because we freeze timers when a thread receives a ptracing signal, so any
remaining thread entering a breakpoint/stepping next will trigger a freeze anew.

-- 
Philippe.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Philippe Gerum
Jan Kiszka wrote:
> I expressed my skepticism about this global timer freeze before :->, and

Just try debugging periodic code without it...

We should have an opt-out mechanism to hide timers from the auto-freeze feature,
 that is the real issue yet to be fixed.

> now it hit me unpleasantly (Customer: "Is it normal that Xenomai stops
> working after the gdb session?" Jan [scratching head]: "Hmm, no...").
> 
> After more scratching I think I found the reason: The target decided to
> die after some fault, but Xenomai missed to unfreeze the timers. Patch
> below fixes that.
> 
> Without hearing complains, this also goes into trunk/2.4.x later today.
> 
> Jan
> 
> ---
>  ksrc/nucleus/shadow.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> Index: b/ksrc/nucleus/shadow.c
> ===
> --- a/ksrc/nucleus/shadow.c
> +++ b/ksrc/nucleus/shadow.c
> @@ -2148,6 +2148,9 @@ static inline void do_taskexit_event(str
>   if (!thread)
>   return;
>  
> + if (xnthread_test_info(thread, XNDEBUG))
> + unlock_timers();
> +
>   if (xnpod_shadow_p())
>   xnshadow_relax(0);
>  
> 

This should be ok.


-- 
Philippe.

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Jan Kiszka
Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> On Fri, May 9, 2008 at 11:29 AM, Jan Kiszka <[EMAIL PROTECTED]> wrote:
>>> +   if (xnthread_test_info(thread, XNDEBUG))
>>> +   unlock_timers();
>>> +
>> Will this work if several threads are currently being debugged ?
> 
> Not better or worse than with the current code. The whole approach is
> not fixed by this patch, just some collateral damage is reduced.
> 
> Well, maybe some counter should be used to track the number of XNDEBUG
> bits in the system and unfreeze the timers when that becomes zero. Will
> look into this.

Correction: that counter already exists in nkpod->timerlck. So it should
work even if other threads still have XNDEBUG set.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Jan Kiszka
Gilles Chanteperdrix wrote:
> On Fri, May 9, 2008 at 11:29 AM, Jan Kiszka <[EMAIL PROTECTED]> wrote:
>> +   if (xnthread_test_info(thread, XNDEBUG))
>> +   unlock_timers();
>> +
> 
> Will this work if several threads are currently being debugged ?

Not better or worse than with the current code. The whole approach is
not fixed by this patch, just some collateral damage is reduced.

Well, maybe some counter should be used to track the number of XNDEBUG
bits in the system and unfreeze the timers when that becomes zero. Will
look into this.

Jan

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] [PATCH] Unfreeze timers when debugged target exits

2008-05-09 Thread Gilles Chanteperdrix
On Fri, May 9, 2008 at 11:29 AM, Jan Kiszka <[EMAIL PROTECTED]> wrote:
> +   if (xnthread_test_info(thread, XNDEBUG))
> +   unlock_timers();
> +

Will this work if several threads are currently being debugged ?

-- 
 Gilles

___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core