G7: both DRM stacks on one machine, drmadm selects the one that binds the GPU #10
Loading…
Reference in a new issue
No description provided.
Delete branch "g7-coexist"
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?
Anima work item: G7
01a1028d-7fdb-7411-9ddb-af9b0f9d4444Stacked on #9 (
r5a-facade); pins illumos-ddi6e65077(illumos-ddi #9,g7-module-busy, stacked on its #8). The gfx-drm half is the branchdrm-coexistof OpenIndiana/gfx-drm (c8967ec, two commits onmasterd109414; no PR there yet) and must be merged, and adriver/graphics/drmbuilt from it installed, before a machine loads both stacks.Both DRM stacks install on one machine, are never loaded together, and
drmadm(8)selects the one that binds the GPU and loads at boot.Guards (both sides)
drm_sunmod.c_init:EBUSY+cmn_errwarning ("drm: the DRM core misc/drm_core is loaded; ...") whiledrm_coreis loaded. The existingmisc/drm_coreguard covers the other direction.modulesundermod_lockasmod_name_to_modid()does and comparemod_modname(same for every load path); C reachesmodules/mod_lock(sys/modctl.h, private) directly, Rust throughddi::private::module_loaded. No hold:mod_hold_by_namewaits for a busy module, and a module is busy in its_init, so two_inits holding each other could deadlock; the walk waits only formod_lock, which the framework does not hold while calling_initor waiting (modinstallasserts it;mod_hold_by_modctldrops it incv_wait)._init/_fini). A core only in memory (a dependency whose_initfailed:mod_install_requisitesdoes not unload it,modunloadcannot) does not count; counting it locked the other core out (found in guest run 1). Each core is loaded and busy before its own check, both checks holdmod_lock, so of two concurrent loads at least one refuses.drmadm (
tools/drmadm/drmadm,drmadm.8, packagedriver/graphics/drmadm, required bydrm-core)status: selection (since the boot / from the next boot), packages of both stacks, loaded modules of both, Intel aliases oni915/i915n/unbound,/dev/drilink count, everyexclude:naming a DRM module in/etc/systemand/etc/system.d.select legacy|new: refuses while a module of either stack is loaded (lists them and themodunloadsteps) and while/etc/system.d/.drmadm.lockis held; then (1) writes/etc/system.d/driver:graphics:drmadmfirst (selection, time, the managed alias set,exclude:for the other stack's modules asclass/nameand bare name — the kernel checks bothmod_filenameandmod_modname, and only the bare name catchesmodload /kernel/misc/amd64/drm); (2) moves the Intel aliases withupdate_drv -n(files only; next boot):-done alias per call, read back (with a list it matches nothing and exits 0),-awith the list; rollback (aliases back, previous fragment) on failure or HUP/INT/TERM; (3)bootadm update-archive; prints every change.-R rootfor a mounted BE.driver/graphics/drmdeclares fori915(pkg contents -m) ∪ bound toi915/i915n∪ recorded in the fragment.i915nis reserved for the G5 Intel driver; until it existsselect newleaves the aliases unbound (GPU falls back tovgatextviapciclass,030000) and says so. Its package must ship its driver action without aliases (IPS refuses a driver action whose alias another driver action declares); no package here binds an Intel GPU at install.update_drvover editingdriver_aliases(lock, conflict checks, atomic rewrite);-nbecause the selection is for boot and-a/-dwithout it would attach/unconfigure now./etc/system.dexists since 2018 (bootadmassembles.self-assembly; dot files skipped).Links and libdrm
drm-devlink'sSUNW_drm_linkserves both stacks. Its removal rule^dri/[a-z]D?[0-9]+$matched nocard0/controlD64/renderD128; gfx-drmdrm-coexistfixes it ([a-z]+), so after a switchdevfsadm -Ccleans/dev/dri(drmadm prints the step; man page, README, x230 doc include it). libdrm 2.4.134 skips stale links (stat + libdevinfo).Evidence
Guest
g7-run3on hephaistos (fresh overlay ofgolden-20260930, illumos7e802e88a3, virtio-gpu-gl, 2 vCPU/3 GiB); gfx-drm built on oibldofgate aslibdrm-update+ the twodrm-coexistcommits (b614900, p5p sha2568d42d281…59cc9), plus the plaindrm-coexisttree (c8967ec); logslogs/oibldofgate/20261003-g7-{coexist,combo}-build.log.run-g7-test.shphases, all PASS, 81 checks, 0 FAIL (logs/hephaistos/illumos-drm/20261003-g7-run3-*.log):/dev/dri/card0.g7(drm with guard, drm-devlink, libdrm 2.4.134, drm-core, drmadm, virtio-gpu, cdrmnull)./kernel/misc/amd64/drmby path and dependenti915,virtio_gpu,cdrmnull; stuck dependency (::modctlbitsl) does not block; 100 concurrent loads: legacy 51, new 49, neither 0, both 0.modinstallholds one core loaded+busy before_init; the other refuses, both directions.i915, unbound; fragment with 6 excludes and 110 recorded aliases;.self-assemblyhas it; second select changes nothing;pkg verify driver/graphics/drmreports the aliases.misc/drm, path load anddrv/i915excluded (no guard ran); packaged drivers attach; libdrm lists 2 devices.pkg verifyclean; new modules excluded; legacydrmandi915modules load (no Intel GPU in the guest, soi915cannot attach); libdrm 0 devices with 4 stale links;devfsadm -Cremoved all 4.i915n(add_drv -n) and back. select-root (3):-Ron a mounted clone only. rollback (5): failingupdate_drv -don a scratch root → exit 1, aliases and previous fragment as before. recover-remove/after-recover (5): hand removal + reboot → nothing excluded, either core loads; thenselect legacyrestored the 110 aliases.run-r5a-test.shwithLEGACY_GUARD=skipPASS, 75 checks, 0 FAIL (R2 200×2, R4 63, R5a 81×4, run-g6-test PASS, run-r1-test cdrmnull fail=0) —20261003-g7-run3-r5a-suite2.log. The first attempt (…-r5a-suite.log) failed 16 checks: unprivileged opens ofcdrmnull's nodes left 0600 by the uninstalled package, and a/dev/dristate check broken by the fixed link rule (fixed ine0e43e0).g7-console/). Earlier attempts: run1 found the stuck-dependency lock-out, run2 thatr()is a ksh93 alias.cargo test -p drm-core -p drm-uapi -p drm-facade(124+2+1), shellcheck of drmadm,mandoc -T lint.Review
Opus, anima-review bar. Round 1 rejected: guards counted stuck dependencies (B1),
update_drv -dlist no-op (B2), alias loss on failure (B3), stale links undocumented (B4) — all fixed. Round 2 approved; its fix-before-merge items (IPS wording,statusversion with non-first publisher, rollback ordering, untested rollback, signal during moves, vgatext alias, pkg update note, deterministic overlap test) are done in3ba24f1/98ea76c.Open issues
drm-coexistmust merge (and be packaged) before the X230 runs both stacks.virtio_gpu/cdrmnullnodes attached at boot are0600 root rootdespiteminor_perm0666(20261003-g7-run3-pkgperm.log); persists across reload,rem_drv -Cclears. Packaging question beyond G7.selectneeds every DRM module unloaded: on the X230 stop the display manager and unloadi915/drmfirst, or use-R.pkg fixor apkg updateofdriver/graphics/drmthat addsi915aliases undoes part ofselect new; documented (rerun select).pkgoperation that creates a BE copies the running one; a later select in the running BE doesn't reach it (documented).drmadmfrom the run directory rather than the package installed at89ea95e.boot -arecovery verified against source (mod_askparams), not in a guest.