casaroli opened a new pull request, #20387:
URL: https://github.com/apache/nuttx/pull/20387

   ## Summary
   
   Most `wd_cancel()` calls come from wakeup paths where the waiter had no 
timeout, so the watchdog is not active. This checks `WDOG_ISACTIVE()` before 
entering the critical section and returns `-EINVAL` at once. A start that races 
with the unlocked check is the same as a start just after the cancel.
   
   ## Impact
   
   Every wakeup from `sem_post()`, message queues and signals skips a critical 
section. With `SCHED_INSTRUMENTATION`, cancelling an inactive watchdog no 
longer emits `NOTE_WDOG_CANCEL`.
   
   ## Testing
   
   Renode `stm32f4discovery:nsh` with the DWT cycle counter, instructions per 
round trip:
   
   | Path | Before | After |
   |---|---|---|
   | `sem_post()` -> `sem_wait()` ping-pong | 568 | 556 |
   | `pthread_kill()` -> `sigwaitinfo()` | 732 | 720 |
   | `mq_send()` -> `mq_receive()` | 1396 | 1384 |
   
   `ostest` on QEMU `mps2-an500`: same results as unmodified master (`wdog`, 
`semtimed`, `timedmqueue`, `timedwait` and the signal tests pass).
   


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