From: Alexander Graf Date: Wed, 18 Nov 2009 00:45:10 +0100 Subject: Split the KVM pv-ops support by feature References: bnc#556135, FATE#306453 Patch-Mainline: Submitted to virtualization list Currently selecting KVM guest support enabled multiple features at once that not everyone necessarily wants to have, namely: - PV MMU - zero io delay - apic detection workaround Let's split them off so we don't drag in the full pv-ops framework just to detect we're running on KVM. That gives us more chances to tweak performance! Signed-off-by: Alexander Graf --- arch/x86/Kconfig | 29 ++++++++++++++++++++++++++++- arch/x86/kernel/kvm.c | 22 +++++++++++++++------- 2 files changed, 43 insertions(+), 8 deletions(-) --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -543,11 +543,38 @@ config KVM_CLOCK config KVM_GUEST bool "KVM Guest support" - select PARAVIRT_ALL + select PARAVIRT ---help--- This option enables various optimizations for running under the KVM hypervisor. +config KVM_IODELAY + bool "KVM IO-delay support" + depends on KVM_GUEST + select PARAVIRT_CPU + ---help--- + Usually we wait for PIO access to complete. When inside KVM there's + no need to do that, as we know that we're not going through a bus, + but process PIO requests instantly. + + This option disables PIO waits, but drags in CPU-bound pv-ops. Thus + you will probably get more speed loss than speedup using this option. + + If in doubt, say N. + +config KVM_MMU + bool "KVM PV MMU support" + depends on KVM_GUEST + select PARAVIRT_MMU + ---help--- + This option enables the paravirtualized MMU for KVM. In most cases + it's pretty useless and shouldn't be used. + + It will only cost you performance, because it drags in pv-ops for + memory management. + + If in doubt, say N. + source "arch/x86/lguest/Kconfig" config PARAVIRT --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -29,6 +29,16 @@ #include #include +#ifdef CONFIG_KVM_IODELAY +/* + * No need for any "IO delay" on KVM + */ +static void kvm_io_delay(void) +{ +} +#endif /* CONFIG_KVM_IODELAY */ + +#ifdef CONFIG_KVM_MMU #define MMU_QUEUE_SIZE 1024 static int kvmapf = 1; @@ -43,13 +53,6 @@ static struct kvm_para_state *kvm_para_s return &per_cpu(para_state, raw_smp_processor_id()); } -/* - * No need for any "IO delay" on KVM - */ -static void kvm_io_delay(void) -{ -} - #define KVM_TASK_SLEEP_HASHBITS 8 #define KVM_TASK_SLEEP_HASHSIZE (1<