Skip to content

Plan files mmap memory and attach

ebenali edited this page Dec 4, 2026 · 23 revisions

Plan: files, mmap, memory and driver attach

Scope for the work between "the DRM core compiles" and "a first driver (amdgpu) attaches and user space can map buffers". Written before implementation; milestones are updated as they land. See DRM integration for status and Linux compatibility layer for the principles (compat first, then glue, then replacement files; no patches to dist).

What upstream 7.3 expects

Opening a device. /dev/dri/* are character devices of one major. Opening one calls drm_stub_open(inode, file), which looks up the minor by iminor(inode), switches the file to the driver's file_operations (replace_fops) and calls their open (normally drm_open). drm_open sets file->f_mapping to the device's shared anon_inode->i_mapping, checks f_flags (O_EXCL) and f_op->fop_flags & FOP_UNSIGNED_OFFSET, and records the opener (task_tgid(current), capable(CAP_SYS_ADMIN)). Read, poll and ioctl are plain file_operations; DRM has no kqueue.

Mapping a buffer. mmap on that file calls f_op->mmap(file, vma) = drm_gem_mmap, which finds the object by vma->vm_pgoff (a fake offset from drm_vma_manager) and calls the object's funcs->mmap and/or installs funcs->vm_ops. Pages arrive in one of these ways:

Way Who
vm_ops->fault calling vmf_insert_pfn(_prot) TTM (amdgpu, radeon, nouveau, xe, vmwgfx), GEM shmem helper, xe
eager remap_pfn_range / io_remap_pfn_range / dma_mmap_* at mmap time GEM DMA helper (ARM SoCs), a few small drivers
apply_to_page_range (writes PTEs itself) i915 (i915_mm.c)

Fault handlers may sleep (reservation locks, fences). Before sleeping they call mmap_read_unlock(vmf->vma->vm_mm) and return VM_FAULT_RETRY when vmf->flags allows a retry; TTM does this.

Revoking mappings. When a buffer moves (VRAM ↔ system, eviction, reset, unplug), drivers call unmap_mapping_range(mapping, offset, len, 1) on the device's address_space — via drm_vma_node_unmap, TTM, amdgpu and i915 directly. Every user mapping of that range must fault again afterwards.

Pages. TTM allocates system pages itself (alloc_pages, orders

0, GFP_DMA32), sets their caching (set_pages_array_wc/uc/wb), maps them for the CPU (kmap_local_page, vmap) and the device (dma_map_page, dma_alloc_coherent), keeps pools on list_lru with a shrinker, and swaps out to shmem (shmem_file_setup, folios) under pressure. VRAM is reached through ioremap_wc, io_mapping_*, memremap. drm_gem_object_init (i915, shmem-helper drivers) backs objects with shmem.

Attaching. A driver's module_init calls pci_register_driver; the PCI core calls probe(pdev, id), which allocates the DRM device, loads the hardware, registers minors and sets up fbdev through DRM clients (drm_client_setup → register_framebuffer). remove and driver.pm undo and suspend.

How NetBSD's 5.6 port did it, and why we cannot

It patched dist: drm_gem_object embedded a UVM object, TTM had a UVM pager and allocated through bus_dma (ttm_bus_dma.c), drivers called pmap_pv_track on their apertures and pmap_pv_protect / pmap_page_protect to revoke, and per-driver glue (amdgpu_pci.c, amdgpufb.c) called drm_dev_alloc / drm_dev_register by hand. The mechanisms are sound and are reused below; the patches are what we avoid.

How FreeBSD's LinuxKPI does it (BSD-2, may be ported)

One VM object per VMA with a "managed device" pager; the fault op fills a vm_fault and calls vm_ops->fault; vmf_insert_pfn_prot inserts fake pages into the object; NOPAGE with nothing inserted is retried with a time bound. Its unmap_mapping_range does not have Linux's semantics (callers pass vm_private_data): drm-kmod patches the call sites. So FreeBSD has no generic answer for revocation.

Design

x86 cache attributes (M0) — groundwork, first

Decided: keep CONFIG_X86_PAT (amdgpu uses write-combining as on Linux) and do the pmap work before the compat memory layer, so that layer asks "what mode is this page in?" from day one.

  • Per-page mode in two spare bits of x86 pp_attrs; every pmap_enter of a managed page applies it, so no two mappings of a page disagree. pmap_page_set_cacheattr(pgs, n, mode), pmap_page_cacheattr(pg), pmap_kva_set_cacheattr(va, len, mode) (new sys/arch/x86/x86/pmap_cacheattr.c). Refuses (EBUSY) a second non-WB mode and pages that are mapped; a UVM hook (PMAP_PAGE_FREE in uvm_pagefree) restores WB if an owner forgets.
  • Direct map: a 2 MiB page is split into 4 KiB entries on first change (same translations), the one entry changed, all TLBs shot down, caches flushed when leaving WB (not on self-snooping CPUs). AMD Family 10h (erratum 383) splits inside an all-CPU rendezvous.
  • Only RAM is direct-mapped now: PCI window, firmware and ACPI ranges are absent; mm_md_direct_mapped_phys() answers for RAM only, so /dev/mem, EFI and physmap use proper mappings for the rest.
  • Linux compat: set_pages_array_wc/uc/wb, set_pages_uc/wb, set_memory_wc/uc/wb (asm/set_memory.h, linux_set_memory.c); map_page_into_agp makes pages uncached as Linux does.
  • Tests: t_cacheattr with the cacheattr_tester kernel module (amd64): split, all modes across a 2 MiB boundary, coherence, enforcement and refusals, kernel VA, free safety net, the erratum path (forced), stress on all CPUs (both paths), holes. Still to do: real AMD and Intel hardware.

Files and devices (M1) — done

Done as designed; kqueue added (below). drm_cdevsw.c is now a cdevsw whose d_open is linux_chrdev_open(DRM_MAJOR, ...); drm_gem_vm.c is gone (mmap returns ENODEV until M2). Still to do: the accel major.

  • register_chrdev(major, name, fops) records major → fops (today a no-op). A generic cdevsw d_open builds an inode with i_rdev = dev, a Linux file with the recorded fops, calls f_op->open, and installs it with fd_clone(..., &linux_fileops). drm_cdevsw.c shrinks to that cdevsw; the open/read/poll/close code in it goes (DRM's own functions run instead).
  • Errors: -ERESTARTSYS → ERESTART; f_flags from the open flags.
  • accel (/dev/accel) has its own major: same mechanism, later.

VMAs and faults (M2) — linux_mmap.c — done

  • linux_fileops.fo_mmap (every Linux file: DRM, dma-buf) builds a vm_area_struct and calls f_op->mmap(file, vma), then returns a UVM object (one per mmap call) whose pager bridges to the VMA.
  • Object-relative addresses. At fo_mmap time UVM has not chosen an address, and later fork, partial munmap and mremap change addresses. So the VMA uses vm_start = 0, vm_end = size, and vmf->address = (page index in object) << PAGE_SHIFT. Handlers only use addresses relative to vm_start with vm_pgoff, so this is invisible to them, and the mapping survives entry splits/moves.
  • Fault: pgo_fault fills struct vm_fault (vma, address, pgoff, flags with FAULT_FLAG_ALLOW_RETRY) and calls vm_ops->fault. vmf_insert_pfn_prot(vma, addr, pfn, prot) pmap_enters into the faulting map at the entry address for that object page (clipped to the entry: TTM prefaults 16 pages), with cacheability from prot (PMAP_WRITE_COMBINE, PMAP_NOCACHE). Eager inserts at mmap time (remap_pfn_range, dma_mmap_*) are recorded and served at fault time.
  • mmap_read_unlock(vmf->vma->vm_mm) inside a fault = uvmfault_unlockall; return codes: RETRY → ERESTART, NOPAGE → 0 (retry access; bounded in time as in FreeBSD), SIGBUS → EFAULT/EINVAL, OOM → ENOMEM.
  • vm_ops->open / close on pgo_reference / pgo_detach (one per map entry, as Linux has one per VMA). Private (copy-on-write) mappings are refused, as NetBSD's TTM did.

Revocation (M3) — done

By mapping, as Linux does, not by physical page: each address_space lists its VMAs, each VMA records the spans (process, vmspace, entry range) it was faulted in, and unmap_mapping_range pmap_removes the range from the entries that still map it. This replaced the planned pv-tracking design: no device memory needs tracking (pv tracking of a resizable BAR would cost about 1% of VRAM in RAM), and it works on every architecture, so core change 5 is no longer needed. See Memory and DMA.

Pages and DMA (M4) — done

  • Pages (done): alloc_pages/__free_pages on uvm_pagealloc / uvm_pglistalloc, struct page fields overlaid on unused vm_page fields. See Memory and DMA.
  • CPU mappings (done): kmap_local_page through the direct map; vmap/vunmap/vmap_pfn, ioremap*, memremap on pmap_kenter_pa, every mapping of a page in that page's cache mode.
  • DMA (done): the Linux struct device carries the device's 32- and 64-bit bus_dma_tag_ts (from pci_attach_args); dma_map_page/sg, dma_alloc_coherent/attrs on bus_dmamap_* / bus_dmamem_*, with a red-black tree from DMA address to map for unmapping (FreeBSD's approach) and an untracked 1:1 fast path on x86; Linux-layout scatterlists ported from LinuxKPI. See Memory and DMA.
  • list_lru (plain locked lists) and shrinker (done, on UVM reclaim hooks; core change 2), cc_platform_has (done: false).
  • shmem and folios (done): shmem files on UVM anonymous objects, page references as wirings, single-page folios. Tested through real swap (t_linux_mm shmem_swap). See Memory and DMA.

PCI driver bridge (M5) — done

Done as designed: pci_driver, registry and Linux-style id matching and PM ordering in linux_pci_driver.c (tested in rump), the autoconf side in linux_pci.c (struct linux_pci_softc, linux_pci_driver_match/attach/detach). pci/drm_pci.c and drm_pci_busid.c removed. Per-driver cfattach conversion happens with each driver port (amdgpu first); real attach is tested then.

  • pci_register_driver records the driver (from its module_init).
  • Generic helpers for a NetBSD attachment: match walks the recorded drivers' id_table; attach sets up the pci_dev and calls probe from a config_mountroot callback (firmware needs the root file system); detach calls remove; pmf calls driver.pm.
  • Per-driver glue becomes a cfattach of ~30 lines. The glue's pci/drm_pci.c (upstream has its own), drm_pci_busid.c (rewrite on pdev), hand-written drm_dev_alloc/register go.

Console and fbdev (M6) — done

register_framebuffer attaches a drmfb (a genfb on the fbdev emulation's shadow buffer) under the DRM driver's device; damage reaches the scanout through genfb's damage hook. A GPU driver takes the console over from the firmware framebuffer, at boot and when loaded later, and gives it back if its probe fails. See DRM integration.

Console and display roadmap

The principle: Linux drivers underneath, NetBSD's own interfaces on top. Everything users and administrators touch goes through wscons and the usual NetBSD tools; Linux-style settings are the advanced option.

Console modes, one setting (a module property, e.g. boot.cfg load=drmkms console=...):

Mode Console Follows output changes
no DRM genfb on the firmware framebuffer no
DRM, fbdev emulation (default, console=fbdev) DRM's fbdev client through drmfb no: fixed at the first mode, as on Linux
DRM, console client (console=wscons) a NetBSD DRM client owning its buffer with hw.drm2.console_follow; hw.drm2.video at any time
DRM, no console console on serial or another display --

Pieces, in order (1-4 done in M9; how they work: The console, Booting and kernel modules, events):

  1. One resolution setting. (done) The console takes the mode chosen with efiboot's gop command, as genfb does; a video= setting (fb_get_options/video_get_options, fed from a module property) covers several outputs.

  2. The console client. (done) A DRM client (drm/drm_client.c API, as Linux's drm/clients/drm_log.c) owning its framebuffer, setting the mode and flushing damage (drm_client_framebuffer_flush). It leaves the display alone while a DRM master (X, a compositor) owns it. Linux's fbdev layer leaves the console path.

  3. Resizing in place. (done) genfb_retarget (a new framebuffer for a genfb) and vcons_resize (every screen re-initialized, as loading a font already does), with the terminals' window size updated and SIGWINCH sent; a switch (hw.drm2.console_follow, off by default) lets the console client follow output changes.

  4. Hotplug events. (done; libudev-bsd's side is open) Output changes reach user space through drvctl device events, handled by devpubd hooks -- what a compositor or an administrator's script listens to.

  5. Modes through wscons. Mode get/set through wscons, implemented by the console client with DRM's modes and videomode(9), so wsconsctl sets the resolution whatever is underneath.

  6. Screens and graphics sessions. DRM master handover tied to wscons screen switches: several graphical sessions on different ttyE screens. What a seat manager needs on top (item 13): a switch announced to the session before it leaves and after it returns (wscons's process-controlled switching, as the USL VT_* emulation already does for X), DRM master dropped and taken at those points, and input devices revoked from a session switched away (evdev's EVIOCREVOKE, roadmap K3).

  7. The rest of the display through NetBSD interfaces: brightness as wsdisplay parameters, GPU sensors in envsys, genfb's splash screen, and a panic-time drawing path (Linux's drm_panic) behind genfb's polling hooks for ddb.

  8. Console configuration, as Debian's console-setup does it. wscons.conf stays the one source of truth. Added: a boot-time font choice (boot.cfg, used from the first message, as the mode is); short rc.conf knobs for the common case (one font for all screens); an interactive helper (or sysinst menu) that lists fonts with the rows x columns they give in the current mode, previews them live and writes the configuration; and font choice by target size that survives mode changes.

  9. The console's terminal type from its device. (done) /etc/ttys gives console and constty the type vt100, because the same entry must serve a serial console and a display; on a wscons display that is the wrong description, and its padding ($<n> delays, which less(1) turns into real sleeps) makes every pager crawl (The console). getty(8) decides the type when it opens the line:

    • only for the console line, recognized by its device (the console driver's major, so any entry naming /dev/constty or /dev/console counts), since only there /etc/ttys cannot know what kind of device it describes;
    • the screen's emulation gives the type, through a new ioctl WSDISPLAYIO_GEMUL (constty passes ioctls to the real console device): vt100 gives wsvt25, sun gives sun, dumb gives dumb; otherwise (a serial line, an unknown emulation, an older kernel) the /etc/ttys type stands, so a serial console keeps vt100;
    • a tt= capability in the line's gettytab entry always wins; every other line keeps its /etc/ttys type as written;
    • getty exports the type as TERM to login(1) (login -p keeps it) and uses it for its own clear-screen.

    Decided again at each login, so it stays right if the console's device changes between logins; a running session keeps its TERM. Proof: man ls paging timed on a drmfb console before and after; a serial console still gets vt100.

  10. Screens independent of displays (moving the console at run time). Today a wscons screen belongs to one wsdisplay: its minor encodes the display (WSDISPLAYMINOR(unit, screen)), and when the display detaches (genfb evicted by a GPU driver, a driver unloaded) its screens are revoked and their sessions end. /dev/constty redirects every read, write and ioctl to the current console device (cn_redirect, cn_tab->cn_dev), so re-pointing the console under an open session would hand that session a terminal its getty never opened. The model is Linux's: a virtual terminal (tty, emulation state, text buffer) is separate from the head that draws it, and fbcon's con2fbmap maps one to the other.

  • Split struct wsscreen into what stays (tty, minor, wsemul state, vcons text and attribute buffers) and the head binding that can change (emulops, cookie, wsscreen_descr).
  • Move = create the screen on the target head through that driver's own vcons_init_screen, redraw from scr_chars and scr_attrs, release it on the old head. A different size goes through the resize path that exists (wsdisplay_screen_resized: emulation resize, t_winsize, SIGWINCH). Keyboard focus (kbdmux) follows.
  • The kernel console keeps pointing at the same screen; cn_tab->cn_dev does not change, so constty sessions continue. The drawing target is swapped under the quiesce wsdisplay_cnquiesce already provides, so printf from interrupts and ddb never see half a switch.
  • A display that goes away hands its text screens to another display instead of revoking them. This replaces today's takeover (genfb detached, screens revoked, drmfb starting fresh) and linux_pci_give_back's reverse: sessions survive a GPU driver loading, failing or unloading, and the console's GPU driver can be unloaded once its screens have moved.
  • Limits. Screens in mapped or framebuffer mode (WSDISPLAYIO_MODE_MAPPED, DUMBFB: X, a compositor) hold a mapping of one framebuffer and do not move (EBUSY); on detach they are revoked as today. Displays without vcons (text-mode vga) have no text buffer to redraw from and take no part.
  • Compatibility. Device names, minors, ioctls and structures are unchanged; per-display ioctls on a moved screen answer for its current head. The interface is an addition: a wsconsctl field or ioctl moving screen N to display M, and a sysctl naming the console's display.
  • First: list which display drivers use vcons, check how wsemul_vt100 and X's VT handling react to a size change, then implement on genfb ↔ drmfb in the VM, then on real hardware.
  • Serial ↔ display moves are not part of this.

Proof: a shell on the console survives modload and modunload of the GPU driver (today it loses the terminal), and a screen moved between two heads keeps its contents. 11. A console display per output. Today the console client and drmfb give a DRM device one framebuffer, shown on every output (as Linux's fbdev does). Instead the console client makes a framebuffer per active CRTC and a wsdisplay for each, so every output has its own screens (ttyE0... on one, ttyE256... on the next: the minor already carries the display unit). Ctrl+Alt+Fn switches screens on the display the keyboard is attached to, as now. Outputs appearing and disappearing:

  • a new output gets a new display with one screen (more through wsconscfg, as for any display);
  • an output that disconnects parks its text screens: tty, emulation and text buffer stay, output goes into the buffer and never blocks, nothing is drawn. When an output appears again the screens attach to it and redraw, with SIGWINCH if the size differs. A disconnect does not move screens at once, since DisplayPort monitors report one when they only go to standby; they move by command (item 12) or once the output has stayed away for a while;
  • when the GPU itself goes, its screens move to another display or park (item 10);
  • graphics sessions get DRM's hotplug events (drvctl device-change) and arrange their outputs themselves; when the whole device goes, DRM's unplug fails their ioctls with ENODEV and revokes their mappings (M3), and their screen in mapped mode is revoked.

The rule: a display going away never ends or blocks a text session. 12. Keyboard focus between outputs. Keyboards reach a display through a wsmux (kbdmux), which can be reconnected while running. A keyboard command (Ctrl+Alt+Left/Right, say) moves the focus to the next display, parked screens included; the same by ioctl and a wsconsctl field. If the focused display goes away, focus moves to one that remains. The mouse stays per display (wsmoused selection and paste); the pointer does not cross outputs. 13. Seats. A wsdisplay with its own keyboard mux and mouse is a text seat already; several are multiseat with configuration only. Graphical sessions get theirs from a seat manager: seatd with a wscons backend (its FreeBSD one is the model), so libseat users (wlroots compositors such as sway and labwc) run unchanged; X keeps using the USL emulation. Needs item 6 and evdev. This settles the roadmap's open question for the seat manager in favour of seatd.

Where the console stops. The kernel console is the surface for booting, administration and emergencies: it must work in a panic and in ddb, and stay small. It provides independent screens per output, focus moved explicitly, selection and paste within a display, hotplug, and clean handover to graphics sessions. It does not arrange outputs into one desktop, move a pointer between them, draw windows or overlays, or shape text beyond rasops (complex scripts, emoji, ligatures): that is a compositor's work, and a rich text console belongs in user space (a terminal alone in a kiosk compositor, or a DRM console program such as Linux's kmscon). Linux went the same way: fbcon is being reduced, and its new in-kernel pieces (drm_log, drm_panic) are deliberately minimal.

After M9: candidates (not decided)

  • Small driver ports first, to shake out the compat layer and glue while cheap: vgem (GEM, dma-buf, fences; no hardware), vkms (vblank, page flips, writeback; no hardware), qxl (TTM in QEMU), cirrus-qemu; then build-only ports (vboxvideo, ast, mgag200, udl, gud); then vmwgfx, radeon, Intel. vgem and vkms also give CI a GPU-less display test bed. (vgem, vkms and ast are done.)
  • 3D in a VM (virgl through virtio-gpu, Mesa from the xsrc fork), then amdgpu on real hardware. The dma-buf and sync file ioctls, which Mesa's Vulkan window-system code needs, are done.
  • A perf-class profiler: one front end over tprof (PMC sampling), DTrace and lockstat, writing formats existing viewers read; kernel work for call chains in tprof samples, per-thread counting, and Linux TRACE_EVENTs as DTrace SDT probes (the compat layer makes them empty functions today; about 250 in DRM).

Cleanup (M7) — done

  • sys/modules/drmkms/Makefile matches files.drmkms (the stale drm_gem_cma_helper.c, drm_hdcp.c, drm_memory.c, drm_vm.c are gone; drm_display and drm_sched sources belong to their own modules), and drm_gem_vm.c is deleted. No generator: compare the module's SRCS with the drmkms/drmfb lines of files.drmkms after changing either.

Order

M0 first (done). Phase A, to compile (declarations; stubs fail cleanly): M1, M5, headers of M2–M4 and M6. Phase B, to run: M2 → M3 (needs M2) and M4 (independent), then M6. First driver: amdgpu (TTM, no shmem GEM, no apply_to_page_range). i915 needs i915_mm.c handled (replacement file or an apply_to_page_range built on the same inserts) and shmem; later.

Testing

  • M1, M4 (allocation, tables): rump on Linux and NetBSD.
  • M4 DMA: a real kernel (rump has no bus_dma and no physical addresses): the linux_mm_tester module, which loads drmkms_linux, run by t_linux_mm in the dev VM (also pages, struct page fields, vmap, ioremap).
  • M2, M3 need a real kernel (rump has no faulting pmap): a test kernel module exposing a Linux-file character device with vm_ops->fault and an ioctl that revokes and moves pages; an ATF test maps it, reads, revokes, checks the refault sees the new page, and covers fork, partial munmap, mremap, MAP_PRIVATE refusal, retry/NOPAGE. Runs in the dev VM.

Core changes (planned)

All deferred work, these included, is collected in the Backlog.

Policy: where the NetBSD core lacks something whose absence users would feel, aiBSD changes the core rather than living with a stub. Stubs may still be used to get code compiling first. Each item is scoped when reached; all are small, separate, tested and upstream-offerable.

  1. Cache aliasing (x86): done — M0 (per-page cache attributes, RAM-only direct map).
  2. Memory reclaim for Linux shrinkers — done: UVM reclaim hooks run by the page daemon (uvm/uvm_reclaim.c), shrinkers and list_lru on them, tested under real pressure (t_reclaim). Was: UVM's page daemon only drains pool(9) caches. Without a hook, TTM page pools and GEM caches never give memory back under pressure. Add a reclaim-hook interface to UVM's page daemon; register_shrinker uses it.
  3. userptr (mmu_interval_notifier, pin_user_pages): used by amdgpu/radeon userptr BOs (Vulkan external host memory, compute). Needs notification when a process's mapping changes — an MMU notifier interface in UVM — and page pinning on UVM.
  4. In-kernel eventfd signalling for DRM_IOCTL_SYNCOBJ_EVENTFD.
  5. pv tracking on more architectures — not needed: revocation works by mapping (M3), not by physical page.
  6. Runtime power management of GPUs (laptops: discrete GPU in D3cold when idle; Linux pm_runtime_*, PCI power states, ACPI power resources), and hybrid graphics (vga_switcheroo): NetBSD has neither framework. Fleshed out as a roadmap milestone (Roadmap: P1).
  7. HDMI/DisplayPort audio: DRM exposes it as a sub-device for the sound subsystem (platform_device, ELD); it needs a bridge to NetBSD's audio (hdaudio) — compat plus audio-side work.
  8. Bounce buffers for bus_dmamap_load_raw on x86: x86's raw load returns EINVAL ("XXX TBD bounce") when a segment lies beyond the tag's limit, so dma_map_sg fails for a device whose DMA mask is below the top of RAM (32-bit-only devices on large machines). Modern GPUs address 40+ bits and do not hit it; implement when one does (or with an IOMMU, item to scope then).
  9. Resizable BAR: amdgpu enlarges its VRAM BAR (pci_resize_resource) so the CPU can reach all of video memory; NetBSD's PCI code can read the capability but not resize a BAR or the bridge windows above it. Without it a GPU keeps the BAR size the firmware chose: all of VRAM when the firmware's resizable-BAR setting is on, 256 MiB otherwise, which costs performance (buffers must be moved into the window to be reached). Needs BAR and bridge-window reassignment in dev/pci; scope when the attach path runs on real hardware.
  10. A machine-independent DMA tag for system memory. Linux gives a device with no bus (a faux device) direct mapping: bus address = physical address. NetBSD has no MI way to ask for "system memory, no IOMMU": each port has its own tag (x86's pci_bus_dma_tag, arm's arm_generic_dma_tag), and linux_faux.c picks one with #ifdefs. An MI bus_dma call with an MD hook would serve this, bounce buffers, and IOMMU-backed tags later.

Other open questions

  1. Built-in kernels: autoconf matches before module init; the *_guarantee_initialized kludge must run initcalls (and so pci_register_driver) before match.
  2. Shared wait queues and kqueue (compat, not core): a wait queue carries one selinfo, so when several files poll the same queue only the first is notified; fix by letting a queue notify several.

Clone this wiki locally