From: Ingo Molnar <mingo@elte.hu>
To: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Steven Rostedt <srostedt@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched_clock: prevent scd->clock from moving backwards
Date: Thu, 9 Oct 2008 23:22:19 +0200 [thread overview]
Message-ID: <20081009212219.GA10675@elte.hu> (raw)
In-Reply-To: <1223574862.6407.16.camel@norville.austin.ibm.com>
* Dave Kleikamp <shaggy@linux.vnet.ibm.com> wrote:
> On Thu, 2008-10-09 at 17:17 +0200, Ingo Molnar wrote:
>
> > hm, -tip testing found a sporadic hard lockup during bootup, and i've
> > bisected it back to this patch. They happened on 64-bit test-systems.
> > I've attached the .config that produced the problem.
> >
> > i reverted the patch and the lockups went away. But i cannot see what's
> > wrong with it ...
>
> I could have sworn I ran with the patch, but maybe I got my patch queue
> messed up and never tested it right.
>
> I think I see the problem.
>
> --- a/kernel/sched_clock.c
> +++ b/kernel/sched_clock.c
> @@ -118,13 +118,13 @@ static u64 __update_sched_clock(struct
> sched_clock_data *scd, u64 now)
>
> /*
> * scd->clock = clamp(scd->tick_gtod + delta,
> - * max(scd->tick_gtod, scd->clock),
> - * scd->tick_gtod + TICK_NSEC);
> + * max(scd->tick_gtod, scd->clock),
> + * min(scd->clock, scd->tick_gtod +
> TICK_NSEC));
> */
>
> clock = scd->tick_gtod + delta;
> min_clock = wrap_max(scd->tick_gtod, scd->clock);
> - max_clock = scd->tick_gtod + TICK_NSEC;
> + max_clock = wrap_min(scd->clock, scd->tick_gtod + TICK_NSEC);
>
> clock = wrap_max(clock, min_clock);
> clock = wrap_min(clock, max_clock);
>
> We want wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC), not
> wrap_min(). [...]
ah, so the lockup bug was probably that sched_clock() was never going
forwards properly so some task was scheduled forever and livelocked the
system?
> [...] The problem I am trying to fix is that scd->tick_gtod +
> TICK_NSEC may be too low. The upper bound needs to be at LEAST
> scd->clock. Limiting it to scd->clock all the time is disastrous.
> :-)
>
> I'll fix the patch and retest it before sending it again.
>
> Sorry about my sloppiness.
no problem - and it's good that our bad-patch filters worked properly
and efficiently :-)
Ingo
prev parent reply other threads:[~2008-10-09 21:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 21:04 Definition of sched_clock broken Jeremy Fitzhardinge
2008-10-08 12:59 ` Dave Kleikamp
2008-10-08 13:00 ` [PATCH] sched_clock: prevent scd->clock from moving backwards Dave Kleikamp
2008-10-08 23:05 ` Peter Zijlstra
2008-10-09 9:06 ` Ingo Molnar
2008-10-09 15:17 ` Ingo Molnar
2008-10-09 17:54 ` Dave Kleikamp
2008-10-09 18:21 ` Dave Kleikamp
2008-10-10 9:17 ` Ingo Molnar
2008-10-09 21:22 ` 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=20081009212219.GA10675@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@linux.vnet.ibm.com \
--cc=srostedt@redhat.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.