unikraft / lib-musl

musl: A C standard library
Other
9 stars 29 forks source link

patches: Prefault page tables used in stacks allocated for threads #73

Closed eduardvintila closed 11 months ago

eduardvintila commented 1 year ago

We need to explicitly populate the page tables allocated for stacks (via mmap's MAP_POPULATE flag) in order to avoid infinite page fault loops during runtime. This measure is necessary since Unikraft on AArch64 does not switch stacks when handling CPU exceptions. A page fault occuring on the stack would cause the trap handler to save all the registers on the same stack, thus generating another page fault, ad infinitum.

This PR is part of a larger series which provides support for Golang on ARM64 platforms:

eduardvintila commented 11 months ago

@mogasergiu, thank you so much for the nice comment! :)

It's true, I completely agree it has a big impact on boot times - it was more of a quick fix to temporarily get the ARM64 Golang support rolling until we find a proper solution. But now your PR does a wonderful job to handle the problem described in this PR, I've just tested it and all works very smoothly 😎

Thanks a lot for the great work! Now, I hereby officially declare this PR obsolete! 🧑‍⚖️