On Thu, Sep 22, 2022, Ricardo Koller wrote: > The vm_create() helpers are hardcoded to place most page types (code, > page-tables, stacks, etc) in the same memslot #0, and always backed with > anonymous 4K. There are a couple of issues with that. First, tests > willing to differ a bit, like placing page-tables in a different backing > source type must replicate much of what's already done by the vm_create() > functions. Second, the hardcoded assumption of memslot #0 holding most > things is spread everywhere; this makes it very hard to change. > > Fix the above issues by having selftests specify how they want memory to be > laid out. Start by changing ____vm_create() to not create memslot #0; a > test (to come) will specify all memslots used by the VM. Then, add the > vm->memslots[] array to specify the right memslot for different memory > allocators, e.g.,: lib/elf should use the vm->[MEM_REGION_CODE] memslot. > This will be used as a way to specify the page-tables memslots (to be > backed by huge pages for example). > > There is no functional change intended. The current commit lays out memory > exactly as before. A future commit will change the allocators to get the > region they should be using, e.g.,: like the page table allocators using > the pt memslot. > > Cc: Sean Christopherson <seanjc@xxxxxxxxxx> > Cc: Andrew Jones <andrew.jones@xxxxxxxxx> > Signed-off-by: Ricardo Koller <ricarkol@xxxxxxxxxx> > Reviewed-by: Andrew Jones <andrew.jones@xxxxxxxxx> > --- Reviewed-by: Sean Christopherson <seanjc@xxxxxxxxxx>