vms-ff7 (P4-A): lock manager compiled into the NetBSD vms module — real exec_rbtree backend - #482
Merged
Merged
Conversation
…al exec_rbtree backend, COMPLETES the NetBSD executive set The LAST NetBSD executive facility. src/kernel-core/vms_lock.c (the shared DLM: $ENQ/$DEQ/$CONVERT/$GETLKI + directory/mastering) now compiles into the OVMX/ NetBSD `vms' pseudo-device from the SAME source the Linux vms.ko runs — one facility, two substrates (INV-DRIFT). With every facility now runnable on NetBSD, this unblocks the executive-on-VAX compile (B1, vms-20b9). The main new work is the real exec_rbtree NetBSD backend. vms_lock.c is the sole exec_rbtree consumer (its lock-ID tree) and drives a LOW-LEVEL, caller-descended contract (exec_rb_left/right + exec_rb_link_node/insert_color/erase) that NetBSD rb_tree(3)'s comparator API cannot back (design record §5 #2), so exec_rbtree_netbsd.c ships OVMX's OWN textbook red-black tree — the analogue of exec_list_netbsd.c / exec_hash_netbsd.c — with the packed parent+colour node the contract exposes. Verified against a 4000-element random insert/erase stress harness: all red-black invariants (parent links, no red-red, equal black-height, BST order, root black) held through full deletion to empty. Wiring (NetBSD backend only; Linux untouched): - vms_lock_nb.h: the DLM wire contract — LCK_K_*/LCK_M_* modes+flags, LCK_VALBLK_SIZE, the four arg structs (all _IOWR, <=104B — no IOC_VOID big-io), request numbers byte-identical to Linux (magic 'V', NR 0x30-0x34), size asserts. - vms_internal.h twin: struct vms_lock_entry/resource in exec_* vocabulary, the proc lock fields (locks/lock_count/lock_list_lock), VMS_RES_HASH_BITS, the lock SS$ codes, extern vms_local_csid, facility prototypes; includes exec_rbtree.h. - vms_netbsd.c: defines vms_local_csid (glue, =1, as Linux vms_module.c); brings up/tears down the lock proc fields; calls vms_proc_release_locks at proc death and vms_lock_init/cleanup in the module lifecycle (cleanup frees the entries, so proctab_teardown only destroys the guard — the eflag asymmetry); dispatches the five lock ioctls; drops the now-real weak rundown_locks stub. - Makefile + crosscompile.sh: add vms_lock.c + exec_rbtree_netbsd.c to SRCS. Per-PR gate reproduced locally in a clang container against the pinned NetBSD/ amd64 kernel headers: 10 TUs compile -Werror and relocatable-link clean (no dangling exec_rbtree_*/exec_* symbol, no duplicate); negctl fails as it must. Lock logic is not duplicated (only kernel-core/vms_lock.c); the new .c lives in src/kernel-netbsd/ (excluded from the userspace_service_register host-compile). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Completes the NetBSD executive backend set (last facility, epic vms-8e8 P4-A) → unblocks the executive-on-VAX compile (B1, vms-20b9).
What
src/kernel-core/vms_lock.c— the shared distributed lock manager ($ENQ/$DEQ/$CONVERT/$GETLKI + DLM directory/mastering) — now compiles into the OVMX/NetBSDvmspseudo-device from the same source the Linuxvms.koruns. One facility, two substrates (INV-DRIFT); Linux behaviour untouched.The real
exec_rbtreeNetBSD backend (the main new work)vms_lock.cis the soleexec_rbtreeconsumer (its lock-ID tree) and drives a low-level, caller-descended contract (exec_rb_left/right+exec_rb_link_node/insert_color/erase) that NetBSDrb_tree(3)'s comparator API cannot back (design record §5 #2). Soexec_rbtree_netbsd.cships OVMX's own textbook red-black tree — the analogue ofexec_list_netbsd.c/exec_hash_netbsd.c— with the packed parent+colour node the contract exposes.Validated against a 4000-element random insert/erase stress harness: all red-black invariants (parent links, no red-red, equal black-height, BST order, root black) held through full deletion to empty.
Wiring (NetBSD backend only)
vms_lock_nb.h— DLM wire contract:LCK_K_*/LCK_M_*,LCK_VALBLK_SIZE, four arg structs (all_IOWR, ≤104 B → no IOC_VOID big-io), request numbers byte-identical to Linux (V, NR 0x30–0x34), size asserts.vms_internal.htwin —struct vms_lock_entry/resourceinexec_*vocabulary, proc lock fields,VMS_RES_HASH_BITS, lock SS$ codes, externvms_local_csid, prototypes; includesexec_rbtree.h.vms_netbsd.c— definesvms_local_csid(glue, =1, as Linuxvms_module.c); brings up/tears down proc lock fields;vms_proc_release_locksat proc death;vms_lock_init/cleanupin module lifecycle (cleanup frees entries, soproctab_teardownonly destroys the guard — the eflag asymmetry); dispatches the five lock ioctls; drops the now-real weakrundown_locksstub.Makefile+crosscompile.sh— addvms_lock.c+exec_rbtree_netbsd.cto SRCS.Verification
Per-PR gate "NetBSD/amd64 vms module cross-compiles" reproduced locally in a clang container against the pinned NetBSD/amd64 kernel headers: 10 TUs compile
-Werrorand relocatable-link clean (no danglingexec_rbtree_*/exec_*, no duplicate); negctl fails as it must. Lock logic not duplicated (onlykernel-core/vms_lock.c); new.clives insrc/kernel-netbsd/(excluded from theuserspace_service_registerhost-compile, per the V3 gotcha).🤖 Generated with Claude Code