Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <vitaly.prosyak@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Subject: [PATCH v1 0/1] tests/amdgpu: fix userptr PTE invalidation stress test
Date: Wed, 12 Aug 2026 20:46:03 -0400	[thread overview]
Message-ID: <cover.1786581212.git.vitaly.prosyak@amd.com> (raw)

From: Vitaly Prosyak <vitaly.prosyak@amd.com>

The amd_userptr_invalidation stress subtest used fork(2048) to create
memory pressure, which fails in CI containers governed by a cgroup v2
pids controller (EAGAIN on fork), causing false FAIL on all ASICs.

More critically, the test had a logic error: aggressive mmap-based
memory pressure recycled the original 0xAA physical pages before the
GPU read them, masking PTE invalidation failures on unpatched kernels
and turning the test into a false PASS on both good and bad kernels.

This series fixes both problems:

  - Replace fork()-based pressure with pipe fd pressure only (no mmap).
    Pipe pairs consume file descriptors without physical page recycling,
    so the original 0xAA pages remain resident after munmap().

  - Without page recycling, an unpatched kernel that leaves GPU PTEs
    stale after munmap() will have the SDMA engine read the original
    0xAA data through the stale mappings, triggering the FAIL assertion:
      "destination contains N bytes of original data (0xAA)"

  - A patched kernel fires the MMU notifier on munmap(), invalidates the
    GPU PTEs, and the SDMA engine reads from the dummy zero page instead,
    so original_count == 0 and the test passes in ~1 second.

Tested on:
  - GFX1200 (Navi 48, kernel 7.1.0+, patched):   PASS in 0.93s
  - GFX1102 (Navi 33, kernel 6.18.0+, unpatched): FAIL in 13.2s
    (destination contained original 0xAA pattern, indicating GPU PTEs
     were not flushed after munmap())

Vitaly Prosyak (1):
  tests/amdgpu: replace fork-based memory pressure with mmap in userptr
    stress test

 tests/amdgpu/amd_userptr_invalidation.c | 32 +++----------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

-- 
2.54.0


             reply	other threads:[~2026-08-13  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  0:46 vitaly.prosyak [this message]
2026-08-13  0:46 ` [PATCH v1 1/1] tests/amdgpu: replace fork-based memory pressure with mmap in userptr stress test vitaly.prosyak
2026-08-13  1:31   ` Zhang, Jesse(Jie)
2026-08-13  1:40 ` ✓ Xe.CI.BAT: success for tests/amdgpu: fix userptr PTE invalidation " Patchwork
2026-08-13  1:51 ` ✓ i915.CI.BAT: " Patchwork
2026-08-13  6:27 ` ✗ i915.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1786581212.git.vitaly.prosyak@amd.com \
    --to=vitaly.prosyak@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox