linux-stable/arch
Sean Christopherson c3941d9e0c KVM: lapic: Allow user to disable adaptive tuning of timer advancement
The introduction of adaptive tuning of lapic timer advancement did not
allow for the scenario where userspace would want to disable adaptive
tuning but still employ timer advancement, e.g. for testing purposes or
to handle a use case where adaptive tuning is unable to settle on a
suitable time.  This is epecially pertinent now that KVM places a hard
threshold on the maximum advancment time.

Rework the timer semantics to accept signed values, with a value of '-1'
being interpreted as "use adaptive tuning with KVM's internal default",
and any other value being used as an explicit advancement time, e.g. a
time of '0' effectively disables advancement.

Note, this does not completely restore the original behavior of
lapic_timer_advance_ns.  Prior to tracking the advancement per vCPU,
which is necessary to support autotuning, userspace could adjust
lapic_timer_advance_ns for *running* vCPU.  With per-vCPU tracking, the
module params are snapshotted at vCPU creation, i.e. applying a new
advancement effectively requires restarting a VM.

Dynamically updating a running vCPU is possible, e.g. a helper could be
added to retrieve the desired delay, choosing between the global module
param and the per-VCPU value depending on whether or not auto-tuning is
(globally) enabled, but introduces a great deal of complexity.  The
wrapper itself is not complex, but understanding and documenting the
effects of dynamically toggling auto-tuning and/or adjusting the timer
advancement is nigh impossible since the behavior would be dependent on
KVM's implementation as well as compiler optimizations.  In other words,
providing stable behavior would require extremely careful consideration
now and in the future.

Given that the expected use of a manually-tuned timer advancement is to
"tune once, run many", use the vastly simpler approach of recognizing
changes to the module params only when creating a new vCPU.

Cc: Liran Alon <liran.alon@oracle.com>
Cc: Wanpeng Li <wanpengli@tencent.com>
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Cc: stable@vger.kernel.org
Fixes: 3b8a5df6c4 ("KVM: LAPIC: Tune lapic_timer_advance_ns automatically")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-04-18 18:56:15 +02:00
..
alpha KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
arc syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
arm ARM: SoC fixes 2019-04-07 13:46:17 -10:00
arm64 ARM: SoC fixes 2019-04-07 13:46:17 -10:00
c6x syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
csky syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
h8300 syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
hexagon syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
ia64 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
m68k KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
microblaze syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
mips A few minor MIPS fixes: 2019-04-09 16:27:18 -10:00
nds32 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
nios2 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
openrisc syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
parisc parisc: Detect QEMU earlier in boot process 2019-04-06 19:07:55 +02:00
powerpc KVM/PPC fixes for 5.1 2019-04-18 18:53:12 +02:00
riscv Andy Lutomirski approached me to tell me that the syscall_get_arguments() 2019-04-05 13:15:57 -10:00
s390 syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
sh Merge branch 'akpm' (patches from Andrew) 2019-04-05 17:08:55 -10:00
sparc syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
um syscalls: Remove start and number from syscall_set_arguments() args 2019-04-05 09:27:23 -04:00
unicore32 KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported 2019-03-28 17:27:42 +01:00
x86 KVM: lapic: Allow user to disable adaptive tuning of timer advancement 2019-04-18 18:56:15 +02:00
xtensa xtensa fixes for v5.1-rc5 2019-04-08 17:04:42 -10:00
.gitignore
Kconfig Char/Misc driver patches for 5.1-rc1 2019-03-06 14:18:59 -08:00