linux_dsm_epyc7002/arch/arm64/include/asm
Paolo Bonzini f781951299 kvm: add halt_poll_ns module parameter
This patch introduces a new module parameter for the KVM module; when it
is present, KVM attempts a bit of polling on every HLT before scheduling
itself out via kvm_vcpu_block.

This parameter helps a lot for latency-bound workloads---in particular
I tested it with O_DSYNC writes with a battery-backed disk in the host.
In this case, writes are fast (because the data doesn't have to go all
the way to the platters) but they cannot be merged by either the host or
the guest.  KVM's performance here is usually around 30% of bare metal,
or 50% if you use cache=directsync or cache=writethrough (these
parameters avoid that the guest sends pointless flush requests, and
at the same time they are not slow because of the battery-backed cache).
The bad performance happens because on every halt the host CPU decides
to halt itself too.  When the interrupt comes, the vCPU thread is then
migrated to a new physical CPU, and in general the latency is horrible
because the vCPU thread has to be scheduled back in.

With this patch performance reaches 60-65% of bare metal and, more
important, 99% of what you get if you use idle=poll in the guest.  This
means that the tunable gets rid of this particular bottleneck, and more
work can be done to improve performance in the kernel or QEMU.

Of course there is some price to pay; every time an otherwise idle vCPUs
is interrupted by an interrupt, it will poll unnecessarily and thus
impose a little load on the host.  The above results were obtained with
a mostly random value of the parameter (500000), and the load was around
1.5-2.5% CPU usage on one of the host's core for each idle guest vCPU.

The patch also adds a new stat, /sys/kernel/debug/kvm/halt_successful_poll,
that can be used to tune the parameter.  It counts how many HLT
instructions received an interrupt during the polling period; each
successful poll avoids that Linux schedules the VCPU thread out and back
in, and may also avoid a likely trip to C1 and back for the physical CPU.

While the VM is idle, a Linux 4 VCPU VM halts around 10 times per second.
Of these halts, almost all are failed polls.  During the benchmark,
instead, basically all halts end within the polling period, except a more
or less constant stream of 50 per second coming from vCPUs that are not
running the benchmark.  The wasted time is thus very low.  Things may
be slightly different for Windows VMs, which have a ~10 ms timer tick.

