softbkl: replace hardware k0lock with software ticket lock (SOFT_BKL)#77
Open
Erich Plondke (eplondke) wants to merge 1 commit into
Open
softbkl: replace hardware k0lock with software ticket lock (SOFT_BKL)#77Erich Plondke (eplondke) wants to merge 1 commit into
Erich Plondke (eplondke) wants to merge 1 commit into
Conversation
Introduce SOFT_BKL compile-time flag that redirects all BKL lock/unlock
sites from the hardware k0lock instruction to an in-memory ticket spinlock.
- BKL_LOCK/BKL_UNLOCK macros in hw.h dispatch to H2K_spinlock_{lock,unlock}
when SOFT_BKL is set, k0lock/k0unlock otherwise
- ASM_BKL_LOCK/ASM_BKL_UNLOCK macros in asm_std.h wrap the LL/SC ticket lock
for .S files; K0LOCK/K0UNLOCK (bypass poison) otherwise
- Makefile poisons bare k0lock/k0unlock in .S files to enforce macro use
- H2K_spinlock_t bkl field added to H2K_kg_t under SOFT_BKL
- All 20 .S files converted from bare k0lock/k0unlock to ASM_BKL_LOCK/UNLOCK
- ticket lock: 32-bit packed (upper 16 = next, lower 16 = now_serving),
strictly fair FIFO, removes dccleana from acquire path
- h2_init() sets H2K_gp (r28) so INC_KERNEL tests work without per-test change
- boot.ref.S adds call 1f to establish r31 before first ASM_BKL_LOCK
make testall SOFT_BKL=1: 1224 passed, 0 failed
Signed-off-by: Erich Plondke <erich@qti.qualcomm.com>
Erich Plondke (eplondke)
force-pushed
the
dev/ejp/softlock
branch
from
July 13, 2026 04:19
1ce5e3a to
6e801bf
Compare
Erich Plondke (eplondke)
marked this pull request as ready for review
July 13, 2026 18:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce SOFT_BKL compile-time flag that redirects all BKL lock/unlock sites from the hardware k0lock instruction to an in-memory ticket spinlock.
make testall SOFT_BKL=1: 1224 passed, 0 failed