Re: [PATCH v6 5/5] x86/kvm: Avoid dynamic allocation of pvclock data when SEV is active

From: Brijesh Singh
Date: Mon Sep 10 2018 - 11:10:18 EST




On 09/10/2018 08:29 AM, Sean Christopherson wrote:
...

+ */
+static struct pvclock_vsyscall_time_info
+ hv_clock_aux[NR_CPUS] __decrypted_aux;
Hmm, so worst case that's 64 4K pages:

(8192*32)/4096 = 64 4K pages.
We can minimize the worst case memory usage. The number of VCPUs
supported by KVM maybe less than NR_CPUS. e.g Currently KVM_MAX_VCPUS is
set to 288

KVM_MAX_VCPUS is a property of the host, whereas this code runs in the
guest, e.g.ÂKVM_MAX_VCPUS could be 2048 in the host for all we know.



IIRC, during guest creation time qemu will check the host supported
VCPUS count. If count is greater than KVM_MAX_VCPUS then it will
fail to launch guest (or fail to hot plug vcpus). In other words, the
number of vcpus in a KVM guest will never to > KVM_MAX_VCPUS.

Am I missing something ?