The effect is also visible on Marcelo's recently-introduced latency
test for the TSC deadline timer.  Though of course a non-RT kernel has
awful latency bounds, the latency of the timer is around 8000-10000 clock
cycles compared to 20000-120000 without setting halt_poll_ns.  For the TSC
deadline timer, thus, the effect is both a smaller average latency and
a smaller variance.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-02-06 13:08:37 +01:00
..
xen xen/arm/arm64: merge xen/mm32.c into xen/mm.c 2014-12-04 12:41:53 +00:00
alternative-asm.h arm64: add Cortex-A53 cache errata workaround 2014-11-25 15:56:21 +00:00
alternative.h arm64: add module support for alternatives fixups 2014-12-04 10:28:24 +00:00
arch_timer.h clocksource: arch_timer: Fix code to use physical timers when requested 2014-12-04 23:30:26 -08:00
asm-offsets.h
assembler.h arm64: debug: avoid accessing mdscr_el1 on fault paths where possible 2014-05-12 16:43:28 +01:00
atomic.h locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read() 2014-10-03 06:06:23 +02:00
barrier.h arch: Add lightweight memory barriers dma_rmb() and dma_wmb() 2014-12-11 21:15:06 -05:00
bitops.h arch,arm64: Convert smp_mb__*() 2014-04-18 11:40:33 +02:00
cache.h arm64: Implement support for read-mostly sections 2014-12-03 10:19:35 +00:00
cacheflush.h arm64: compat: align cacheflush syscall with arch/arm 2014-12-01 13:31:12 +00:00
cachetype.h arm64: add helper functions to read I-cache attributes 2014-09-08 14:39:18 +01:00
cmpxchg.h arm64: percpu: Implement this_cpu operations 2014-11-20 12:05:18 +00:00
compat.h arm64: add SIGSYS siginfo for compat task 2014-11-28 10:24:59 +00:00
compiler.h arm64: Miscellaneous header files 2012-09-17 13:42:21 +01:00
cpu_ops.h arm64: Remove unneeded extern keyword 2014-10-03 14:51:02 +01:00
cpu.h arm64: sanity checks: add ID_AA64DFR{0,1}_EL1 2014-11-25 15:56:44 +00:00
cpufeature.h arm64: Provide a namespace to NCAPS 2014-12-04 09:57:41 +00:00
cpuidle.h arm64: kernel: introduce cpu_init_idle CPU operation 2014-09-12 10:48:55 +01:00
cputable.h arm64: CPU support 2012-09-17 13:41:59 +01:00
cputype.h arm64: add Cortex-A53 cache errata workaround 2014-11-25 15:56:21 +00:00
debug-monitors.h arm64: Fix typos in KGDB macros 2014-09-25 15:35:41 +01:00
device.h arm64: introduce is_device_dma_coherent 2014-12-04 12:41:49 +00:00
dma-mapping.h arm64: Replace set_arch_dma_coherent_ops with arch_setup_dma_ops 2014-12-22 09:26:32 +00:00
dmi.h arm64: dmi: Add SMBIOS/DMI support 2014-11-05 09:03:25 +01:00
efi.h efi/arm64: efistub: Move shared dependencies to <asm/efi.h> 2014-07-07 20:29:47 +01:00
elf.h arm64: ASLR: Don't randomise text when randomise_va_space == 0 2014-10-24 15:47:49 +01:00
esr.h KVM/ARM changes for v3.20 including GICv3 emulation, dirty page logging, added 2015-01-23 13:39:51 +01:00
exception.h arm64: Use irqchip_init() for interrupt controller initialisation 2013-03-26 16:02:23 +00:00
exec.h arm64: Miscellaneous header files 2012-09-17 13:42:21 +01:00
fb.h arm64: Device specific operations 2012-09-17 13:42:04 +01:00
fixmap.h arm64: Add FIX_HOLE to permanent fixed addresses 2014-11-26 11:32:17 +00:00
fpsimd.h arm64: add support for kernel mode NEON in interrupt context 2014-05-08 11:31:57 +02:00
fpsimdmacros.h arm64: fpsimd: avoid restoring fpcr if the contents haven't changed 2014-07-18 10:21:17 +01:00
ftrace.h arm64: ftrace: Add system call tracepoint 2014-05-29 09:08:33 +01:00
futex.h arm64: asm: remove redundant "cc" clobbers 2014-02-07 16:46:07 +00:00
hardirq.h arm64: Get rid of handle_IRQ 2014-09-03 13:11:00 +00:00
hugetlb.h ARM64: mm: HugeTLB support. 2013-06-14 09:52:40 +01:00
hw_breakpoint.h arm64: ptrace: fix compat hardware watchpoint reporting 2014-08-28 20:01:36 +01:00
hwcap.h arm64: Add COMPAT_HWCAP_LPAE 2014-11-17 10:43:42 +00:00
hypervisor.h arm64/xen: introduce asm/xen header files on arm64 2013-06-07 10:39:45 +00:00
insn.h arm64: Emulate CP15 Barrier instructions 2014-11-20 16:34:48 +00:00
io.h asm-generic: asm/io.h rewrite 2014-12-09 17:25:00 -08:00
irq_work.h arm64: Fix compilation error on UP builds 2014-10-21 17:01:07 +01:00
irq.h arm64/include/asm: Fixed a warning about 'struct pt_regs' 2014-12-04 10:10:59 +00:00
irqflags.h arm64: Add macros to manage processor debug state 2014-02-26 11:16:25 +00:00
jump_label.h arm64, jump label: optimize jump label implementation 2014-01-08 15:23:53 +00:00
Kbuild Merge branch 'irq-irqdomain-arm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-15 17:30:09 -08:00
kgdb.h arm64: Fix typos in KGDB macros 2014-09-25 15:35:41 +01:00
kvm_arm.h arm64: kvm: remove ESR_EL2_* macros 2015-01-15 12:24:43 +00:00
kvm_asm.h KVM: arm64: ARMv8 header changes for page logging 2015-01-16 14:42:48 +01:00
kvm_coproc.h arm64: KVM: common infrastructure for handling AArch32 CP14/CP15 2014-07-11 04:57:44 -07:00
kvm_emulate.h KVM/ARM changes for v3.20 including GICv3 emulation, dirty page logging, added 2015-01-23 13:39:51 +01:00
kvm_host.h kvm: add halt_poll_ns module parameter 2015-02-06 13:08:37 +01:00
kvm_mmio.h arm/arm64: KVM: add opaque private pointer to MMIO data 2015-01-20 18:25:30 +01:00
kvm_mmu.h KVM: arm64: ARMv8 header changes for page logging 2015-01-16 14:42:48 +01:00
kvm_psci.h ARM/ARM64: KVM: Make kvm_psci_call() return convention more flexible 2014-04-30 04:18:57 -07:00
linkage.h arm64: fix alignment padding in assembly code 2012-10-20 11:12:01 +01:00
memblock.h arm64: MMU initialisation 2012-09-17 13:41:56 +01:00
memory.h asm-generic: asm/io.h rewrite 2014-12-09 17:25:00 -08:00
mmu_context.h arm64: mm: don't bother invalidating the icache in switch_mm 2013-06-07 18:00:11 +01:00
mmu.h Merge branch 'arm64-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-05 13:15:32 -07:00
module.h arm64: Loadable modules 2012-09-17 13:42:19 +01:00
neon.h arm64: add support for kernel mode NEON in interrupt context 2014-05-08 11:31:57 +02:00
opcodes.h arm64: Add AArch32 instruction set condition code checks 2014-11-20 16:33:45 +00:00
page.h arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area 2014-08-08 15:57:27 -07:00
pci.h arm64: Add architectural support for PCI 2014-09-30 17:08:57 -06:00
percpu.h arm64: percpu: Implement this_cpu operations 2014-11-20 12:05:18 +00:00
perf_event.h arm64: perf: add guest vs host discrimination 2013-01-29 16:56:17 +00:00
pgalloc.h arm64: pgalloc: consistently use PGALLOC_GFP 2014-11-20 12:05:18 +00:00
pgtable-hwdef.h KVM: arm64: ARMv8 header changes for page logging 2015-01-16 14:42:48 +01:00
pgtable-types.h arm64: Remove asm/pgtable-*level-types.h files 2014-07-23 15:27:56 +01:00
pgtable.h arm64: mm: Add pgd_page to support RCU fast_gup 2014-12-23 16:39:17 +00:00
pmu.h arm64: Performance counters support 2012-09-17 13:42:17 +01:00
proc-fns.h arm64: convert part of soft_restart() to assembly 2014-09-08 14:39:18 +01:00
processor.h arm64: report correct stack pointer in KSTK_ESP for compat tasks 2014-08-29 16:11:10 +01:00
psci.h PSCI: Add initial support for PSCIv0.2 functions 2014-05-15 10:16:00 -04:00
ptrace.h arm64: Add brackets around user_stack_pointer() 2014-08-29 16:11:00 +01:00
seccomp.h arm64: add seccomp support 2014-11-28 10:24:59 +00:00
shmparam.h arm64: ELF definitions 2012-09-17 13:42:07 +01:00
signal32.h arm64: Use get_signal() signal_setup_done() 2014-08-06 12:56:16 +02:00
smp_plat.h arm64: kernel: build MPIDR_EL1 hash function data structure 2013-12-16 17:17:30 +00:00
smp.h arm64: Tell irq work about self IPI support 2014-09-13 18:46:13 +02:00
sparsemem.h arm64: mm: update max pa bits to 48 2014-08-19 20:23:02 +01:00
spinlock_types.h arm64: Fix the endianness of arch_spinlock_t 2013-10-25 16:10:22 +01:00
spinlock.h arm64/spinlock: Replace ACCESS_ONCE READ_ONCE 2014-12-18 09:54:40 +01:00
stackprotector.h arm64: Add CONFIG_CC_STACKPROTECTOR 2014-07-09 12:23:48 +01:00
stacktrace.h arm64: Exception handling 2012-09-17 10:24:46 +01:00
stat.h UAPI: (Scripted) Disintegrate arch/arm64/include/asm 2012-10-11 11:05:13 +01:00
string.h arm64: lib: Implement optimized string length routines 2014-05-23 15:17:12 +01:00
suspend.h arm64: kernel: refactor the CPU suspend API for retention states 2014-09-12 10:48:55 +01:00
sync_bitops.h arm64/xen: introduce asm/xen header files on arm64 2013-06-07 10:39:45 +00:00
syscall.h arm64: Add audit support 2014-07-10 11:06:00 +01:00
syscalls.h arm64: switch to generic sigaltstack 2013-02-14 09:17:29 -05:00
sysreg.h arm64: gicv3: Allow GICv3 compilation with older binutils 2014-07-25 13:12:15 +01:00
system_misc.h arm64: use common reboot infrastructure 2013-07-19 15:57:08 +01:00
thread_info.h arm64: LLVMLinux: Calculate current_thread_info from current_stack_pointer 2014-09-08 14:39:19 +01:00
timex.h arm64: kernel: compiling issue, need delete read_current_timer() 2013-06-10 17:58:20 +01:00
tlb.h mmu_gather: move minimal range calculations into generic code 2014-11-17 10:12:42 +00:00
tlbflush.h arm64: fix soft lockup due to large tlb flush range 2014-07-24 18:41:13 +01:00
topology.h arm64: sched: Remove unused mc_capable() and smt_capable() 2014-05-16 17:12:04 +01:00
traps.h arm64: Add support for hooks to handle undefined instructions 2014-11-20 16:33:43 +00:00
uaccess.h arm64: Fix __range_ok macro 2014-03-20 17:41:27 +00:00
ucontext.h arm64: fix padding computation in struct ucontext 2013-03-18 10:42:16 +00:00
unistd32.h arm64 updates for 3.19 2014-12-09 13:12:47 -08:00
unistd.h arm64: add seccomp support 2014-11-28 10:24:59 +00:00
vdso_datapage.h arm64: VDSO support 2012-09-17 13:42:09 +01:00
vdso.h arm64: VDSO support 2012-09-17 13:42:09 +01:00
virt.h arm64: KVM: remove __kvm_hyp_code_{start,end} from hyp.S 2014-07-11 04:57:35 -07:00
word-at-a-time.h arm64: dcache: select DCACHE_WORD_ACCESS for little-endian CPUs 2013-12-19 17:43:08 +00:00