From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jed Smith <jed@linode.com>
Cc: xen-devel@lists.xensource.com, Jan Beulich <JBeulich@novell.com>
Subject: Re: [PATCH] x86: unconditionally mark TSC unstable under Xen
Date: Wed, 14 Jul 2010 14:36:12 -0700 [thread overview]
Message-ID: <4C3E2DCC.1010201@goop.org> (raw)
In-Reply-To: <51C8308F-F413-47AF-8845-C92BD36CA35C@linode.com>
On 07/14/2010 12:24 PM, Jed Smith wrote:
> Jeremy, Jan - what do you think? Is this a bad move? I feel like there
> is a consequence to this that I am unaware of, but it fixes my issue.
>
Ah, well that's interesting.
There's a couple of comments:
1. you can't do this with just a compile-time test, since the same
kernel can also boot native
2. nothing in a Xen PV domU environment should be using the tsc
directly, so this shouldn't have an effect. If something is using
the tsc we should track it down.
I wonder, however, if you're getting the same result as Jan's suggestion
of making sched_clock unstable by making the tsc unstable.
In that case, this patch may help:
Subject: [PATCH] xen: disable xen_sched_clock by default
xen_sched_clock only counts unstolen time. In principle this should
be useful to the Linux scheduler so that it knows how much time a process
actually consumed. But in practice this doesn't work very well as the
scheduler expects the sched_clock time to be synchronized between
cpus. It also uses sched_clock to measure the time a task spends
sleeping, in which case "unstolen time" isn't meaningful.
So just use plain xen_clocksource_read to return wallclock nanoseconds
for sched_clock.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index b83e119..6a09f01 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -29,6 +29,10 @@ config XEN_SAVE_RESTORE
depends on XEN && PM
default y
+config XEN_SCHED_CLOCK
+ bool
+ default n
+
config XEN_DEBUG_FS
bool "Enable Xen debug and tuning parameters in debugfs"
depends on XEN && DEBUG_FS
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 4b57c0b..242a230 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -939,7 +939,11 @@ static const struct pv_time_ops xen_time_ops __initdata = {
.set_wallclock = xen_set_wallclock,
.get_wallclock = xen_get_wallclock,
.get_tsc_khz = xen_tsc_khz,
+#ifdef CONFIG_XEN_SCHED_CLOCK
.sched_clock = xen_sched_clock,
+#else
+ .sched_clock = xen_clocksource_read,
+#endif
};
static const struct pv_cpu_ops xen_cpu_ops __initdata = {
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 9d1f853..32dc3dc 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -154,6 +154,7 @@ static void do_stolen_accounting(void)
account_idle_ticks(ticks);
}
+#ifdef CONFIG_XEN_SCHED_CLOCK
/*
* Xen sched_clock implementation. Returns the number of unstolen
* nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
@@ -191,7 +192,7 @@ unsigned long long xen_sched_clock(void)
return ret;
}
-
+#endif
/* Get the TSC speed from Xen */
unsigned long xen_tsc_khz(void)
Thanks,
J
next prev parent reply other threads:[~2010-07-14 21:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 19:24 [PATCH] x86: unconditionally mark TSC unstable under Xen Jed Smith
2010-07-14 21:36 ` Jeremy Fitzhardinge [this message]
[not found] ` <alpine.DEB.2.00.1007151656380.21432@kaball-desktop 4C3F37A5.9050606@goop.org>
2010-07-14 22:29 ` Jed Smith
2010-07-15 14:23 ` Jed Smith
2010-07-15 15:57 ` Stefano Stabellini
2010-07-15 16:30 ` Jeremy Fitzhardinge
2010-07-15 16:40 ` Dan Magenheimer
2010-07-15 16:45 ` Jeremy Fitzhardinge
2010-07-15 17:14 ` Dan Magenheimer
2010-07-15 17:30 ` Jeremy Fitzhardinge
2010-07-15 17:48 ` Dan Magenheimer
2010-07-15 18:05 ` Jeremy Fitzhardinge
2010-08-15 20:57 ` Ævar Arnfjörð Bjarmason
2010-08-15 23:40 ` Jeremy Fitzhardinge
2010-08-16 1:27 ` Ævar Arnfjörð Bjarmason
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=4C3E2DCC.1010201@goop.org \
--to=jeremy@goop.org \
--cc=JBeulich@novell.com \
--cc=jed@linode.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.