public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: [PATCH] kvm-userspace: Fix external modules for pre-2.6.27 UP kernels
Date: Fri, 23 Jan 2009 16:03:28 +0100	[thread overview]
Message-ID: <4979DC40.9090506@siemens.com> (raw)

When disabling SMP on kernels older than 2.6.27, the compat wrapping
fails due to unresolved SMP dependencies. This patch fixes the build.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 kernel/external-module-compat-comm.h |    2 +-
 kernel/external-module-compat.c      |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index 981dc96..06af36d 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -54,7 +54,7 @@
 
 int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 				 void *info, int wait);
-
+#undef smp_call_function_single
 #define smp_call_function_single kvm_smp_call_function_single
 
 #endif
diff --git a/kernel/external-module-compat.c b/kernel/external-module-compat.c
index c0a0355..823ce82 100644
--- a/kernel/external-module-compat.c
+++ b/kernel/external-module-compat.c
@@ -86,11 +86,24 @@ int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 
 #include <linux/smp.h>
 
+#ifdef CONFIG_SMP
 int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
 				 void *info, int wait)
 {
 	return smp_call_function_single(cpu, func, info, 0, wait);
 }
+#else /* !CONFIG_SMP */
+int kvm_smp_call_function_single(int cpu, void (*func)(void *info),
+				 void *info, int wait)
+{
+	WARN_ON(cpu != 0);
+	local_irq_disable();
+	func(info);
+	local_irq_enable();
+	return 0;
+
+}
+#endif /* !CONFIG_SMP */
 
 #define smp_call_function_single kvm_smp_call_function_single
 
@@ -162,6 +175,7 @@ static void kvm_ack_smp_call(void *_data)
 int kvm_smp_call_function_mask(cpumask_t mask,
 			       void (*func) (void *info), void *info, int wait)
 {
+#ifdef CONFIG_SMP
 	struct kvm_call_data_struct data;
 	cpumask_t allbutself;
 	int cpus;
@@ -203,6 +217,7 @@ int kvm_smp_call_function_mask(cpumask_t mask,
 	}
 out:
 	put_cpu();
+#endif /* CONFIG_SMP */
 	return 0;
 }
 

             reply	other threads:[~2009-01-23 15:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 15:03 Jan Kiszka [this message]
2009-02-04 18:15 ` [PATCH] kvm-userspace: Fix external modules for pre-2.6.27 UP kernels Jan Kiszka
2009-02-05 12:48   ` Avi Kivity

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=4979DC40.9090506@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.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