[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALAqxLULtT+13n6eGYBmDVd=UPUNORCnViXiysgAM+V7g3mN4A@mail.gmail.com>
Date: Fri, 19 Aug 2016 09:36:41 -0700
From: John Stultz <john.stultz@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Clark Williams <williams@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Jon Masters <jcm@...hat.com>, Daniel Wagner <wagi@...om.org>,
Carsten Emde <C.Emde@...dl.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [PATCH v2 0/4] tracing: Add Hardware Latency detector tracer
On Fri, Aug 19, 2016 at 8:05 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Fri, Aug 19, 2016 at 10:26:20AM -0400, Steven Rostedt wrote:
>> > In any case, for those you could probably use ktime_get_mono_fast_ns().
>>
>> Is that safe to call from NMI?
>
> It should be, we were very careful to make it so. Also read the comment
> with __ktime_get_fast_ns().
>
>> Looking into the code I see:
>>
>> now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr);
>>
>> where timekeeping_get_ns() has:
>>
>> timekeeping_get_delta()
>>
>> which does:
>>
>> read_seqcount_begin()
>>
>> which has (eventually):
>
> That's a bug in CONFIG_DEBUG_TIMEKEEPING, if you look at the
> !timekeeping_get_delta() it does no such thing.
>
> John, looks like 4ca22c2648f9 ("timekeeping: Add warnings when overflows
> or underflows are observed") buggered things.
Oof. Apologies. I missed that the fast methods called that helper as well.
Any objection to open-coding it for the fast method, like (sorry for
the whitespace damage here):
@@ -401,7 +401,10 @@ static __always_inline u64
__ktime_get_fast_ns(struct tk_fast *tkf)
do {
seq = raw_read_seqcount_latch(&tkf->seq);
tkr = tkf->base + (seq & 0x01);
- now = ktime_to_ns(tkr->base) + timekeeping_get_ns(tkr);
+ now = ktime_to_ns(tkr->base);
+
+ now += clocksource_delta(tkr->read(tkr->clock),
+ tkr->cycle_last, tkr->mask);
} while (read_seqcount_retry(&tkf->seq, seq));
return now;
If not I'll get such a patch sorted, tested and tagged for -stable.
thanks
-john
Powered by blists - more mailing lists