bes2600: Patch D — atomicize ba_lock counters, drop the spinlock #7
Reference in New Issue
Block a user
Delete Branch "bes2600/ba-lock-atomic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Per the Opus structural critique (PR #8 §2.3 / ba_lock TODO debt) and Sonnet review item 4. The block-ack policy 4 int counters (ba_acc, ba_cnt, ba_acc_rx, ba_cnt_rx) bumped per data frame under
spin_lock_bh(&hw_priv->ba_lock)are the heaviest per-frame sync cost remaining after Patch C v3.What this patch does
atomic_tatomic_t ba_armedflag (race-free once-per-window timer arm via cmpxchg)spinlock_t ba_lockentirelyatomic_inc+atomic_add+atomic_cmpxchg, no lockatomic_read+atomic_set, no lock (stats approximation tolerated)Concurrency invariant
Producers race freely; the cmpxchg on ba_armed ensures at most ONE producer claims the timer-arm in any window. Counter increments may interleave with the timer callback's snapshot+reset (slight under-reporting on the boundary tick) — same approximation the original spinlock allowed under contention; acceptable for periodic stats.
Build verified
bes2600.ko builds clean on ohm sandbox: srcversion 912F75DF0F97145DB74F34D, 0 warnings, 0 errors.
Test plan
Remaining ba_lock-shaped TODO debt
bes2600.h still has
/*TODO: Same as above */comments on neighboring fields (ba_hist, ba_timer, ba_work). Those are single-writer or already-internally-locked.