Add 64K page size support for ARM64#12656
Conversation
pkg/hostarch/hostarch_arm64_64k.go
Outdated
| @@ -0,0 +1,37 @@ | |||
| // Copyright 2019 The gVisor Authors. | |||
There was a problem hiding this comment.
nit: Update copyright to 2026 for the brand new files
| // PageSize is the system page size. | ||
| // arm64 support 4K/16K/64K page size, | ||
| // which can be get by unix.Getpagesize(). | ||
| // Currently, only 4K page size is supported. |
There was a problem hiding this comment.
Currently, only 4K page size is supported by default, or 64k pages by using the pagesize_64k build tag.
|
I think it's too early to add the "Fixes #8196" tag since both KVM and Systrap don't work. In line with this, can you add checks against expected hostarch.PageSize in the New() constructors for both KVM and Systrap so that they fail to start. Otherwise, generally LGTM. |
67f45e2 to
41187f7
Compare
Fixed. |
This adds support for running gVisor on ARM64 systems with 64K page size (e.g., NVIDIA Grace CPU). Key changes: 1. hostarch: Split page size constants into separate files selected by the `pagesize_64k` build tag. 64K pages use PageShift=16 and HugePageShift=29 (512MB huge pages). Remove uint16 from the bytecount interface since 64K (2^16) cannot be represented by uint16. 2. ring0: Move page table layout constants to page-size-specific files. 64K pages use larger page table entries (64K per table) and skip the PUD level. 3. ring0/pagetables: Add 3-level page table walker for 64K pages (PGD→PMD→PTE, no PUD). Each level indexes 8192 entries (13 bits) with 512MB sect pages at the PMD level. 4. sentry/arch: Fix mmap layout constants that overflowed the 48-bit address space with 64K pages. Use fixed values for maxMmapRand64 (1<<45 = 32TB) and minMmapRand64 (1<<30 = 1GB), and compute maxStackRand64 using hostarch.PageShift. 5. Bazel build system: Add `--define=pagesize=64k` support that propagates the `pagesize_64k` Go build tag to all binaries and tests. Build with `bazel build --define=pagesize=64k //runsc:runsc` to enable. Note: Currently only the ptrace platform is supported for 64K pages. KVM and systrap platforms require additional work. Updates google#8196
- Update copyright year to 2026 for all new files - Update comment in hostarch_arm64.go to mention 64K page support via pagesize_64k build tag - Add PageSize checks in KVM and Systrap New() constructors to fail early on non-4K page sizes
41187f7 to
fbcb90d
Compare
|
One more thing, can you give a test run of at least these targets on a 64k ARM instance: We don't have any CI runners configured for it currently. |
I ran the ptrace syscall tests on a 64K ARM64 machine (NVIDIA Grace CPU): Failure breakdown:
|
This adds support for running gVisor on ARM64 systems with 64K page size (e.g., NVIDIA Grace CPU).
Key changes:
hostarch: Split page size constants into separate files selected by the
pagesize_64kbuild tag. 64K pages use PageShift=16 and HugePageShift=29 (512MB huge pages). Remove uint16 from the bytecount interface since 64K (2^16) cannot be represented by uint16.ring0: Move page table layout constants to page-size-specific files. 64K pages use larger page table entries (64K per table) and skip the PUD level.
ring0/pagetables: Add 3-level page table walker for 64K pages (PGD→PMD→PTE, no PUD). Each level indexes 8192 entries (13 bits) with 512MB sect pages at the PMD level.
sentry/arch: Fix mmap layout constants that overflowed the 48-bit address space with 64K pages. Use fixed values for maxMmapRand64 (1<<45 = 32TB) and minMmapRand64 (1<<30 = 1GB), and compute maxStackRand64 using hostarch.PageShift.
Bazel build system: Add
--define=pagesize=64ksupport that propagates thepagesize_64kGo build tag to all binaries and tests.Build with
bazel build --define=pagesize=64k //runsc:runscto enable.Note: Currently only the ptrace platform is supported for 64K pages. KVM and systrap platforms require additional work.
Updates #8196