public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: jan.kiszka@siemens.com, kvm@vger.kernel.org
Subject: Re: kvm-kmod and kernels 3.11.*
Date: Thu, 12 Dec 2013 22:59:04 +0100	[thread overview]
Message-ID: <52AA31A8.4010806@redhat.com> (raw)
In-Reply-To: <20131212212713.GA14762@ERROL.INI.CMU.EDU>

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 <linux/clocksource.h>')
+        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 <asm/msr.h>


  reply	other threads:[~2013-12-12 21:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 21:27 kvm-kmod and kernels 3.11.* Gabriel L. Somlo
2013-12-12 21:59 ` Paolo Bonzini [this message]
2013-12-13 15:04   ` Jan Kiszka
2013-12-13 15:12     ` Paolo Bonzini
2013-12-13 15:36       ` Jan Kiszka
2013-12-13 16:19         ` Gabriel L. Somlo
2013-12-13 16:24           ` Paolo Bonzini
2013-12-13 16:26           ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52AA31A8.4010806@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gsomlo@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox