Possible Bug in

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Dec 17 06:09:40 UTC 2020


On 16/12/2020 21:01, Joel Sherrill wrote:
> Hi
>
> The context switch recorder code -- _Record_Thread_switch in 
> record-userext.c has this code:
>
>   items[ 0 ].event = RTEMS_RECORD_THREAD_SWITCH_OUT;
>   items[ 0 ].data = executing->Object.id;
>   items[ 1 ].event = RTEMS_RECORD_THREAD_STACK_CURRENT;
>   items[ 1 ].data =
> #if defined(__GNUC__)
>     (uintptr_t) __builtin_frame_address( 0 )
>       - (uintptr_t) executing->Start.Initial_stack.area;
>
> There isn't a comment about what items[1].data is supposed to be but I 
> am assuming it is intended to be stack used. Unfortunately, it doesn't 
> conditionalize on stack growing up or down. On the ARM, the stack 
> grows down This means on the ARM, it is stack memory remaining.
>
> I think this needs a comment as to the intent and then some 
> conditional logic on CPU_STACK_GROWS_UP like the stack checker has.
>
> Anyone know what the meaning of the value should be? I suppose 
> remaining is good for quick monitoring if the size is captured on say 
> create.

Yes, this code is broken. Another issue is that the current stack 
pointer belongs to different tasks in SMP and non-SMP configurations. I 
am not sure if there is a LTTNG event for the thread stack.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list