[patch 0/7] x86/kvmclock: Remove memblock dependency and further cleanups

From: Thomas Gleixner
Date: Fri Jul 06 2018 - 12:23:36 EST


To allow early utilization of kvmclock it is required to remove the
memblock dependency. memblock is currently used to allocate the per
cpu data for kvmclock.

The first patch replaces the memblock with a static array sized 64bytes *
NR_CPUS and was posted by Pavel. That patch allocates everything statically
which is a waste when kvmclock is not used.

The rest of the series cleans up the code and converts it to per cpu
variables but does not put the kvmclock data into the per cpu area as that
has an issue vs. mapping the boot cpu data into the VDSO (leaks arbitrary
data, unless page sized).

The per cpu data consists of pointers to the actual data. For the boot cpu
a page sized array is statically allocated which can be mapped into the
VDSO. That array is used for initializing the first 64 CPU pointers. If
there are more CPUs the pvclock data is allocated during CPU bringup.

So this still will have some overhead when kvmclock is not in use, but
bringing it down to zero would be a massive trainwreck and even more
indirections.

Thanks,

tglx

8<--------------
a/arch/x86/include/asm/kvm_guest.h | 7
arch/x86/include/asm/kvm_para.h | 1
arch/x86/kernel/kvm.c | 14 -
arch/x86/kernel/kvmclock.c | 262 ++++++++++++++-----------------------
arch/x86/kernel/setup.c | 4
5 files changed, 105 insertions(+), 183 deletions(-)