From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, glommer@gmail.com, tglx@linutronix.de,
mingo@elte.hu, ehabkost@redhat.com, jeremy@goop.org,
avi@qumranet.com, anthony@codemonkey.ws,
virtualization@lists.linux-foundation.org, rusty@rustcorp.com.au,
ak@suse.de, chrisw@sous-sol.org, rostedt@goodmis.org,
hpa@zytor.com, Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: [PATCH 3/10] allow sched clock to be overridden by paravirt
Date: Tue, 4 Dec 2007 09:09:57 -0200 [thread overview]
Message-ID: <11967666212496-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11967666161585-git-send-email-gcosta@redhat.com>
This patch turns the sched_clock into native_sched_clock.
sched clock becomes a weak symbol, which can then give its
place to a paravirt definition.
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
arch/x86/kernel/tsc_64.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index 9c70af4..5158476 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -30,7 +30,7 @@ static unsigned long long cycles_2_ns(unsigned long long cyc)
return (cyc * cyc2ns_scale) >> NS_SCALE;
}
-unsigned long long sched_clock(void)
+unsigned long long native_sched_clock(void)
{
unsigned long a = 0;
@@ -44,6 +44,19 @@ unsigned long long sched_clock(void)
return cycles_2_ns(a);
}
+/* We need to define a real function for sched_clock, to override the
+ weak default version */
+#ifdef CONFIG_PARAVIRT
+unsigned long long sched_clock(void)
+{
+ return paravirt_sched_clock();
+}
+#else
+unsigned long long
+sched_clock(void) __attribute__((alias("native_sched_clock")));
+#endif
+
+
static int tsc_unstable;
inline int check_tsc_unstable(void)
--
1.4.4.2
next prev parent reply other threads:[~2007-12-04 13:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-04 11:09 [PATCH 0/10] Integrate msr.h Glauber de Oliveira Costa
2007-12-04 11:09 ` [PATCH 1/10] Wipe out traditional opt from x86_64 Makefile Glauber de Oliveira Costa
2007-12-04 11:09 ` [PATCH 2/10] unify msr smp funcs Glauber de Oliveira Costa
2007-12-04 11:09 ` Glauber de Oliveira Costa [this message]
2007-12-04 11:09 ` [PATCH 4/10] split get_cycles_sync Glauber de Oliveira Costa
2007-12-04 11:09 ` [PATCH 5/10] unify cpuid functions Glauber de Oliveira Costa
2007-12-04 11:10 ` [PATCH 6/10] introduce native_read_tscp Glauber de Oliveira Costa
2007-12-04 11:10 ` [PATCH 7/10] change rdpmc interface Glauber de Oliveira Costa
2007-12-04 11:10 ` [PATCH 8/10] change write msr functions interface Glauber de Oliveira Costa
2007-12-04 11:10 ` [PATCH 9/10] make fixups wordsize agnostic Glauber de Oliveira Costa
2007-12-04 11:10 ` [PATCH 10/10] integrate i386 and x86_64 code in msr.h Glauber de Oliveira Costa
2007-12-04 13:56 ` [PATCH 3/10] allow sched clock to be overridden by paravirt Andi Kleen
2007-12-04 14:09 ` [PATCH 0/10] Integrate msr.h Ingo Molnar
2007-12-04 15:47 ` Glauber de Oliveira Costa
-- strict thread matches above, loose matches on Subject: below --
2007-12-04 16:03 [PATCH 0/10 - V2] msr.h integration - fixups Glauber de Oliveira Costa
2007-12-04 16:03 ` [PATCH 1/10] Wipe out traditional opt from x86_64 Makefile Glauber de Oliveira Costa
2007-12-04 16:03 ` [PATCH 2/10] unify msr smp funcs Glauber de Oliveira Costa
2007-12-04 16:03 ` [PATCH 3/10] allow sched clock to be overridden by paravirt Glauber de Oliveira Costa
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=11967666212496-git-send-email-gcosta@redhat.com \
--to=gcosta@redhat.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=anthony@codemonkey.ws \
--cc=avi@qumranet.com \
--cc=chrisw@sous-sol.org \
--cc=ehabkost@redhat.com \
--cc=glommer@gmail.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--cc=virtualization@lists.linux-foundation.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