linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 0/4] Fixes for two recently found timekeeping bugs
@ 2017-05-27  3:33 John Stultz
  2017-05-27  3:33 ` [RFC][PATCH 1/4] time: Fix clock->read(clock) race around clocksource changes John Stultz
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: John Stultz @ 2017-05-27  3:33 UTC (permalink / raw)
  To: lkml
  Cc: John Stultz, Thomas Gleixner, Ingo Molnar, Miroslav Lichvar,
	Richard Cochran, Prarit Bhargava, Stephen Boyd, Daniel Mentz

As part of the Linaro Linux Kernel Functional Test (LKFT)
effort, test failures from kselftest/timer's
inconsistency-check were reported connected to
CLOCK_MONOTONIC_RAW, on the HiKey platform.

Digging in I found that an old issue with how sub-ns accounting
is handled with the RAW time which was fixed long ago with the
CLOCK_MONOTONIC/REALTIME ids, but missed with RAW time, was
present.

Additionally, running further tests, I uncovered an issue with
how the clocksource read function is handled when clocksources
are changed, which can cause crashes.

Both of these issues have not been uncovered in x86 based
testing due to x86 not using vDSO to accelerate
CLOCK_MONOTONIC_RAW, combined with the HiKey's arch_timer
clocksource being fast to access but incrementing slowly enough
to get multiple reads using the same counter value (which helps
uncover time handing issues), along with the fact that none of
the x86 clocksources making use of the clocksource argument
passed to the read function.

This patchset addresses these two issues. 

Thanks so much to help from Will Deacon in getting the needed
adjustments to the arm64 vDSO in place. Also thanks to Daniel
Mentz who also properly diagnosed the MONOTONIC_RAW issue in
parallel while I was woking on this patchset.

I wanted to send these out for some initial review. I'm
unfortunately still chasing a third issue (related to
inconsistencies triggered during extreme freq adjustments) I've
uncovered on HiKey, which doesn't seem to be related to the
previous two.

As always feedback would be appreciated!

thanks
-john

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Stephen Boyd <stephen.boyd@linaro.org>
Cc: Daniel Mentz <danielmentz@google.com>


John Stultz (3):
  time: Fix clock->read(clock) race around clocksource changes
  time: Fix CLOCK_MONOTONIC_RAW sub-nanosecond accounting
  time: Clean up CLOCK_MONOTONIC_RAW time handling

Will Deacon (1):
  arm64: vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW

 arch/arm64/kernel/vdso.c              |  5 +-
 arch/arm64/kernel/vdso/gettimeofday.S |  1 -
 include/linux/timekeeper_internal.h   |  8 +--
 kernel/time/timekeeping.c             | 96 ++++++++++++++++++++++-------------
 4 files changed, 66 insertions(+), 44 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-08-26 14:14 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-27  3:33 [RFC][PATCH 0/4] Fixes for two recently found timekeeping bugs John Stultz
2017-05-27  3:33 ` [RFC][PATCH 1/4] time: Fix clock->read(clock) race around clocksource changes John Stultz
2017-05-27  7:31   ` Ingo Molnar
2017-05-27  3:33 ` [RFC][PATCH 2/4] time: Fix CLOCK_MONOTONIC_RAW sub-nanosecond accounting John Stultz
2017-05-27  7:36   ` Ingo Molnar
2017-05-30 18:42     ` Daniel Mentz
2017-05-27  3:33 ` [RFC][PATCH 3/4] arm64: vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW John Stultz
2017-05-30  9:38   ` Will Deacon
2017-05-27  3:33 ` [RFC][PATCH 4/4] time: Clean up CLOCK_MONOTONIC_RAW time handling John Stultz
2017-08-25 13:40   ` Chris Wilson
2017-08-25 18:55     ` John Stultz
2017-08-25 21:16       ` John Stultz
2017-08-25 22:57     ` [RFC][PATCH] time: Fix ktime_get_raw() issues caused by incorrect base accumulation John Stultz
2017-08-26 10:20       ` Chris Wilson
2017-08-26 14:10       ` [tip:timers/urgent] time: Fix ktime_get_raw() " tip-bot for John Stultz
2017-05-27  7:38 ` [RFC][PATCH 0/4] Fixes for two recently found timekeeping bugs Ingo Molnar
2017-05-27 16:16   ` John Stultz
2017-05-28  8:54     ` Ingo Molnar
     [not found] ` <CAE2F3rBuOJqLs5Cu7A9wEruZj1Vmnpy6qAYW=U9FVAOEP73pdg@mail.gmail.com>
2017-05-31  0:11   ` Daniel Mentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).