Loose ends: private-tier consumer, OwnNode for minor nodes, properties and LDI, nightly doctests in CI #3
Loading…
Reference in a new issue
No description provided.
Delete branch "loose-ends-20260928"
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?
Loose ends after merging #1 (
drm-r0) and #2 (dma-own-node).1. Private tier: first consumer (
docs/DESIGN.mdsection 4)This applies the pending design-doc edit and brings it up to date. The Rust DRM core lives at https://code.aopc.cloud/illumos/illumos-drm. R0 and R1 needed only the public tier, plus the clone-open and
devmap(9E)glue from #1. The later milestones needillumos-kernel-private-sys:falloc/setffor PRIME, syncobj export andsync_filedescriptors.gfx_private.hat_*, but only a later TTM-like layer uses them.2. OwnNode follow-ups from #2
Each decision was checked against the gate source of illumos
cda5b9a49f(os/sunddi.c,os/driver_lyr.c,os/devcfg.c,os/sunpm.c,vm/seg_dev.c). The new DESIGN.md section 5.12 table records all of them.ddi_create_minor_nodeOwnNode::create_minor_nodereplacesDevInfo::create_minor_nodedev_ttakes the major number of the node's driver, so opens go to that driver.detach_node(devcfg.c) removes a node's minor nodes when that driver detaches, after which ourMinorNodedrop would touch a node that may be gone. An unbound node tripsASSERT(major != DDI_MAJOR_T_NONE)on DEBUG kernels.DdiErrorddi_prop_update_*,ddi_prop_remove,ddi_prop_remove_all,ddi_prop_undefineProps<'a, A = ReadOnly>.DevInfo::props()gives a lookup-only view;OwnNode::props()givesProps<'_, ReadWrite>with the update and removal methodsddi_prop_add,ddi_prop_remove_common). That list belongs to the node's driver:detach_nodedeletes it, and the framework reads settings from it (pm-componentsinsunpm.c).remove_allon a foreign node would delete another driver's properties.PropError::NotOwnNode(new variant)ldi_ident_from_dipLdiIdent::from_dip(&OwnNode, ..)ident_alloc(driver_lyr.c) stores the dip without a hold, andldi_usage_walker_helperlater callse_ddi_hold_devion it, so an identifier for a foreign node can outlive that node.ENXIOdevmap_devmem_setup/_remapDevmapHandlenow documents that the dip must be the own node. A future safe wrapper takes&OwnNodeddi_map(dip)through the parent nexus, which is the same root-node hazard asRegMap.devmap_umem_setup/_remapseg_dev.cnever reads the dip.ddi_driver_name,ddi_get_instance,ddi_report_dev,dev_errDevInfoI considered API churn.
node.props()still resolves for anOwnNode, because the inherent method is found before the deref, and lookups compile unchanged. What changes:DevInfomust use theOwnNode.Props::removenow returnsResult<bool, PropError>andremove_allreturnsResult<(), PropError>, so the guard can report a refusal.LdiIdent::from_dipandcreate_minor_nodeneed theOwnNode. A driver that uses them after attach keeps the node in its instance, asrselftestnow does.No legitimate use becomes impossible. Leaf drivers only act on their own node, and nexus drivers update child properties with the unwrapped
ndi_prop_*.Type-rule tests are
compile_faildoctests with compiling twins:DevInfo::create_minor_node: E0599DevInfo::props().set_int: E0599LdiIdent::from_dip(&DevInfo): E0308Guard tests are
rselftestchecks againstddi_root_node: "minor node on root node refused by guard", "prop update on root node refused by guard", "ldi ident for root node refused by guard", plus "prop remove missing". None of these can panic even without the guard (see the doc comment oftest_own_node_guards).3. CI
mainatda82578, run 17:check-hostedpassed, including the host-test step on the Linux runner (6 lib tests, 5 doctests, 7 ignored). Nothing needed fixing.check-hosted: installnightly-2026-04-16with the illumos target and runcargo +nightly-2026-04-16 test -p ddi --no-default-features --doc --target x86_64-unknown-illumos. Stable rustdoc ignores the error code aftercompile_fail; the nightly checks it. As a negative control I changed the E0308 in thefrom_dipdoctest to E0599: the nightly run failed withSome expected error codes were not found, and stable still passed.Verification
Local checks on the Mac, targeting
x86_64-unknown-illumos:check,clippy -D warnings,fmt --checkanddoc -D warningspass.cargo xtask lint-man --coverage: 1020 references, 0 errors, 1183/1183 9F names bound.kernel-checkwas not run, because no binding changed.In-kernel test:
rselftestran in a fresh golden guest on Hephaistos (illumoscda5b9a49f):/devices.rem_drvwas clean and there was no panic.