Skip to content

LATX, opt: Check guest permissions before mixed host-page fallback - #520

Merged
LaurenIsACoder merged 1 commit into
lat-opensource:masterfrom
LaurenIsACoder:lauren/16k-check-permission-first
Oct 21, 2026
Merged

LaurenIsACoder merged 1 commit into
lat-opensource:masterfrom
LaurenIsACoder:lauren/16k-check-permission-first

Conversation

@LaurenIsACoder

Copy link
Copy Markdown
Contributor

For i386 guests on 16KB hosts, the enabled page-permission check consults host-page mixing before proving that a guest access is allowed. Check cached guest permissions at both access endpoints first, allowing successful accesses to bypass the mixed-page lookup.

The fallback retains separate endpoint permissions, software faults for mixed host pages, hardware checks for unmixed pages, and the first inaccessible fault address. LATX_MT=2 retains its existing check behavior. The change adds no permission cache, application-specific condition, or assumption that repeated executions of an instruction use the same address.

Validation on a LoongArch 16KB-page host, against master 2cb2276faafd736a862560fee22e54d1d9e7d262:

  • i386 O1 build and complete meson test -C build32 --suite lat-pr-fast --print-errorlogs --num-processes 1: 38/38 passed, no skips.
  • 50/50 local permission cases and 6/6 forced atomic-fallback cases passed. Checks cover cross-page faults, changed effective addresses, changed protections, signal PC/SP/address, and forced atomic fallback. Test fixtures are not included in this PR.
  • Previously recorded 12 interleaved microbenchmark pairs with LATX_AOT=0 LATX_MT=1: median paired loop-time reductions of 27.3% for ordinary valid accesses and 38.5% for valid accesses in mixed host pages. These are synthetic results, not application speedup claims.

This remains a performance candidate: representative application benefit has not been established.

For i386 on 16K hosts, first prove that the current access has the
required cached guest permission at both endpoints. Successful accesses
can then bypass the mixed host-page lookup.

Keep each endpoint's permission for the fallback. A denied permission
still faults in software only on a mixed host page; unmixed pages retain
the hardware permission check. Preserve the first inaccessible address
and the LATX_MT=2 path.

Signed-off-by: Hanlu Li <[email protected]>
@LaurenIsACoder
LaurenIsACoder marked this pull request as ready for review October 21, 2026 08:55
@LaurenIsACoder
LaurenIsACoder merged commit 48a9c55 into lat-opensource:master Oct 21, 2026
15 checks passed
@LaurenIsACoder
LaurenIsACoder deleted the lauren/16k-check-permission-first branch October 21, 2026 09:25
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