From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Richard Cochran <richardcochran@gmail.com>,
Prarit Bhargava <prarit@redhat.com>,
lttng-dev@lists.lttng.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC PATCH lttng-modules] Fix: use timekeeping_is_busy() to fix ktime_get() hard lockup
Date: Wed, 11 Sep 2013 15:01:24 -0400 [thread overview]
Message-ID: <20130911190124.GA31443@Krystal> (raw)
In-Reply-To: <52309DB0.4020403@linaro.org>
* John Stultz (john.stultz@linaro.org) wrote:
> On 09/11/2013 08:12 AM, Mathieu Desnoyers wrote:
> > LTTng uses ktime to have the same time-base across kernel and
> > user-space, so traces gathered from LTTng-modules and LTTng-UST can be
> > correlated. We plan on using ktime until a fast, scalable, and
> > fine-grained time-source for tracing that can be used across kernel and
> > user-space, and which does not rely on read seqlock for kernel-level
> > synchronization, makes its way into the kernel.
> >
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Richard Cochran <richardcochran@gmail.com>
> > Cc: Prarit Bhargava <prarit@redhat.com>
> > Cc: John Stultz <john.stultz@linaro.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > ---
> > diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > index bced61c..2f9df7a 100644
> > --- a/wrapper/trace-clock.h
> > +++ b/wrapper/trace-clock.h
> > @@ -32,6 +32,7 @@
> > #include <linux/ktime.h>
> > #include <linux/time.h>
> > #include <linux/hrtimer.h>
> > +#include <linux/version.h>
> > #include "random.h"
> >
> > static inline u64 trace_clock_monotonic_wrapper(void)
> > @@ -45,6 +46,10 @@ static inline u64 trace_clock_monotonic_wrapper(void)
> > if (in_nmi())
> > return (u64) -EIO;
> >
> > +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
> > + if (timekeeping_is_busy())
> > + return (u64) -EIO;
> > +#endif
> > ktime = ktime_get();
> > return ktime_to_ns(ktime);
> > }
>
>
> I guess the other question here is should this functionality be pushed
> down into the timekeeping accessors themselves?
>
> I know any extra checks would probably be considered overhead in some
> uses, but if we do the check only when we hit contention then it might
> not be so bad.
I thought about the exact same thing, but wanted to keep my initial
kernel patch minimal, so I chose not to touch the fast paths initially.
Indeed, if we only do this check after the seqretry has failed, we
should be able to add this check without touching the fast-path.
It might be cleaner to make ktime_get() return an error rather than
cause a hard lockup in those cases. Especially if it can be done without
performance regression.
Thanks,
Mathieu
>
> thanks
> -john
>
>
>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2013-09-11 19:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 15:12 [RFC PATCH lttng-modules] Fix: use timekeeping_is_busy() to fix ktime_get() hard lockup Mathieu Desnoyers
2013-09-11 16:43 ` John Stultz
2013-09-11 19:01 ` Mathieu Desnoyers [this message]
2013-09-12 19:53 ` Thomas Gleixner
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=20130911190124.GA31443@Krystal \
--to=mathieu.desnoyers@efficios.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lttng-dev@lists.lttng.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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