Repository navigation
lock: add per-bridge advisory locking - #89
JacksonBopp wants to merge 1 commit into
Conversation
Add a flock(2)-based advisory lock scoped to each bridge driver's name, held for the duration of a probe attempt and the bridge's subsequent use, so two concurrent culvert instances can't race on the same underlying hardware. The lock is acquired in host_probe_bridge() before driver->probe() runs, since probing itself can drive the bridge (e.g. to fingerprint what's present) and is exactly the kind of access that must not race. It's released on a failed probe or allocation failure, and otherwise held on the struct bridge until host_destroy() tears it down alongside the driver's own destroy() call. This implements the bridge-operations layer of the three-layer locking design amboar laid out in amboar#48. Per a follow-up comment on that issue, the fingerprinting layer is intentionally left unimplemented, since those operations are reads and a separate lock there wasn't judged to buy much. The SoC-level protection-bit layer (SCU40[1] on 2400/2500, SCU100[1] on 2600) is a distinct, chip-generation-dependent feature and is left as future work. Fixes: amboar#48 Signed-off-by: Jackson Bopp <boppjackson@gmail.com>
|
Hi, I have a few thoughts here. Ultimately, A resulting property is that All the existing contributors to Unfortunately it's hard to consider you as someone who has a need for the project if you don't have access to the hardware it supports. I don't intend to accept contributions to the project where the contribution itself is the goal, and less so when the work is machine-generated and unlikely to benefit your learning. What I find satisfying, as a maintainer of the project, is seeing the growth in collective understanding and capability that emerges from whatever crisis motivated the work leading to the contribution1. I don't enjoy reviewing code produced by the current generation of agents. I don't enjoy the time-asymmetry of personally reviewing code that other people haven't themselves written. I don't enjoy the feeling of the lack of personal learning involved in passing the feedback I create back into an agent to generate some hopefully acceptable change. I also don't intend to have the contribution process descend into countering production of code with agents by reviewing code with agents, as that gives the impression that any of the lack of personal understanding (now on both parts) is acceptable. So more broadly than this PR, my position is that we don't accept agent-generated contributions. While your personal development processes are not for me to chose, I ask that contributors are accountable for the proposed changes in their entirety, in the understanding of the problem and the implementation of the solution, to the exclusion of needing to credit agents. The need to credit an agent with the work is an indication that your understanding and effort hasn't met that bar. So, thanks for the PR, however, I don't intend to accept or review it at this time, on the basis of the concerns outlined above. Footnotes
|
|
I think you made really good points, and I appreciate you replying and giving me good advice. I'll keep these in mind, and I apologize for thoughtlessly attempting to contribute. Thank you, and sorry again. Next time you see a commit from me, it will be my own code. |
I don't think there's any need for you to apologise! I'm not aware that that it was thoughtless - you at least managed to dig out something to improve based on past discussions that you weren't otherwise involved in. I also hadn't written these thoughts down anywhere else (despite stewing on them for some time for reasons unrelated to your PR), so there's no way you could have known prior to doing as you've done. So, thanks for the interest, and if you do encounter circumstances where |
|
Thank you, that means a lot. I'm about to graduate college and honestly not
sure what's next, professional experience is something I think about a lot.
If you're ever up for talking sometime I'd appreciate it! No pressure, I
appreciate you replying as it is, and thanks again!
…On Wed, Sep 9, 2026 at 9:45 PM Andrew Jeffery ***@***.***> wrote:
*amboar* left a comment (amboar/culvert#89)
<#89 (comment)>
@JacksonBopp <https://github.com/JacksonBopp>
I apologize for thoughtlessly attempting to contribute. Thank you, and
sorry again.
I don't think there's any need for you to apologise! I'm not aware that
that it was thoughtless - you at least managed to dig out something to
improve based on past discussions that you weren't otherwise involved in. I
also hadn't written these thoughts down anywhere else (despite stewing on
them for some time for reasons unrelated to your PR), so there's no way you
could have known prior to doing as you've done.
So, thanks for the interest, and if you do encounter circumstances where
culvert is helpful to you, then I will be keen to work with your
contributions.
—
Reply to this email directly, view it on GitHub
<#89?email_source=notifications&email_token=BIUQF3X53SMTBGVABBEYVRL5OIBURA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKNRRGE2DCNRZHE3KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-5611416996>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BIUQF3QTSVZBSSIHUETNYS35OIBURAVCNFSNUABFKJSXA33TNF2G64TZHMYTOMJZGU3TGMJVHNEXG43VMU5TKNBQGMZDCOJUGEZ2C5QC>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Summary
Implements the bridge-operations layer of the locking design you laid out in #48: a
flock(2)-based advisory lock scoped to each bridge driver's name (/run/lock/culvert.${bridgename}), held across both the probe attempt and the bridge's subsequent use, so two concurrentculvertinstances can't race on the same hardware.host_probe_bridge()beforedriver->probe()runs, since probing itself drives the bridge (e.g. fingerprinting) and needs the same protection as later use.struct bridgeuntilhost_destroy()releases it alongside the driver's owndestroy().SCU40[1]on 2400/2500,SCU100[1]on 2600) is a separate, chip-generation-dependent piece of work and isn't part of this PR.Test plan
No hardware bridges available in my environment, so verification is at the locking-primitive level rather than end-to-end against real bridge drivers:
meson setup+ninja), no warningsclang-format --dry-run --Werrorclean against the project's.clang-formatlock_acquire()on the same name correctly fails withEWOULDBLOCK; a different name succeeds concurrently; re-acquiring afterlock_release()succeedsfork()— child is correctly denied the lock while the parent holds it, confirming the mechanism works across processes, not just within oneFixes #48
🤖 Generated with Claude Code