JunyuanShen943 opened a new pull request, #4116:
URL: https://github.com/apache/nuttx-apps/pull/4116

   ## Summary
   
   * Why: the kernel now supports
     priority inheritance only for mutexes, and `sem_setprotocol()` rejects
     `SEM_PRIO_INHERIT` on a counting semaphore.
     The ostest `priority_inheritance` test used a counting semaphore with
     `SEM_PRIO_INHERIT`, so it no longer exercises anything.
   * How:
     - Use a `pthread_mutex_t` with `PTHREAD_PRIO_INHERIT`; one low priority
       holder (a mutex has a single owner), the high priority thread blocks
       on it and boosts the holder, the restoration test runs on the same
       mutex.
     - Wait for the low priority thread to actually hold the mutex (new
       `HOLDING` state) instead of a fixed `sleep(2)` before starting the
       middle priority thread.
     - Drop `sem_nfreeholders()`/`dump_nfreeholders()`, which used the
       removed kernel free-holder pool.
   
   ## Impact
   
   * New feature or changed behavior: test only.
   * User adaptation needed: NO.
   * Build: NO.
   * Hardware: NO.
   * Documentation: NO (kernel documentation is updated in the nuttx PR).
   * Security: NO.
   * Compatibility: the test also passes on current nuttx master, mutex
     priority inheritance exists there already.
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   
   * Build Host: Ubuntu 22.04 x86_64, gcc 13.1.0
   * Target: sim:nsh with `CONFIG_PRIORITY_INHERITANCE=y`, sim:ostest,
     sim:smp, mps3-an547:nsh (QEMU)
   
   With nuttx master: sim:nsh + `PRIORITY_INHERITANCE` make and CMake builds
   pass, `ostest` exits with status 0, `priority_inheritance: PASSED`.
   With the nuttx PR: see the table in that PR, all `PASSED` and status 0.
   
   ```
   lowpri_thread-1: No. highpri thread waiting: 1
   highpri_thread-1: SUCCESS midpri_thread is still running!
   lowpri_thread-1: SUCCESS priority before unlock: 255
   lowpri_thread-1: SUCCESS final priority: 1
   priority_inheritance: PASSED Priority were correctly restored.
   ```
   
   ## PR verification Self-Check
   
   * [x] This PR introduces only one functional change.
   * [x] I have updated all required description fields above.
   * [x] My PR adheres to Contributing Guidelines and Documentation (git commit 
title and message, coding standard, etc).
   * [ ] My PR is still work in progress (not ready for review).
   * [x] My PR is ready for review and can be safely merged into a codebase.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to