From: Andrew Morton <akpm@osdl.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: James.Bottomley@SteelEye.com, johnstultz@us.ibm.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix get_jiffies_64 to work on voyager
Date: Tue, 6 Jan 2004 09:05:45 -0800 [thread overview]
Message-ID: <20040106090545.6e906493.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0401060826570.2653@home.osdl.org>
Linus Torvalds <torvalds@osdl.org> wrote:
>
>
>
> On Tue, 6 Jan 2004, Andrew Morton wrote:
> >
> > Hm, OK. I hit the same deadlock when running with the "don't require TSCs
> > to be synchronised in sched_clock()" patch from -mm. The fix for that is
> > below. I shall accelerate it.
> >
> > --- 25/arch/i386/kernel/timers/timer_tsc.c~sched_clock-2.6.0-A1-deadlock-fix 2003-12-30 00:45:09.000000000 -0800
> > +++ 25-akpm/arch/i386/kernel/timers/timer_tsc.c 2003-12-30 00:45:09.000000000 -0800
> > @@ -140,7 +140,8 @@ unsigned long long sched_clock(void)
> > #ifndef CONFIG_NUMA
> > if (!use_tsc)
> > #endif
> > - return (unsigned long long)get_jiffies_64() * (1000000000 / HZ);
> > + /* jiffies might overflow but this is not a big deal here */
> > + return (unsigned long long)jiffies * (1000000000 / HZ);
>
> Augh. If you cast it to "unsigned long long" anyway, why not just use the
> right value? It's "jiffies_64".
Sounds sane.
> It has other problems, of course, but at least that makes them slightly
> less.
Yes, it's slightly sleazy.
I haven't tested this...
From: Ingo Molnar <mingo@elte.hu>
Voyager is getting odd deadlocks due to the taking of xtime_lock() in
sched_clock()->get_jiffies_64().
I had this patch queued up to fix a different deadlock, which ocurs when we
relax the requirement that TSC's be synchronised across CPUs. But it will
fix James' deadlock too.
arch/i386/kernel/timers/timer_tsc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
diff -puN arch/i386/kernel/timers/timer_tsc.c~sched_clock-2.6.0-A1-deadlock-fix arch/i386/kernel/timers/timer_tsc.c
--- 25/arch/i386/kernel/timers/timer_tsc.c~sched_clock-2.6.0-A1-deadlock-fix 2004-01-06 08:56:36.000000000 -0800
+++ 25-akpm/arch/i386/kernel/timers/timer_tsc.c 2004-01-06 08:58:37.000000000 -0800
@@ -140,7 +140,12 @@ unsigned long long sched_clock(void)
#ifndef CONFIG_NUMA
if (!use_tsc)
#endif
- return (unsigned long long)get_jiffies_64() * (1000000000 / HZ);
+ /*
+ * Avoid xtime_lock deadlocks by not locking the read of
+ * jiffies_64. Can possibly cause glitches on 32-bit rollovers
+ * but the CPU scheduler will recover OK.
+ */
+ return jiffies_64 * (1000000000 / HZ);
/* Read the Time Stamp Counter */
rdtscll(this_offset);
_
next prev parent reply other threads:[~2004-01-06 17:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-06 16:04 James Bottomley
2004-01-06 16:19 ` Andrew Morton
2004-01-06 16:26 ` James Bottomley
2004-01-06 17:05 ` Andrew Morton
2004-01-06 18:53 ` James Bottomley
2004-01-06 16:29 ` Linus Torvalds
2004-01-06 17:05 ` Andrew Morton [this message]
2004-01-06 17:11 ` Tim Schmielau
2004-01-06 17:22 ` Andrew Morton
2004-01-06 17:37 ` Tim Schmielau
2004-01-06 18:02 ` Linus Torvalds
2004-01-06 16:30 ` Tim Schmielau
2004-01-06 16:26 ` Linus Torvalds
2004-01-06 18:29 ` Paulo Marques
2004-01-06 18:46 ` Linus Torvalds
2004-01-06 19:04 ` Paulo Marques
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=20040106090545.6e906493.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=James.Bottomley@SteelEye.com \
--cc=johnstultz@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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
Powered by JetHome