From: Thomas Gleixner <tglx@linutronix.de>
To: Jeff Merkey <linux.mdb@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
John Stultz <john.stultz@linaro.org>
Subject: Re: [BUG REPORT] ktime_get_ts64 causes Hard Lockup
Date: Tue, 19 Jan 2016 10:50:30 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1601191035330.3575@nanos> (raw)
In-Reply-To: <CAO6TR8UORNMgEYCxW9s-UcRjiOzs2CUpyZ+Wd=KoDv045ByiCg@mail.gmail.com>
On Mon, 18 Jan 2016, Jeff Merkey wrote:
> What is strange is the math its doing. It is subtracting a fixed
> value from rax then comparing the value. It looks like this is case
> where the value may have wrapped and the code just wasn;t setup to
> handle it.
Well, the worst case what would happen is that it loops another full round.
If you subtract 1e9 from rax often enough then it will become smaller than 1e9
no matter whether it wrapped or not. It just takes more iterations.
> 0xffffffff810ede1d 482D00CA9A3B sub rax,0x3b9aca00
> 0xffffffff810ede23 83C201 add edx,0x1
> 0xffffffff810ede26 483DFFC99A3B cmp rax,0x3b9ac9ff
> 0xffffffff810ede2c 77EF ja ktime_get_ts64+0x9d
> (0xffffffff810ede1d) (up)
>
> The C code is:
>
>
> /**
> * ktime_get_ts64 - get the monotonic clock in timespec64 format
> * @ts: pointer to timespec variable
> *
> * The function calculates the monotonic clock from the realtime
> * clock and the wall_to_monotonic offset and stores the result
> * in normalized timespec64 format in the variable pointed to by @ts.
> */
> void ktime_get_ts64(struct timespec64 *ts)
> {
> struct timekeeper *tk = &tk_core.timekeeper;
> struct timespec64 tomono;
> s64 nsec;
> unsigned int seq;
>
> WARN_ON(timekeeping_suspended);
>
> do {
> seq = read_seqcount_begin(&tk_core.seq);
> ts->tv_sec = tk->xtime_sec;
> nsec = timekeeping_get_ns(&tk->tkr_mono);
> tomono = tk->wall_to_monotonic;
> <<<
> } while (read_seqcount_retry(&tk_core.seq, seq));
> <<<
> ts->tv_sec += tomono.tv_sec;
> ts->tv_nsec = 0;
> timespec64_add_ns(ts, nsec + tomono.tv_nsec);
> }
> EXPORT_SYMBOL_GPL(ktime_get_ts64);
>
> Any ideas how to fix this problem? That do {} while gets stuck there.
So now you are pointing to that do { } while. That has absolutely nothing to
do with timespec64_add_ns() to which you are referring above.
That do {} while loop gets stuck when the time keeper sequence counter has
changed while we were reading the time and the offset.
So where exactly is it stuck? Please provide backtraces from the
hardlockup detector.
Thanks,
tglx
next prev parent reply other threads:[~2016-01-19 9:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 1:59 Jeff Merkey
2016-01-19 2:16 ` Jeff Merkey
2016-01-19 2:31 ` Jeff Merkey
2016-01-19 9:50 ` Thomas Gleixner [this message]
2016-01-19 15:37 ` Jeff Merkey
2016-01-19 22:00 ` Jeff Merkey
2016-01-20 0:59 ` Jeff Merkey
2016-01-20 9:21 ` Thomas Gleixner
2016-01-20 14:26 ` Thomas Gleixner
2016-01-20 16:40 ` Jeff Merkey
2016-01-20 16:53 ` Jeff Merkey
2016-01-20 17:16 ` Jeff Merkey
2016-01-20 17:32 ` John Stultz
2016-01-20 17:36 ` Jeff Merkey
2016-01-20 17:42 ` Thomas Gleixner
2016-01-20 17:59 ` John Stultz
2016-01-20 18:03 ` Jeff Merkey
2016-01-20 17:21 ` Thomas Gleixner
2016-01-20 17:33 ` Jeff Merkey
2016-01-20 19:34 ` Thomas Gleixner
2016-01-20 19:59 ` Jeff Merkey
2016-01-21 7:09 ` Jeff Merkey
2016-01-21 8:18 ` Jeff Merkey
2016-01-21 9:08 ` Jeff Merkey
2016-01-21 10:12 ` Thomas Gleixner
2016-01-21 15:46 ` Jeff Merkey
2016-01-21 16:57 ` Jeff Merkey
2016-01-21 17:00 ` Jeff Merkey
2016-01-21 17:07 ` Jeff Merkey
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.11.1601191035330.3575@nanos \
--to=tglx@linutronix.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.mdb@gmail.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®