Re: [PATCH v2] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged

From: Wanpeng Li
Date: Wed Jan 27 2021 - 02:30:26 EST


On Wed, 27 Jan 2021 at 01:26, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>
> On 26/01/21 02:28, Wanpeng Li wrote:
> > ping,
> > On Mon, 18 Jan 2021 at 17:08, Wanpeng Li <kernellwp@xxxxxxxxx> wrote:
> >>
> >> From: Wanpeng Li <wanpengli@xxxxxxxxxxx>
> >>
> >> The per-cpu vsyscall pvclock data pointer assigns either an element of the
> >> static array hv_clock_boot (#vCPU <= 64) or dynamically allocated memory
> >> hvclock_mem (vCPU > 64), the dynamically memory will not be allocated if
> >> kvmclock vsyscall is disabled, this can result in cpu hotpluged fails in
> >> kvmclock_setup_percpu() which returns -ENOMEM. This patch fixes it by not
> >> assigning vsyscall pvclock data pointer if kvmclock vdso_clock_mode is not
> >> VDSO_CLOCKMODE_PVCLOCK.
>
> I am sorry, I still cannot figure out this patch.
>
> Is hotplug still broken if kvm vsyscall is enabled?

Just when kvm vsyscall is disabled. :)

# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 88
On-line CPU(s) list: 0-63
Off-line CPU(s) list: 64-87

# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-5.10.0-rc3-tlinux2-0050+ root=/dev/mapper/cl-root
ro rd.lvm.lv=cl/root rhgb quiet console=ttyS0 LANG=en_US
.UTF-8 no-kvmclock-vsyscall

# echo 1 > /sys/devices/system/cpu/cpu76/online
-bash: echo: write error: Cannot allocate memory

Wanpeng