Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 232

kvm-83-270.el5_11.src.rpm

From e54deb13e2e166a6c95805cf61f2b20df934a093 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Thu, 24 Sep 2009 16:56:48 -0300
Subject: [PATCH 1/3] Use kernel's smp_call_function_single() instead of emulating it

RH-Author: Avi Kivity <avi@redhat.com>
Message-id: <1253629423-12868-1-git-send-email-avi@redhat.com>
Patchwork-id: 3506
O-Subject: [PATCH 5.5] Use kernel's smp_call_function_single() instead of
	emulating it
Bugzilla: 524970
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>

The original 2.6.18 kernel does not export smp_call_function_single() on
x86_64, which means we have to emulate it by using smp_call_function() and
filtering out all but the cpu we're targeting.  This is horribly inefficient
and gets worse as we scale to a larger host.  A 2-way guest communicating on
a 64-way host will cause all 64 host cpus to be interrupted.

On RHEL 5.4's kernel, however, smp_call_function_single() is exported.  We
still have to emulate a bit for the different parameters and semantics, but
at least we can IPI a single cpu.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 kernel/external-module-compat-comm.h |    8 ++++++++
 kernel/external-module-compat.c      |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 kernel/external-module-compat-comm.h |    8 ++++++++
 kernel/external-module-compat.c      |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index ae7acfd..8fb2269 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -18,6 +18,14 @@
 #include <linux/hrtimer.h>
 #include <asm/bitops.h>
 
+#define RHEL54PLUS 0
+#ifdef RHEL_RELEASE_CODE
+#  if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,4)
+#    undef  RHEL54PLUS
+#    define RHEL54PLUS 1
+#  endif
+#endif
+
 /* Override CONFIG_KVM_TRACE */
 #ifdef EXT_CONFIG_KVM_TRACE
 #  define CONFIG_KVM_TRACE 1
diff --git a/kernel/external-module-compat.c b/kernel/external-module-compat.c
index 2941473..da6d774 100644
--- a/kernel/external-module-compat.c
+++ b/kernel/external-module-compat.c
@@ -3,7 +3,7 @@
  * smp_call_function_single() is not exported below 2.6.20.
  */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) && !RHEL54PLUS
 
 #undef smp_call_function_single
 
-- 
1.6.3.rc4.29.g8146