mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Will Deacon <will.deacon@arm.com>,
	Josh Cartwright <joshc@codeaurora.org>
Subject: Re: [PATCH] sched_clock: Prevent callers from seeing half-updated data
Date: Tue, 18 Feb 2014 21:53:59 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.02.1402182153350.4468@ionos.tec.linutronix.de> (raw)
In-Reply-To: <CALAqxLX4k4JcUGzVdv68w+4v0fg34G_qBiBhH07kyTssQ1jE1Q@mail.gmail.com>

On Tue, 18 Feb 2014, John Stultz wrote:
> On Tue, Feb 18, 2014 at 12:20 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> > On Mon, 17 Feb 2014, John Stultz wrote:
> >
> >> From: Stephen Boyd <sboyd@codeaurora.org>
> >>
> >> The generic sched_clock registration function was previously
> >> done lockless, due to the fact that it was expected to be called
> >> only once. However, now there are systems that may register
> >> multiple sched_clock sources, for which the lack of locking has
> >> casued problems:
> >>
> >> If two sched_clock sources are registered we may end up in a
> >> situation where a call to sched_clock() may be accessing the
> >> epoch cycle count for the old counter and the cycle count for the
> >> new counter. This can lead to confusing results where
> >> sched_clock() values jump and then are reset to 0 (due to the way
> >> the registration function forces the epoch_ns to be 0).
> >>
> >> Fix this by reorganizing the registration function to hold the
> >> seqlock for as short a time as possible while we update the
> >> clock_data structure for a new counter. We also put any
> >> accumulated time into epoch_ns instead of resetting the time to
> >> 0 so that the clock doesn't reset after each successful
> >> registration.
> >>
> >> Cc: Peter Zijlstra <peterz@infradead.org>
> >
> > Peter ???
> 
> So this is the generic sched_clock work, which Peter really hasn't had
> much involvement with yet (mostly because its not yet generic enough
> to work with more then a few arches). But I included him in the CC
> since I think it would be good to have him following along.

Fair enough. I'll pick it up.

Thanks,

	tglx

  reply	other threads:[~2014-02-18 20:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 18:45 [PATCH] Generic sched_clock locking fix for tip/timers/urgent John Stultz
2014-02-17 18:45 ` [PATCH] sched_clock: Prevent callers from seeing half-updated data John Stultz
2014-02-18 20:20   ` Thomas Gleixner
2014-02-18 20:32     ` John Stultz
2014-02-18 20:53       ` Thomas Gleixner [this message]
2014-02-19 16:10   ` [tip:timers/urgent] " tip-bot for Stephen Boyd

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=alpine.DEB.2.02.1402182153350.4468@ionos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=john.stultz@linaro.org \
    --cc=joshc@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sboyd@codeaurora.org \
    --cc=will.deacon@arm.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 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®