Suspending Tasks before they are finished

2022-03-14 Thread Jerzy J
Hi,

I've been developing some tests and observed some task behaviour that i
can't understand and couldn't find any documentation about it.

I have tests where I create 2 extra tasks (Workers) and then those tasks
are blocked and unlocked using semaphores and barriers. However, whenever
main task (Runner) is about to get blocked, the test crashes (just finishes
instantly). In some configurations is seems to "deadlock" on a semaphore
instead, while it should be able to move forward.

I realised that if I suspend the Worker tasks before they are about to
finish, with for e.g:
`rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events
);`
line at the very end of worker execution, it all works as expected.

Do you maybe know what is the reason for such behaviour? I'm also not sure
in which state is the task after it finishes it's execution but before it
is deleted, is it 'blocked' or is it 'dormant'?

Thanks and all the best,
Jerzy
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users


Re: Split BSP in RTEMS 4.11 - autotools newbie question

2022-03-14 Thread Joel Sherrill
On Mon, Mar 14, 2022 at 7:37 AM Dariusz.sabala  wrote:

> Hello
>
> I am developing SAMRH71 BSP in RTEMS 4.11, I started editing atsam BSP and
> accomplished some success, but the decision was made to support both BSP
> (atsam and samrh71) in separate folders. I reverted my changes, copied and
> renamed atsam folder to samrh71 and tried to build this renamed BSP, but
> unfortunately nothing is being built - make just enters the folder and
> leaves it with no artifact build
>
> make[1]: Entering directory
> '/home/dsa/projects/p1/repo/rtems/samrh71/arm-rtems4.11/c'
> Making all in .
> make[2]: Entering directory
> '/home/dsa/projects/p1/repo/rtems/samrh71/arm-rtems4.11/c'
> make[2]: Nothing to be done for 'all-am'.
>
> Can you give me advice on what and where to change in the buildsystem to
> make it build? Honestly I am cmake kid :) and knowing that autotools is no
> longer supported in the newest RTEMS does not encourage learning this
> powerful but complex tool.
>

Assuming there aren't any mistakes lurking. :)

>From the top directory:

bootstrap -c
bootstrap -p
bootstrap

When you add, move, and delete directories, it is possible that the
generated fragments which include lists of BSPs could get out of sync.

Overall, I'd recommend you move to 6.

--joel


>
> Best regards
> dsa
> ___
> users mailing list
> users@rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users


Re: Suspending Tasks before they are finished

2022-03-14 Thread Joel Sherrill
On Mon, Mar 14, 2022 at 6:44 AM Jerzy J  wrote:

> Hi,
>
> I've been developing some tests and observed some task behaviour that i
> can't understand and couldn't find any documentation about it.
>
> I have tests where I create 2 extra tasks (Workers) and then those tasks
> are blocked and unlocked using semaphores and barriers. However, whenever
> main task (Runner) is about to get blocked, the test crashes (just finishes
> instantly). In some configurations is seems to "deadlock" on a semaphore
> instead, while it should be able to move forward.
>
> I realised that if I suspend the Worker tasks before they are about to
> finish, with for e.g:
> `rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events
> );`
> line at the very end of worker execution, it all works as expected.
>

If these are Classic API tasks (e.g. rtems_task_create) and they are
falling off
the bottom of the function that is the task body, that's a fatal error. If
it is a POSIX
thread, it silently goes away.

>
> Do you maybe know what is the reason for such behaviour? I'm also not sure
> in which state is the task after it finishes it's execution but before it
> is deleted, is it 'blocked' or is it 'dormant'?
>

Depends on the API and attributes on a pthread.

--joel

>
> Thanks and all the best,
> Jerzy
> ___
> users mailing list
> users@rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users


Re: Suspending Tasks before they are finished

2022-03-14 Thread Jerzy J
Hi Joel,

Thanks for the explanation! It was in the context of Classic API.

All the best,
Jerzy

pon., 14 mar 2022 o 13:12 Joel Sherrill  napisał(a):

>
>
> On Mon, Mar 14, 2022 at 6:44 AM Jerzy J  wrote:
>
>> Hi,
>>
>> I've been developing some tests and observed some task behaviour that i
>> can't understand and couldn't find any documentation about it.
>>
>> I have tests where I create 2 extra tasks (Workers) and then those tasks
>> are blocked and unlocked using semaphores and barriers. However, whenever
>> main task (Runner) is about to get blocked, the test crashes (just
>> finishes
>> instantly). In some configurations is seems to "deadlock" on a semaphore
>> instead, while it should be able to move forward.
>>
>> I realised that if I suspend the Worker tasks before they are about to
>> finish, with for e.g:
>> `rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_DEFAULT_OPTIONS, 0, &events
>> );`
>> line at the very end of worker execution, it all works as expected.
>>
>
> If these are Classic API tasks (e.g. rtems_task_create) and they are
> falling off
> the bottom of the function that is the task body, that's a fatal error. If
> it is a POSIX
> thread, it silently goes away.
>
>>
>> Do you maybe know what is the reason for such behaviour? I'm also not sure
>> in which state is the task after it finishes it's execution but before it
>> is deleted, is it 'blocked' or is it 'dormant'?
>>
>
> Depends on the API and attributes on a pthread.
>
> --joel
>
>>
>> Thanks and all the best,
>> Jerzy
>> ___
>> users mailing list
>> users@rtems.org
>> http://lists.rtems.org/mailman/listinfo/users
>>
>
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Re: Split BSP in RTEMS 4.11 - autotools newbie question

2022-03-14 Thread Sebastian Huber

On 14/03/2022 15:12, dsa93 wrote:

I tried to change it to "rtems-c-src-lib-libbsp-arm-samrh71" (same as bsp root 
folder), but doing this kind of autotools voodo didnt helped. The result is still the 
same: Make does not see any target inside BSP folder. I guess I will continue work on two 
GIT branches and maybe colleagues will fix it some day :)


I would also recommend you try it with RTEMS 6 which uses a new build 
system.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@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/
___
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users