Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758056AbdHYSzW (ORCPT ); Fri, 25 Aug 2017 14:55:22 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:33255 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754850AbdHYSzU (ORCPT ); Fri, 25 Aug 2017 14:55:20 -0400 MIME-Version: 1.0 In-Reply-To: <150366841319.27971.6041120504203143444@mail.alporthouse.com> References: <1495856035-6622-1-git-send-email-john.stultz@linaro.org> <1495856035-6622-5-git-send-email-john.stultz@linaro.org> <150366841319.27971.6041120504203143444@mail.alporthouse.com> From: John Stultz Date: Fri, 25 Aug 2017 11:55:18 -0700 Message-ID: Subject: Re: [RFC][PATCH 4/4] time: Clean up CLOCK_MONOTONIC_RAW time handling To: Chris Wilson Cc: lkml , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , Kevin Brodsky , Will Deacon , Daniel Mentz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1883 Lines: 47 On Fri, Aug 25, 2017 at 6:40 AM, Chris Wilson wrote: > Quoting John Stultz (2017-05-27 04:33:55) >> Now that we fixed the sub-ns handling for CLOCK_MONOTONIC_RAW, >> remove the duplicitive tk->raw_time.tv_nsec, which can be >> stored in tk->tkr_raw.xtime_nsec (similarly to how its handled >> for monotonic time). > > This patch breaks tkr_raw pretty badly. It is now accumulating 2x faster > than tkr_mono, with the occasional wacky jump between two reads. > > e.g: > > @@ -838,6 +840,11 @@ ktime_t ktime_get_raw(void) > > } while (read_seqcount_retry(&tk_core.seq, seq)); > > + pr_err("%s: raw.base=%llu, mono.base=%llu: nsecs=%llu, mono.nsecs=%llu\n", > + __func__, > + ktime_to_ns(base), ktime_to_ns(tk->tkr_mono.base), > + nsecs, timekeeping_get_ns(&tk->tkr_mono)); > + > > gave > ktime_get_raw: raw.base=40255680121, mono.base=39940532364: nsecs=261321742, mono.nsecs=318630514 > ktime_get_raw: raw.base=40339680124, mono.base=39940532364: nsecs=345836800, mono.nsecs=403109209 > > https://bugs.freedesktop.org/show_bug.cgi?id=102336 > > The patch still reverts cleanly and aiui was not part of the bugfixes, > but a cleanup afterwards; so can be reapplied at leisure. Thanks for the bug report! Its odd, as I'm not seeing such behavior in my testing (using the raw_skew or change_skew tests in kselftest/timers). Can you try running those tests to see if they fail on your hardware? >From the bug report, it says it BYT specific, but I'm not sure what that means. Are there any hardware specific details you can share? What clocksource is being used? Can you send a dmesg log? I'll look over the code again to see if I can catch anything by review. Worse case if we can't get any traction on this in a day or so I'll submit a revert. thanks -john