An MMU notifier failure often does not end in one callback. A driver may miss an invalidation and submit an old PFN much later, or validate the sequence correctly but deadlock in a callback wait. Investigation therefore needs three time lines: CPU page-table events, notifier callbacks, and device mapping submission/revocation.
This concluding article begins with fault classification and observation, then provides source-reading guidance, API reference tables, and the final implementation checklist. Interface details follow current Linux mainline and should be reconciled with the selected kernel version when applied to a concrete driver.
8.1 Triage and Entry Points
MMU notifier failures can be grouped by their visible symptom.
Table 8.1.1. MMU notifier problem classes
| Symptom | Possible cause | First observation point |
|---|---|---|
| Device accesses a freed page, data corruption, or DMA isolation error | Incomplete hardware stop, DMA unmapped too early, missed invalidation | Callback, device PTE/MTT, DMA mapping |
| Frequent retry after GPU/NIC fault | Rapid sequence changes, oversized acquisition range, concurrent unmap | Invalidation count, -EBUSY, retry ratio |
| System stall or lockdep report | Lock order, removal self-lock, reclaim waiting for callback | Callback stack, mmap lock, driver lock, resv |
| Old permission or PFN remains after update | Wrong event handling or missed page-level permission change | range->event, VMA/PTE permissions, owner |
| Callback never runs | Range not covered, insertion failed, or object already removed | mm, range, interval tree, registration result |
Start by asking whether the event reached the subscriber. If it did not, inspect subscription lifetime and range coverage. If it arrived but hardware did not stop, inspect callback synchronization. Only after event and sequence are correct should the final submission window be examined.

Figure 8.1.1. MMU notifier fault triage
8.2 Three Required Time Lines
A minimal trace must answer when CPU state changed, when the subscriber completed invalidation, and when the device submitted or revoked a mapping.
8.2.1 CPU Page-Table Timeline
For every range start/end, record:
- a comparable
mmor process identifier; [start, end);event;BLOCKABLE;owner;- return value, start time, and end time.
Tracepoints, ftrace, temporary Kprobe/eBPF probes, or a driver trace event can provide this data. High-frequency printk alone can alter timing and lock behavior.
8.2.2 Driver Invalidation Timeline
In the callback, record:
- the notifier object and registered interval;
- the event/range intersection;
cur_seqand the previous interval sequence;- device-stop start and completion;
- PTE/MTT clearing, TLB invalidation, and DMA-unmap order;
- callback result.
The full interval and event range are useful for diagnosing partial overlap, off-by-page calculations, and end-point errors.
8.2.3 Device Mapping Timeline
Record in the page-acquisition and submission path:
- the sequence returned by
read_begin(); - HMM/fault return values;
- times for DMA and GPU/IOMMU/MTT updates;
read_retry()result;- whether the update lock remained held through final submission;
- the rollback range after failure.
Together, these time lines identify whether the stale mapping came from a missed callback, incomplete hardware stop, missing sequence update, early unlock, or incomplete rollback.
8.3 Debugging Tools and Constraints
8.3.1 lockdep
lockdep checks ordering among notifier callbacks, mmap locks, driver locks, DMA reservations, and fence waits. Focus on:
- remove/unregister holding a lock required by the callback;
- fence-signaling code acquiring a driver lock while an invalidation waits for that fence;
- ordinary allocation entering reclaim from a callback or mmap path;
- HMM acquisition forming a reverse order with device update or queue locks;
- notifier core’s synthetic
lockdep_mapspanning an unpaired start/end region.
A report normally identifies a driver lock hierarchy problem rather than an error in notifier design.
8.3.2 KASAN and Page Isolation
KASAN is effective for notifier-object, range, and context use-after-free bugs, including:
- freeing an embedded notifier before remove returns;
- destroying a range tree or DMA array while a callback runs;
- deleting a range during
UNMAPwhile a fault worker retains a raw pointer; - releasing temporary PFN/DMA storage before
-EBUSYretry cleanup completes.
Hardware access to a freed page may instead appear as an IOMMU/GPU fault or silent corruption. Correlate KASAN with IOMMU/GPU logs, reset reports, and event traces.
8.3.3 Tracepoint, Kprobe, and BPF
Use stable tracepoints for supported interfaces and Kprobe/eBPF for temporary internal checks. Group events by notifier identity and record a monotonic timestamp and CPU. Function names alone are insufficient; range, sequence, lock state, and result are needed to prove ordering.
Use the smallest useful reproducer, such as a single 4 KiB or 2 MiB userptr, and alternate:
GPU/RDMA read and write
munmap / mprotect
swap / NUMA migration
fault and remap
process exit and remove
Small, fixed ranges make it easier to correlate a CPU invalidation range with a device fault address.
8.4 Key Metrics
Performance counters do not replace correctness, but they locate pressure in a working implementation.
Table 8.4.1. Key MMU notifier metrics
| Metric | Meaning | Abnormal signal |
|---|---|---|
| Invalidation count | CPU changes that overlap a subscription | Frequent small changes or an oversized notifier |
| Range-size distribution | Address extent revoked per callback | A few events clearing many unrelated mappings |
| Callback duration | Stop, TLB, and DMA-release time | Serial waits or slow device fences |
-EBUSY ratio | HMM/page-walk retry rate | Concurrent invalidation, migration, or fault pressure |
read_retry failure rate | Sequence changes before submission | Long acquisition window or oversized range |
| Blockable-failure rate | Non-blocking callbacks that could not finish | Poor non-blocking retry policy |
| Fence/queue stop time | Hardware stop latency | Long-running queues lack preemption/eviction |
| DMA-unmap count | Number of mappings removed | Duplicate mappings or incorrect range calculation |
Record percentiles and group by event. Averages hide the long tail caused by fence waits and large TLB flushes.
Performance work must not trade away safety. Merging adjacent PTE/TLB operations or prefetching pages can improve latency, but actual hardware revocation cannot be deferred merely to shorten callback duration.

