chpoll(9E) in the CharDevice glue with pinned pollheads #4
Loading…
Reference in a new issue
No description provided.
Delete branch "r3-kms-glue"
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?
Adds
chpoll(9E)to theCharDeviceglue, for the illumos-drm R3 event queue (read(2)/poll(2)on DRM nodes).What
ddi::poll:PollEvents,PollHead(!Unpin, destructor callspollhead_clean(9F),wakeupwrapspollwakeup(9F),cleanfor reused heads),PollHeads(akmem_zalloc(9F)array of pinned heads that lives as long as the instance),PollRegistration<'a>.CharDevice::chpoll<'a>(&'a self, minor, events, anyyet) -> Result<(PollEvents, PollRegistration<'a>), Errno>; defaultENXIO(asnochpoll(9F)). Bothops: [char]forms install the glue ascb_chpoll, so existing drivers are unchanged.anyyetzero, orPOLLET), and masks the reported events to the requested ones plusPOLLERR/POLLHUP.KBox::pin.docs/DESIGN.md§5.2 describes the rules.Type rules
The kernel keeps pointers into a pollhead after
chpoll(9E)returns, untilpollhead_clean(9F). A head that moves, is freed, or lives on the stack ofchpollleaves dangling pointers forpollwakeup(9F)and the nextpoll(2). In safe code that cannot be written: a registration needs aPin<&'a PollHead>whose lifetime is the instance's (compile_faildoctests: E0277 for an unpinned head, E0515 for a stack head), and dropping a head cleans it. No panic happened; these are preventive rules, so there is no row in the "Panics prevented" table and no rselftest check yet.Base
Stacked on
loose-ends-20260928(449bfe7, PR 3), which is not merged yet; the diff againstmainshows those commits too until it is. Own commits:6c1d738,5d64181,5c792b3.Verification
cargo test -p ddi --no-default-features --lib(9),cargo +nightly-2026-04-16 test -p ddi --no-default-features --doc --target x86_64-unknown-illumos(15, including bothcompile_fail), clippy-D warnings, fmt, rustdoc-D warnings. In the kernel through illumos-drm R3 on illumoscda5b9a49f: poll/read tests, a close-while-pending churn andmodetest -v(select-driven page flips at 60 Hz) pass; see the illumos-drm PR.Reviewed locally against the Anima review bar in two rounds (round 1 found the missing lifetime on
PollRegistration; fixed in5c792b3).