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

From: Paolo Bonzini
Date: Fri Jul 06 2018 - 13:47:37 EST


On 06/07/2018 18:13, Thomas Gleixner wrote:
> 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(-)
>
>
>
>

Thanks, this is really nice. With the small changes from my review,

Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>

Paolo