From 166b4da5516089535d319f00ef0c6989aefa574f Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 8 Mar 2009 23:33:41 +0000 Subject: [PATCH] Add support for priority inheritance git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1581 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 2 + Documentation/NuttX.html | 4 +- Documentation/NuttxPortingGuide.html | 9 +- Documentation/NuttxUserGuide.html | 10 +- TODO | 6 +- arch/arm/src/common/up_reprioritizertr.c | 24 +- arch/pjrc-8051/src/up_reprioritizertr.c | 54 +++-- arch/sh/src/common/up_reprioritizertr.c | 24 +- arch/sim/src/up_reprioritizertr.c | 24 +- arch/z16/src/common/up_reprioritizertr.c | 24 +- arch/z80/src/common/up_reprioritizertr.c | 24 +- configs/README.txt | 4 +- configs/sim/ostest/defconfig | 3 +- examples/ostest/Makefile | 32 ++- examples/ostest/main.c | 12 +- examples/ostest/ostest.h | 6 +- examples/ostest/prioinherit.c | 292 +++++++++++++++++++++++ include/nuttx/sched.h | 5 +- include/pthread.h | 6 +- include/semaphore.h | 5 +- sched/os_internal.h | 2 +- sched/pthread_create.c | 6 +- sched/pthread_setschedprio.c | 4 +- sched/sched_setparam.c | 58 +++-- sched/sem_destroy.c | 8 +- sched/sem_post.c | 20 +- sched/sem_wait.c | 40 +++- sched/task_restart.c | 49 ++-- sched/task_setup.c | 7 +- 29 files changed, 634 insertions(+), 130 deletions(-) create mode 100644 examples/ostest/prioinherit.c diff --git a/ChangeLog b/ChangeLog index d183e4f30b8..532f448d6fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -650,5 +650,7 @@ * Restructured parts of the uIP port for correct compilation with ZDS-II * eZ80Acclaim!: Complete basic integration of the eZ80F91 EMAC driver. The driver is basically functional and should mature prior to the 0.4.3 release. + * Implemented priority inheritance logic for POSIX semaphores. Because the pthread + mutexes are built on semaphores, they will have this property as well. diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index fef9520a391..f5000359979 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -285,7 +285,7 @@

-

  • Realtime, deterministic.
  • +
  • Realtime, deterministic, with support for priority inheritance
  • @@ -1371,6 +1371,8 @@ nuttx-0.4.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * Restructured parts of the uIP port for correct compilation with ZDS-II * eZ80Acclaim!: Complete basic integration of the eZ80F91 EMAC driver. The driver is basically functional and should mature prior to the 0.4.3 release. + * Implemented priority inheritance logic for POSIX semaphores. Because the pthread + mutexes are built on semaphores, they will have this property as well. pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html index b47cd99dedb..4c3f3ff79d2 100644 --- a/Documentation/NuttxPortingGuide.html +++ b/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

    NuttX RTOS Porting Guide

    -

    Last Updated: December 5, 2008

    +

    Last Updated: March 8, 2009

    @@ -1623,8 +1623,13 @@ The system can be re-made subsequently by just typing make. provides /dev/console. Enables stdout, stderr, stdin.
  • - CONFIG_MUTEX_TYPES: Set to enabled support for recursive and + CONFIG_MUTEX_TYPES: Set to enable support for recursive and errorcheck mutexes. Enables pthread_mutexattr_settype(). +
  • +
  • + CONFIG_PRIORITY_INHERITANCE : Set to enable support for + priority inheritance on mutexes and semaphores. +
  • diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html index 0dfa64a87bd..5869beedf99 100644 --- a/Documentation/NuttxUserGuide.html +++ b/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

    NuttX Operating System

    User's Manual

    by

    Gregory Nutt

    -

    Last Updated: November 18, 2008

    +

    Last Updated: March 8, 2009

    @@ -1718,9 +1718,11 @@ interface of the same name.

    Some operating systems avoid priority inversion by automatically increasing the priority of the low-priority Task C (the operable - buzz-word for this behavior is priority inheritance). NuttX does not - support this behavior. As a consequence, it is left to the designer to - provide implementations that will not suffer from priority inversion. + buzz-word for this behavior is priority inheritance). NuttX + supports this behavior, but only if CONFIG_PRIORITY_INHERITANCE + is defined in your OS configuration file. If CONFIG_PRIORITY_INHERITANCE + is not defined, then it is left to the designer to provide implementations + that will not suffer from priority inversion. The designer may, as examples: