#!/bin/sh
# DF-3900 trigger: leak 2MB MMIO KVA per i915 attach/detach cycle.
# Requires: real hardware with an Intel GPU, i915kms.ko loadable, run as root.
# Expected: each cycle permanently adds one iomap node (2MB KVA on gen5+).
# Observe with: vmstat -m | grep -i drm ; or watch KVA free shrink.
N=${1:-8}
i=0
while [ $i -lt $N ]; do
	kldload i915kms || { echo "load failed at cycle $i"; exit 1; }
	kldunload i915kms || { echo "unload failed at cycle $i"; exit 1; }
	i=$((i+1))
	echo "cycle $i done"
done
echo "after $N cycles, ~$((N*2))MB of KVA has been leaked permanently"
