From: Kevin Hilman <khilman@linaro.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Mats Liljegren <mats.liljegren@enea.com>,
linaro-dev@lists.linaro.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC/PATCH 1/5] context tracking: conditionalize guest support based on CONFIG_KVM
Date: Wed, 27 Feb 2013 06:24:03 -0800 [thread overview]
Message-ID: <87621dygvw.fsf@linaro.org> (raw)
In-Reply-To: <1361916782.1740.2.camel@leonhard> (Namhyung Kim's message of "Wed, 27 Feb 2013 07:13:02 +0900")
Namhyung Kim <namhyung@kernel.org> writes:
> 2013-02-26 (화), 11:29 -0800, Kevin Hilman:
>> Frederic Weisbecker <fweisbec@gmail.com> writes:
>>
>> > On Wed, Feb 20, 2013 at 11:41:38AM -0800, Kevin Hilman wrote:
>> >> So that it can build on !KVM systems too.
>> >>
>> >> Signed-off-by: Kevin Hilman <khilman@linaro.org>
>> >> ---
>> >> kernel/context_tracking.c | 4 ++++
>> >> 1 file changed, 4 insertions(+)
>> >>
>> >> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
>> >> index 74f68f4..6fe96b1 100644
>> >> --- a/kernel/context_tracking.c
>> >> +++ b/kernel/context_tracking.c
>> >> @@ -1,5 +1,7 @@
>> >> #include <linux/context_tracking.h>
>> >> +#ifdef CONFIG_KVM
>> >> #include <linux/kvm_host.h>
>> >> +#endif
>> >
>> > The header should take care of the off-case, no need to ifdef its inclusion.
>>
>> In their current form, the headers will not build on platforms without
>> KVM support. For example, these platforms (like ARM) don't even have
>> <asm/kvm.h> or <asm/kvm_host.h>.
>>
>> >> #include <linux/rcupdate.h>
>> >> #include <linux/sched.h>
>> >> #include <linux/hardirq.h>
>> >> @@ -62,6 +64,7 @@ void user_exit(void)
>> >> local_irq_restore(flags);
>> >> }
>> >>
>> >> +#ifdef CONFIG_KVM
>> >> void guest_enter(void)
>> >> {
>> >> if (vtime_accounting_enabled())
>> >> @@ -79,6 +82,7 @@ void guest_exit(void)
>> >> __guest_exit();
>> >> }
>> >> EXPORT_SYMBOL_GPL(guest_exit);
>> >> +#endif
>> >
>> > Kvm might be built as a module so we can't actually do this unfortunately.
>>
>> Ah, right. How bout using
>>
>> #if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
>>
>> for both conditionals above? Updated patch below.
>
> This is what IS_ENABLED(CONFIG_KVM) is for.
Right, updated patch below.
Kevin
>From 61e35f069a64c03a2bce348487d41072aeb9f36b Mon Sep 17 00:00:00 2001
From: Kevin Hilman <khilman@linaro.org>
Date: Thu, 14 Feb 2013 10:17:37 -0800
Subject: [PATCH] context tracking: conditionalize guest support based on
CONFIG_KVM
So that it can build on !KVM systems too.
Signed-off-by: Kevin Hilman <khilman@linaro.org>
---
kernel/context_tracking.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 74f68f4..fda6cd6 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -1,5 +1,7 @@
#include <linux/context_tracking.h>
+#if IS_ENABLED(CONFIG_KVM)
#include <linux/kvm_host.h>
+#endif
#include <linux/rcupdate.h>
#include <linux/sched.h>
#include <linux/hardirq.h>
@@ -62,6 +64,7 @@ void user_exit(void)
local_irq_restore(flags);
}
+#if IS_ENABLED(CONFIG_KVM)
void guest_enter(void)
{
if (vtime_accounting_enabled())
@@ -79,6 +82,7 @@ void guest_exit(void)
__guest_exit();
}
EXPORT_SYMBOL_GPL(guest_exit);
+#endif
void context_tracking_task_switch(struct task_struct *prev,
struct task_struct *next)
--
1.8.1.2
next prev parent reply other threads:[~2013-02-27 14:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 19:41 [RFC/PATCH 0/5] context_tracking: prerequisites for ARM support Kevin Hilman
2013-02-20 19:41 ` [RFC/PATCH 1/5] context tracking: conditionalize guest support based on CONFIG_KVM Kevin Hilman
2013-02-22 13:27 ` Frederic Weisbecker
2013-02-26 19:29 ` Kevin Hilman
2013-02-26 22:13 ` Namhyung Kim
2013-02-27 14:24 ` Kevin Hilman [this message]
2013-02-27 15:21 ` Frederic Weisbecker
2013-02-20 19:41 ` [RFC/PATCH 2/5] kernel_cpustat: convert to atomic 64-bit accessors Kevin Hilman
2013-02-21 19:38 ` Kevin Hilman
2013-02-21 21:53 ` Frederic Weisbecker
2013-02-21 21:54 ` Frederic Weisbecker
2013-02-22 5:57 ` Kevin Hilman
2013-02-21 21:58 ` Russell King - ARM Linux
2013-02-21 22:15 ` Frederic Weisbecker
2013-02-20 19:41 ` [RFC/PATCH 3/5] virt CPU accounting: Kconfig: drop 64-bit requirment Kevin Hilman
2013-02-20 19:41 ` [RFC/PATCH 4/5] cputime: use do_div() for nsec resolution conversion helpers Kevin Hilman
2013-02-21 16:24 ` Frederic Weisbecker
2013-02-21 17:58 ` Namhyung Kim
2013-02-21 19:21 ` Kevin Hilman
2013-02-26 15:21 ` Frederic Weisbecker
2013-02-20 19:41 ` [RFC/PATCH 5/5] ARM: Kconfig: allow virt CPU accounting Kevin Hilman
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=87621dygvw.fsf@linaro.org \
--to=khilman@linaro.org \
--cc=fweisbec@gmail.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mats.liljegren@enea.com \
--cc=namhyung@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