Skip to content

[NO MERGE] Redesign NoLock to LocalRwLock - #577

Open
Natural-selection1 wants to merge 10 commits into
vivoblueos:mainfrom
Natural-selection1:codex/nolock-irq-context
Open

Natural-selection1 wants to merge 10 commits into
vivoblueos:mainfrom
Natural-selection1:codex/nolock-irq-context

Conversation

@Natural-selection1

@Natural-selection1 Natural-selection1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Don't merge it right now!

The thread_metric benchmark is now as follows.

Workload shift=4 baseline shift=4 final Change shift=5 baseline shift=5 final Change
Thread-Metric basic processing 13,537.6 13,534.8 −0.02% 6,760.4 6,757.8 −0.04%
Thread-Metric preemptive scheduling 50,845.6 51,931.2 +2.14% 25,405.4 25,928.8 +2.06%
Thread-Metric synchronization, uncontended semaphore 747,573.0 742,974.8 −0.62% 373,320.0 370,949.4 −0.64%
Two-thread contended semaphore ping-pong 30,668.0 31,457.2 +2.57% 15,310.6 15,659.2 +2.28%

@Natural-selection1
Natural-selection1 force-pushed the codex/nolock-irq-context branch 2 times, most recently from a1abb0d to 2d3c9dd Compare November 18, 2026 08:12
@Natural-selection1
Natural-selection1 marked this pull request as draft November 18, 2026 08:13
@Natural-selection1
Natural-selection1 marked this pull request as ready for review November 18, 2026 08:13
@Natural-selection1
Natural-selection1 force-pushed the codex/nolock-irq-context branch 5 times, most recently from 322329b to 8fac67d Compare November 19, 2026 08:06
@Natural-selection1 Natural-selection1 changed the title [NO MERGE] try LocalRwLock [NO MERGE] Redesign NoLock to LocalRwLock Nov 19, 2026
@Natural-selection1
Natural-selection1 force-pushed the codex/nolock-irq-context branch 3 times, most recently from 388b90d to 5ad3a34 Compare November 19, 2026 09:10
Introduce NotThreadSafe and carry it through read, write and upgradable guards, including conversions. Express when a shared reference to each guard may cross threads.
Track outstanding reads and exclusive writes in LocalRwLock. Its callers supply the execution-context exclusion needed to update the borrow state.
Count nested IRQ leases, restore the saved mask on the last release and track live preemption leases. Borrow DisableInterruptGuard as proof of masking and remove PlainDisableInterruptGuard. Keep guards that release IRQ nesting, per-CPU access or the flash mutex in their acquiring context.
@Natural-selection1
Natural-selection1 force-pushed the codex/nolock-irq-context branch 3 times, most recently from d8aa994 to db0bc62 Compare November 20, 2026 07:37
Return an owned IRQ guard from IRQ-save writes and tie borrowed acquisitions to the caller's IRQ mask. Keep the preemption lease in the ordinary write guard. Tighten shared lock and AArch64 handler bounds and cover conflicts, guard transfer and IRQ restoration in the lock tests.
…ints

Check switching and interrupt restoration at architecture boundaries. Keep the RISC-V syscall guard on its acquiring thread and make the raw IRQ enable and restore calls explicit.
Pass the IRQ proof through thread selection and timer operations. Honor live guards at context switches and require an owned IRQ guard for suspension with a queue lock. Release the payload borrow before restoring the saved mask.
Carry IRQ protection from queue acquisition through suspension and wakeup. Update semaphore and message queue operations, atomic waits and lock accessors to use the final guard types.
…uler path

RV32 release builds can lose the empty-queue check after an inlined pop_front, leaving the priority active after its last thread is removed. Keep the function out of line pending the intrusive list aliasing work tracked in vivoblueos#559.
Add thread-metric probes for local lock behavior and the contended semaphore handoff.
Install the handlers used by the CMSIS validation suite and make validation failures visible to the test runner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant