From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: kvm-kmod and kernels 3.11.* Date: Thu, 12 Dec 2013 22:59:04 +0100 Message-ID: <52AA31A8.4010806@redhat.com> References: <20131212212713.GA14762@ERROL.INI.CMU.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: jan.kiszka@siemens.com, kvm@vger.kernel.org To: "Gabriel L. Somlo" Return-path: Received: from mail-ee0-f41.google.com ([74.125.83.41]:52192 "EHLO mail-ee0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751056Ab3LLV7J (ORCPT ); Thu, 12 Dec 2013 16:59:09 -0500 Received: by mail-ee0-f41.google.com with SMTP id t10so523718eei.0 for ; Thu, 12 Dec 2013 13:59:08 -0800 (PST) In-Reply-To: <20131212212713.GA14762@ERROL.INI.CMU.EDU> Sender: kvm-owner@vger.kernel.org List-ID: Il 12/12/2013 22:27, Gabriel L. Somlo ha scritto: > I tried copying and/or cut'n'pasting from additional source files in > the current kvm git tree, but haven't totally figured out how the magic > of "make sync" works yet :) Do you have any notes or any other > documentation one could use to be able to usefully hack on kvm-kmod > when it starts lagging behind the latest kvm master branch ? You need to "hack" the ./sync script to generate the appropriate #ifdefs. It looks like the code to support newer releases is currently in the next branch of kvm-kmod.git. For completeness, here is the patch I am using right now. Paolo diff --git a/sync b/sync index 273ec5b..0e7ab14 100755 --- a/sync +++ b/sync @@ -196,7 +196,7 @@ def hack_content(fname, data): w('\tkvm_xstate_size_init();\n') if match_block_end(r'case CPU_STARTING:', r'hardware_enable'): w('#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)') - w('\t\thardware_enable(NULL);') + w('\t\thardware_enable();') w('#else') w('\t\tsmp_call_function_single(cpu, hardware_enable, NULL, 1);') line = '#endif' @@ -321,6 +321,13 @@ def hack_content(fname, data): w('#else') w('\tif (!kvm_cpu_has_amd_erratum(kvm_amd_erratum_383))') line = '#endif' + if line == '\t.count_objects = mmu_shrink_count,': + w('#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)') + if line == '\t.scan_objects = mmu_shrink_scan,': + w(line) + w('#else') + w('\t.shrink = mmu_shrink,') + line = '#endif' w(line) if line == '\tkvm_arch_vcpu_put(vcpu);': w('\tkvm_fire_urn();') @@ -358,6 +365,14 @@ def hack_content(fname, data): w('#endif') if line == '#define _ASM_X86_KVM_HOST_H': w('#include ') + if match_block_end(r'^mmu_shrink_count', r'^}'): + w('#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,12,0)') + w('static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)') + w('{') + w('\tif (sc->nr_to_scan != 0) mmu_shrink_scan(shrink, sc);'); + w('\treturn mmu_shrink_count(shrink, sc);'); + w('}') + w('#endif') if eventfd_file: result.append('#else\n' 'void kvm_eventfd_init(struct kvm *kvm) { }\n' @@ -443,6 +458,7 @@ def header_sync(arch): for dir in ['%(linux)s/arch/%(arch)s/include/uapi/asm/kvm*.h', '%(linux)s/arch/%(arch)s/include/uapi/asm/vmx.h', '%(linux)s/arch/%(arch)s/include/uapi/asm/svm.h', + '%(linux)s/arch/%(arch)s/include/uapi/asm/msr-index.h', '%(linux)s/arch/%(arch)s/include/uapi/asm/hyperv.h'] for x in glob(dir % { 'arch': arch, 'linux': linux }) ]) diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h index e5039a6..7acd97e 100644 --- a/x86/external-module-compat.h +++ b/x86/external-module-compat.h @@ -23,6 +23,13 @@ typedef u64 phys_addr_t; #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) +static inline int hypervisor_cpuid_base(const char *sig, uint32_t leaves) +{ + return 0; +} +#endif + #include "../external-module-compat-comm.h" #include