Skip to content

Add UFFD tests to current implementation#1415

Merged
ValentaTomas merged 6 commits into
mainfrom
uffd-tests
Nov 4, 2025
Merged

Add UFFD tests to current implementation#1415
ValentaTomas merged 6 commits into
mainfrom
uffd-tests

Conversation

@ValentaTomas
Copy link
Copy Markdown
Member

@ValentaTomas ValentaTomas commented Oct 29, 2025

Note

Add UFFD missing-page read/write tests and utilities, and update Serve/handler to track in-flight pagefaults via a shared sync.Map.

  • UFFD Serving:
    • Refactor Serve to accept missingRequests *sync.Map and use it to dedupe in-flight MISSING pagefaults (replacing a local map).
    • Wire missingRequests from Uffd.handle when invoking Serve.
  • Tests & Utilities:
    • Add helpers_test.go to spin up UFFD, map memory, and run read/write operations against a MemorySlicer.
    • Add missing_test.go and missing_write_test.go covering 4k/hugepage MISSING faults, serial/parallel runs, and prefault scenarios.
    • Introduce test utilities: testutils/ (random data, page mmap helpers, test logger, byte diff) and minimal userfaultfd syscall wrappers (open/configure/register/copy/close) for tests.

Written by Cursor Bugbot for commit e2b11e6. This will update automatically on new commits. Configure here.

@ValentaTomas
Copy link
Copy Markdown
Member Author

Currently resolving why there is a freeze during some tests—https://github.com/e2b-dev/infra/tree/uffd-freeze

@ValentaTomas ValentaTomas marked this pull request as ready for review November 3, 2025 23:41
cursor[bot]

This comment was marked as outdated.


u.readyCh <- struct{}{}

missingRequests := &sync.Map{}
Copy link
Copy Markdown
Member Author

@ValentaTomas ValentaTomas Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switch to a thread safe map was needed because of the tests, but we would switch to a thread safe solution in later PRs still.

cursor[bot]

This comment was marked as outdated.

@ValentaTomas ValentaTomas merged commit 88c3960 into main Nov 4, 2025
27 checks passed
@ValentaTomas ValentaTomas deleted the uffd-tests branch November 4, 2025 00:30
ValentaTomas added a commit that referenced this pull request May 2, 2026
…MissingWriteWithPrefault loads to 1_000_000

Continues the regression sweep started in 4681ab2. The original
PR #1415 (88c3960, Nov 3 2025) introduced these tests at 1_000_000
operations. PR #1450 (6ee2ebb, Nov 7 2025, "Modify UFFD tests to
run serve loop in a separate process") cut them all to 10_000 in the
same commit that switched from in-process to cross-process tests, with
no commit message justification. The cross-process refactor itself
does not require lower iteration counts: the per-iteration work is
still in-process memory access; only the page-state snapshot RPC is
cross-process and is called once per test.

Reverts:
  - TestSerialMissing:                10_000 -> 1_000_000
  - TestSerialMissingWrite:           10_000 -> 1_000_000
  - TestParallelMissingWriteWithPrefault: 10_000 -> 1_000_000

Per-test wall time on this branch (sudo go test, no -race):
  - TestSerialMissing                  ~3s
  - TestSerialMissingWrite             ~3s
  - TestParallelMissingWriteWithPrefault ~2s

TestParallelMissingWithPrefault stays at 10_000: it was only ever
parallelOperations := 10 in #1415, then bumped to 10_000 in #1450,
so 10_000 is already above its historical baseline.
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.

2 participants