wangzhi16 opened a new pull request, #18189:
URL: https://github.com/apache/nuttx/pull/18189
## Summary
This PR bundles five commits that reduce the use of broad global critical
sections and replace or remove them with finer-grained synchronization
(`spinlock_t` or direct IRQ save/restore) where appropriate. The goal is to
limit unnecessary IRQ masking, improve concurrency, and clearly separate
scheduler-level locking from architecture-level raw test-and-set primitives.
Included commits (most recent first):
- `7c6bc02` — graphics/nxterm: Use small lock to protect resource in
graphics.
- Add a `spinlock_t` to the nxterm state and replace broader mutex/critical
section usage with `spin_lock_irqsave_*`/`spin_unlock_irqrestore_*`.
- `20177e2` — drivers/pwm: remove critical section and mutex.
- Remove redundant `enter_critical_section()`/`leave_critical_section()` in
the PWM start path; synchronization now relies on per-object locking.
- `d3bc3d4` — drivers/timer: remove critical section.
- Replace global critical sections with
`spin_lock_irqsave()`/`spin_unlock_irqrestore()`
and add a `spinlock_t` for the timer upper-half.
- `6d4b3fd` — sched/wdog: remove critical section.
- Replace `enter_critical_section()`/`leave_critical_section()` with
`up_irq_save()`/`up_irq_restore()` in the watchdog helper wrapper.
- `d5ddb03` — mm/kasan: Remove unnecessary critical sections in mm/kasan.
- Remove unused `enter_critical_section()`/`leave_critical_section()` calls
from KASAN hook code where they were redundant.
## Impact
- Behavior: No algorithmic changes; synchronization granularity is reduced in
several subsystems (fewer global IRQ disables). This should improve
concurrency but requires verification to ensure data shared with interrupt
handlers remains correctly protected.
- Build: Changes require the `spinlock` headers and APIs to be available to
the modified files (they are included in-tree). External modules that
expected earlier global critical-section semantics should be reviewed.
- Compatibility: In-tree user-visible APIs remain stable. Driver authors
should prefer per-object `spinlock_t` for short critical regions,
especially
when protecting data shared with interrupt handlers.
- Risk: Possible concurrency regressions if a removed critical section was
actually required. Review and tests focused on interrupt-context access are
important.
## Testing
armv7a:smp ostest 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]