Figure 8.4.1. MMU notifier metrics and bottleneck diagnosis
8.5 Source-Reading Order
Fix the kernel version first, then read in the order: public contract, notifier core, mm call sites, HMM, and device drivers.
Table 8.5.1. Source-reading path
| Stage | File or object | Focus |
|---|---|---|
| Public interface | include/linux/mmu_notifier.h | Range, events, callback tables, registration/removal, sequence APIs |
| Per-mm container | mm/mmu_notifier.c | subscriptions, list/interval tree, start/end, deferred updates |
| mm call sites | mm/memory.c, mm/mmap.c, mm/mprotect.c, migration files | Event construction and start/end boundaries |
| HMM | include/linux/hmm.h, mm/hmm.c | hmm_range, PFN flags, page walk, remote fault |
| KVM | virt/kvm/ and architecture-specific KVM MMU code | HVA→GFN, SPTE clearing, vCPU invalidation sequence |
| GPU | amdgpu/KFD/Nouveau/Xe | Queue stop, GPU PTE, DMA mapping, fault recovery |
| RDMA | drivers/infiniband/core/umem_odp.c and hardware drivers | MTT, ODP fault, hardware-cache invalidation |
| IOMMU/VFIO | IOMMU and VFIO mapping paths | DMA lifetime, IOMMU TLB, user mapping management |
A minimal review asks:
- Where is the subscription object created, registered, and owned?
- Which lock protects the callback, and is it also the final submission lock?
- Which hardware states stop first, and which DMA mappings are released last?
- Does event handling distinguish
UNMAP,MIGRATE, andPROTECTION? - Does mapping construction execute
read_begin/read_retry? - Does the failure path release partial submissions?
- Do remove/unregister and object destruction satisfy the callback-termination order?
8.6 API and Structure Reference
The final reference lists the most common interfaces. Use the selected kernel’s headers for complete signatures and version differences.
Table 8.6.1. Registration, invalidation, and sequence APIs
| API | Purpose | Constraint |
|---|---|---|
mmu_notifier_register() | Register a whole-mm traditional notifier | Initial container creation may need mmap write lock |
mmu_notifier_unregister() | Remove a traditional notifier | Waits for callbacks; do not hold a callback lock |
mmu_interval_notifier_insert() | Insert a range subscription | Tree update can be deferred during invalidation |
mmu_interval_notifier_remove() | Remove a range subscription | No callback after successful return |
mmu_interval_read_begin() | Begin a sequence read | May wait while the interval is invalidating |
mmu_interval_set_seq() | Save cur_seq in invalidation | Use the same lock as final checking |
mmu_interval_check_retry() | Early lock-free check | A false result is not a submission guarantee |
mmu_interval_read_retry() | Final pre-submission check | Use the same lock as invalidate |
hmm_range_fault() | Walk and, if requested, populate CPU page-table state | Hold mmap read lock; retry -EBUSY |
Table 8.6.2. Core structures
| Structure | Core fields | Purpose |
|---|---|---|
struct mmu_notifier_range | mm, start/end, event, flags, owner | One CPU page-table change |
struct mmu_notifier | hlist, ops, mm | Whole-address-space subscription |
struct mmu_interval_notifier | interval_tree, ops, mm, invalidate_seq | Range subscription with read-side retry |
struct mmu_notifier_subscriptions | list, itree, invalidate_seq, wq, deferred_list | Per-mm subscription and invalidation state |
struct hmm_range | notifier, notifier_seq, start/end, hmm_pfns, flags, owner | HMM query input and PFN output |

Figure 8.6.1. MMU notifier APIs and object relations
8.7 Series Summary
MMU notifier handles a derived-mapping consistency problem. CPU mm owns the authoritative user address space; KVM, GPU, RDMA, and IOMMU users retain mappings derived from it. On a CPU page-table change, devices stop access and revoke derived state before CPU pages can be released or migrated.
The series has three levels:
Table 8.7.1. Series content map
| Level | Articles | Central question |
|---|---|---|
| Events and models | Articles 1–2 | Why mappings invalidate; how events and subscriptions express invalidation |
| Synchronization and implementation | Articles 3–4 | How sequences protect submission and how mm manages and dispatches subscriptions |
| Use and engineering practice | Articles 5–8 | HMM/device faults, applications, driver constraints, debugging, and reference |
The implementation loop is:
subscription covers the mapping lifetime
→ callback follows BLOCKABLE rules
→ hardware stops and old mapping is revoked
→ HMM/fault acquisition uses the sequence protocol
→ the same lock validates and submits the new mapping
→ the failure path performs complete rollback
The key is not any single API. Event, sequence, lock, and hardware state must all be correct. If one is missing, the driver may look correct in software while the device still holds an old address or permission.