-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support #1513
base: master
Are you sure you want to change the base?
[LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support #1513
Commits on Aug 15, 2024
-
[LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
The initial implementation of EDMM support pre-accepted every mmapped region of enclave pages. However in some cases, applications (e.g., Java runtime) may rely on lazy allocation of pages (default on Linux), where the VMAs are reserved but not actually committed to physical memory. In particular, `mmap(..., MAP_NORESERVE)` requests are often used in such cases -- to mmap a huge chunk of memory (possibly never used in the future) at once and then commit pages on demand on page fault events. Due to the lack of lazy allocation concept in Gramine, this incurred performance and physical memory overhead on allocating and accepting the whole range of enclave pages. The commit adds the lazy allocation support by deferring page accepts to page-fault events when Gramine notices `MAP_NORESERVE` flag in the mmap request. It also introduces a two-level bitvector into PAL indicating the commit status of each enclave page and an upcall from the SGX EDMM backend into the LibOS to ask for additional info on a particular page. Further, since the checkpointing decisions are purely done by LibOS, for correct and fast handover of `MAP_NORESERVE` enclave pages, we now introduce a new PAL API to let LibOS learn the enclave page tracker state in PAL. Another new PAL API is also added for `madvise(MADV_DONTNEED)` where we need to free the pages then move them to the "lazy-alloc-on-access" status. Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for 9b3b3de - Browse repository at this point
Copy the full SHA 9b3b3deView commit details -
squash! [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
!TODO: use below commit msg: [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support The initial implementation of EDMM support pre-accepted every mmapped region of enclave pages. However in some cases, applications (e.g., Java runtime) may rely on lazy allocation of pages (default on Linux), where the VMAs are reserved but not actually committed to physical memory. In particular, `mmap(..., MAP_NORESERVE)` requests are often used in such cases -- to mmap a huge chunk of memory (possibly never used in the future) at once and then commit pages on demand on page fault events. Due to the lack of lazy allocation concept in Gramine, this incurred performance and physical memory overhead on allocating and accepting the whole range of enclave pages. The commit adds the lazy allocation support by deferring page accepts to page-fault events when Gramine notices `MAP_NORESERVE` flag in the mmap request. It also introduces a two-level bitvector into PAL indicating the commit status of each enclave page and an upcall from the SGX EDMM backend into the LibOS to ask for additional info on a particular page. Further, since the checkpointing decisions are purely done by LibOS, for correct and fast handover of `MAP_NORESERVE` enclave pages, we now introduce a new PAL API to let LibOS learn the enclave page tracker state in PAL. Another new PAL API is also added for `madvise(MADV_DONTNEED)` where we need to free the pages then move them to the "lazy-alloc-on-access" status. However it is currently not used due to data races in the SGX driver. Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for 1021492 - Browse repository at this point
Copy the full SHA 1021492View commit details -
fixup! [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for 9ea3516 - Browse repository at this point
Copy the full SHA 9ea3516View commit details -
fixup! [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for 1c42e7d - Browse repository at this point
Copy the full SHA 1c42e7dView commit details
Commits on Aug 19, 2024
-
squash! [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
!TODO: use below commit msg: [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support The initial implementation of EDMM support pre-accepted every mmapped region of enclave pages. However in some cases, applications (e.g., Java runtime) may rely on lazy allocation of pages (default on Linux), where the VMAs are reserved but not actually committed to physical memory. In particular, `mmap(..., MAP_NORESERVE)` requests are often used in such cases -- to mmap a huge chunk of memory (possibly never used in the future) at once and then commit pages on demand on page fault events. Due to the lack of lazy allocation concept in Gramine, this incurred performance and physical memory overhead on allocating and accepting the whole range of enclave pages. The commit adds the lazy allocation support by deferring page accepts to page-fault events when Gramine notices `MAP_NORESERVE` flag in the mmap request. It also introduces a two-level bitvector into PAL indicating the commit status of each enclave page and an upcall from the SGX EDMM backend into the LibOS to ask for additional info on a particular page. Further, since the checkpointing decisions are purely done by LibOS, for correct and fast handover of `MAP_NORESERVE` enclave pages, we now introduce a new PAL API (`PalGetLazyCommitPages()`) to let LibOS learn the enclave page tracker state in PAL. Another new PAL API (`PalFreeThenLazyReallocCommittedPages()`) is added for `madvise(MADV_DONTNEED)` where we need to free the pages then move them to the "lazy-alloc-on-access" status. Due to data races in the SGX driver, the modification to `madvise(MADV_DONTNEED)` is currently inactive (i.e., it is still emulated by zero-filling the committed pages), and a temporary workaround is implemented in the lazy allocation flow to handle the corner case of a benign spurious #PF on a non-present page during EACCEPT. Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for a61e915 - Browse repository at this point
Copy the full SHA a61e915View commit details
Commits on Aug 20, 2024
-
fixup! [LibOS,PAL/Linux-SGX] Add EDMM lazy allocation support
Signed-off-by: Kailun Qin <kailun.qin@intel.com>
Configuration menu - View commit details
-
Copy full SHA for 6eb63b1 - Browse repository at this point
Copy the full SHA 6eb63b1View commit details