On 10/23/2024 10:00 PM, Borislav Petkov wrote: > On Wed, Oct 09, 2024 at 11:22:58PM +0530, Neeraj Upadhyay wrote: >> I will start with 4K. For later, I will get the performance numbers to propose >> a change in allocation scheme - for ex, allocating a bigger contiguous >> batch from the total allocation required for backing pages (num_possible_cpus() * 4K) >> without doing 2M reservation. > > Why does performance matter here if you're going to allocate simply a 4K page > per vCPU and set them all up in the APIC setup path? And then you can do the > page conversion to guest-owned as part of the guest vCPU init path? > Please let me know if I didn't understand your questions correctly. The performance concerns here are w.r.t. these backing page allocations being part of a single hugepage. Grouping of allocation together allows these pages to be part of the same 2M NPT and RMP table entry, which can provide better performance compared to having separate 4K entries for each backing page. For example, to send IPI to target CPUs, ->send_IPI callback (executing on source CPU) in Secure AVIC driver writes to the backing page of target CPU. Having these backing pages as part of the single 2M entry could provide better caching of the translation and require single entry in TLB at the source CPU. - Neeraj