Fix-Point opened a new pull request, #22618:
URL: https://github.com/apache/nuttx/pull/22618

   ## Summary
   
   Simplify the `SIGEV_THREAD` notification path in 
`sched/signal/sig_notification.c`.
   
   Today `struct sigwork_s` always carries `value` and `func` alongside the 
`work_s` and every notification is routed through the 
`nxsig_notification_worker()` wrapper that unpacks the callback. This series 
removes the redundancy:
   
   - With `CONFIG_FDPIC` not set, `sigwork_s` keeps only the `work_s` member. 
The `value` and `func` fields and the `nxsig_notification_worker()` hop are 
deleted; the notification function and its value are passed straight to 
`work_queue()`, since `sigev_notify_function_t` is ABI-compatible with 
`worker_t` and the `sigval` union fits in the one-word work argument. Every 
`sigwork_s` instance (POSIX timers, AIO, mqueue, GPIO, joysticks, ...) shrinks 
and the indirect callback hop is gone.
   - With `CONFIG_FDPIC`, `sigwork_s` keeps the module callback descriptor and 
the notification value: a work queue worker carries no module data base, so the 
descriptor is captured at registration (`fdpic_init()`) in the module's context 
and installed around the call (`fdpic_invoke()`) on the worker, as documented 
in `Documentation/os/binfmt/fdpic.rst`. The value is snapshotted into the work 
item as well, because the item may stay queued past the lifetime of the 
caller's `sigevent`.
   - `nxsig_cancel_notification()` becomes a macro over `work_cancel_sync()` in 
the non-FDPIC build, so the function definition and its comment block are 
removed.
   
   ## Impact
   
   - `include/nuttx/signal.h`, `sched/signal/sig_notification.c` only.
   - No caller-facing API change; the 14 existing `nxsig_cancel_notification()` 
call sites (timers, message queues, GPIO, joysticks, ...) are unaffected.
   - Existing FDPIC behavior is preserved: the module base capture and install 
path is unchanged, only the non-FDPIC build is simplified.
   
   ## Testing
   
   Builds, zero errors:
   
   - rv-virt:nsh with `CONFIG_SIG_EVTHREAD=y` (non-FDPIC path, direct 
work_queue call): OK
   - rv-virt:nsh with `CONFIG_SIG_EVTHREAD=y CONFIG_FDPIC=y CONFIG_ELF=y` 
(FDPIC worker path): OK
   - rv-virt:nsh with `CONFIG_SIG_EVTHREAD=y CONFIG_INPUT=y 
CONFIG_INPUT_AJOYSTICK=y` (exercises the `nxsig_cancel_notification()` call 
sites): OK
   
   `checkpatch` passes.
   
   ostest under QEMU (`qemu-system-riscv32 -M virt -cpu rv32 -kernel nuttx 
-nographic`):
   
   ```
   robust_test: Test complete with nerrors=0
   cond_test: Errors  0  0
   ...
   ostest_main: Exiting with status 0
   ```
   
   Full log: `ostest-sigwork-final.log` (1028 lines). Strict failure count: 0.


-- 
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]

  • [PR] sched/signal: simplify S... Fix-Point (via GitHub) via commits

Reply via email to