On Tue, May 17, 2022 at 04:20:31PM -0400, Peter Xu wrote: > On Tue, May 17, 2022 at 07:05:24PM +0000, David Matlack wrote: > > +uint64_t perf_test_nested_pages(int nr_vcpus) > > +{ > > + /* > > + * 513 page tables to identity-map the L2 with 1G pages, plus a few > > + * pages per-vCPU for data structures such as the VMCS. > > + */ > > + return 513 + 10 * nr_vcpus; > > Shouldn't that 513 magic value be related to vm->max_gfn instead (rather > than assuming all hosts have 39 bits PA)? > > If my math is correct, it'll require 1GB here just for the l2->l1 pgtables > on a 5-level host to run this test nested. So I had a feeling we'd better > still consider >4 level hosts some day very soon.. No strong opinion, as > long as this test is not run by default. I had a feeling that when I said N level I actually meant N-1 level in all above, since 39 bits are for 3 level not 4 level?.. Then it's ~512GB pgtables on 5 level? If so I do think we'd better have a nicer way to do this identity mapping.. I don't think it's very hard - walk the mem regions in kvm_vm.regions should work for us? -- Peter Xu