Skip to content

Add USERPTR capture harness#2

Merged
jserv merged 1 commit intomainfrom
userptr
May 7, 2026
Merged

Add USERPTR capture harness#2
jserv merged 1 commit intomainfrom
userptr

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented May 7, 2026

This introduces user/vpipe-capture-userptr.c, a V4L2 USERPTR ingress harness against vivid plus vb2_vmalloc. Two modes share a 4-buffer pool: noreset reuses the slot indefinitely and shows that vb2 caches the (userptr, length) pin per slot so re-QBUF skips GUP and per-frame minor faults stay at zero. reset allocates a fresh anonymous mapping before freeing the previous one so the kernel cannot reuse the VA, forces the cache to miss, and surfaces the full GUP slow-path cost as 75 minor faults per QBUF (== sizeimage / PAGE_SIZE on the validated guest).

Per-QBUF fault accounting wraps only the QBUF ioctl with getrusage RUSAGE_SELF deltas so other buffers' submissions in the same thread do not pollute the count. Each CSV row pairs a DQBUF with the matching QBUF that submitted it for both latency and fault delta.

scripts/bench_userptr.sh wraps bench_perf.sh with a reset/noreset allowlist on the mode argument. scripts/summarize-benchmark.py gains a phase_userptr mode with column validation, empty-CSV handling, non-numeric row diagnostics, and a warmup-row count derived from the distinct buffer indices observed in the CSV so the script stays in sync if the harness BUFFER_COUNT changes.

Change-Id: I537abe4bb0bb4d4e9615cc17d5bec28330da7c0f

This introduces user/vpipe-capture-userptr.c, a V4L2 USERPTR ingress
harness against vivid plus vb2_vmalloc. Two modes share a 4-buffer pool:
noreset reuses the slot indefinitely and shows that vb2 caches the
(userptr, length) pin per slot so re-QBUF skips GUP and per-frame minor
faults stay at zero. reset allocates a fresh anonymous mapping before
freeing the previous one so the kernel cannot reuse the VA, forces the
cache to miss, and surfaces the full GUP slow-path cost as 75 minor
faults per QBUF (== sizeimage / PAGE_SIZE on the validated guest).

Per-QBUF fault accounting wraps only the QBUF ioctl with getrusage
RUSAGE_SELF deltas so other buffers' submissions in the same thread do
not pollute the count. Each CSV row pairs a DQBUF with the matching QBUF
that submitted it for both latency and fault delta.

scripts/bench_userptr.sh wraps bench_perf.sh with a reset/noreset
allowlist on the mode argument. scripts/summarize-benchmark.py gains
a phase_userptr mode with column validation, empty-CSV handling,
non-numeric row diagnostics, and a warmup-row count derived from the
distinct buffer indices observed in the CSV so the script stays in sync
if the harness BUFFER_COUNT changes.

Change-Id: I537abe4bb0bb4d4e9615cc17d5bec28330da7c0f
@jserv jserv merged commit 2562f6f into main May 7, 2026
3 checks passed
@jserv jserv deleted the userptr branch May 7, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant