New thread priority management

Pavel Pisa pisa at cmp.felk.cvut.cz
Wed Sep 21 13:02:13 UTC 2016


Hello Sebastian,

On Wednesday 21 of September 2016 09:08:25 Sebastian Huber wrote:
> Hello,
>
> I checked in a patch set today that reworks the thread priority
> management. This improves the priority inheritance protocol for example.

big congratulation and thanks. I have checked master today and my tests
are happy about the change. I have tested on i386 under QEMU in UP
configuration for now.

I have test for checking priority release timing included
in my RTEMS templates for long time

This one is based on classic API

  http://rtime.felk.cvut.cz/gitweb/rtems-devel.git/tree/HEAD:/rtems-tests/prioinh_check

The second is POSIX based and actual test file "prio_inherit_test.c" can be compiled
for Linux, VxWorks etc.

  http://rtime.felk.cvut.cz/gitweb/rtems-devel.git/tree/HEAD:/rtems-tests/prioinh_posix

I am attaching logs. The POSIX test on actual RTEMS implementation
"prioinh_posix-new.log" matches "prioinh_posix-linux-1-cpu.log" matches Linux one
when limited to one CPU

  taskset -c 0 ./prioinh_posix-linux

(The test has to be run by root or user with RT capabilities on Linux).

The difference between previous RTEMS implementation
  prioinh_posix-old.log
and actual
  prioinh_posix-new.log
in the form of diff

 RTEMS v 4.11.99
 Starting application prioinh_check

 RTEMS Shell on /dev/console. Use 'help' to list commands.
 [/] # *** Starting up Task_1 ***
 THI created
 TMID created
 LO created
 1 obtained SLO
 1 going to release RLO
 1 obtained SHI
 1 going to release RHI
 THI released (RHI)
 TLO released (RLO)
 TLO released (RLO)
 1 going to release RMID
 1 going to release SHI
-1 going to release SLO
 THI obtained SHI
 THI going to release SHI
 THI released SHI
 MID released (RMID)
 MID going to sleep
-1 released both SHI and SLO
-1 going to sleep
-TLO obtained SLO
-TLO going to release SLO
-TLO released SLO
-1 obtained SLO
-1 going to release RLO
-1 obtained SHI
-1 going to release RHI
-THI released (RHI)
-TLO released (RLO)
-1 going to release RMID
-1 going to release SHI
 1 going to release SLO
-THI obtained SHI
-THI going to release SHI
-THI released SHI
-MID released (RMID)
-MID going to sleep
 1 released both SHI and SLO
 1 going to sleep

Important is that when low priority thread releases
semaphore/mutex shared with high pririty thread
then it keeps the priority gained from high priority
thread when it blocks on that semaphore.

RLO and RHI are additional semaphores which
are controlled by test controllong task "1".
This way it is ensured that semaphores/mutexes SHI
and SLO are obtained by TLO and THI task is such
order that THI task has to wait for TLO task.

Interpreting data recorded on SMP system is much
more complex and I do not remember if the sequnce
stays or stays not deterministic in such case.
It is different for sure, because outputs can
go in parallel. But check can be used even on SMP
to check for late priority release.

Best wishes,

             Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_posix-linux-1-cpu.log
Type: text/x-log
Size: 6498 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_posix-new.log
Type: text/x-log
Size: 2552 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_posix-linux-2-cpu.log
Type: text/x-log
Size: 1607 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_check-new.log
Type: text/x-log
Size: 2478 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_check-old.log
Type: text/x-log
Size: 3179 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prioinh_posix-old.log
Type: text/x-log
Size: 2881 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160921/cbd6f64d/attachment-0011.bin>


More information about the devel mailing list