mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Howells <dhowells@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched_clock: fix jiffie fallback clock
Date: Wed, 17 Sep 2008 21:10:23 +0200	[thread overview]
Message-ID: <20080917191023.GA23724@elte.hu> (raw)
In-Reply-To: <1221503179.7154.2.camel@lappy.programming.kicks-ass.net>


* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> David pointed out that the default sched_clock() fallback is broken in 
> that it wraps too soon. Fix this by using the 64 bit jiffie value so 
> that we're large enough to overflow properly.
> 
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> CC: David Howells <dhowells@redhat.com>

FYI, -tip testing found bootup hard-lockups today on 32-bit 
testsystems.

I've bisected it down to this change. After some head-scratching and an 
hour of debugging, it turns out that this aspect:

> @@ -46,10 +46,8 @@ u64 native_sched_clock(void)
>        *   very important for it to be as fast as the platform
>        *   can achive it. )
>        */
> -     if (unlikely(tsc_disabled)) {
> -             /* No locking but a rare wrong value is not a big deal: */
> -             return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
> -     }
> +     if (unlikely(tsc_disabled))
> +             return (get_jiffies_64() - INITIAL_JIFFIES) * (NSEC_PER_SEC/HZ);

is the buggy one: it calls get_jiffies_64() which does:

                seq = read_seqbegin(&xtime_lock);

that's not a very wise thing to do within xtime-locked sections - and we 
do call cpu_clock()/sched_clock() in a number of xtime-locked sections.

So i've zapped this commit for the time being, this needs to be solved 
differently.

	Ingo

      parent reply	other threads:[~2008-09-17 19:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-15 18:26 Peter Zijlstra
2008-09-17 10:05 ` Ingo Molnar
2008-09-17 19:10 ` Ingo Molnar [this message]

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=20080917191023.GA23724@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®