From: Ingo Molnar <mingo@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: Jeremiah Mahler <jmmahler@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Preeti U Murthy <preeti@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [BUG, bisect] hrtimer: severe lag after suspend & resume
Date: Fri, 5 Jun 2015 09:57:34 +0200 [thread overview]
Message-ID: <20150605075734.GA25340@gmail.com> (raw)
In-Reply-To: <CALAqxLUAXDHimaqA0mqUNcY0inOZGRf92SxSbX8dDMzJUBRvmQ@mail.gmail.com>
* John Stultz <john.stultz@linaro.org> wrote:
> So I suspect the problem is the change to clock_was_set_seq in
> timekeeping_update is done prior to mirroring the time state to the
> shadow-timekeeper. Thus the next time we do update_wall_time() the updated
> sequence is overwritten by whats in the shadow copy. The attached patch moving
> the modification up seems to avoid the issue for me.
>
> Thomas: Looking at the problematic change, I'm not a big fan of it. Caching
> timekeeping state here in the hrtimer code has been a source of bugs in the
> past, and I'm not sure I see how avoiding copying 24bytes is that big of a win.
> Especially since it adds more state to the timekeeper and hrtimer base that we
> have to read and mange. Personally I'd prefer a revert to my fix.
So it's not really the copying of the 24 bytes that is the problem with that
pattern.
It's the constant dirtying of a cacheline that would otherwise be read-mostly, and
then the reading of it from the percpu hrtimer interrupts.
That can have negative scalability effects similar to a global lock.
( Now I have not checked whether this cacheline truly becomes read-mostly after
the original commit - I suspect Thomas did. )
> + if (action & TK_CLOCK_WAS_SET)
> + tk->clock_was_set_seq++;
> +
> tk_update_ktime_data(tk);
So I'd also add a comment that this update should be done before:
if (action & TK_MIRROR)
memcpy(&shadow_timekeeper, &tk_core.timekeeper,
sizeof(tk_core.timekeeper));
Also, there appears to be a layering violation here (unless I mis-read the
tk_real/tk logic): this should copy 'tk', not access tk_core directly, correct?
Right now this does not matter, because 'tk == &tk_core' is always supposed to be
true, or at least it should point to an identical shadow copy, right?
But nevertheless tk_core should only ever be directly referenced when 'tk' is
initialized from it.
Also, there's a few more of these apparent layering violations:
git grep 'tk_core' kernel/time/timekeeping.c | grep -v 'struct timekeeper'
I realize that we are transitioning from former global variables based timekeeping
to a more parametric model, so this isn't a complaint, just an observation.
Right now it's a code cleanliness detail, but if/when we introduce clocks that are
updated independently from each other then it will also matter functionally.
Thanks,
Ingo
next prev parent reply other threads:[~2015-06-05 7:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 0:56 [BUG, bisect] hrtimer: severe lag after suspend & resume Jeremiah Mahler
2015-06-04 11:22 ` Thomas Gleixner
2015-06-04 20:13 ` Jeremiah Mahler
2015-06-04 22:54 ` John Stultz
2015-06-05 0:01 ` Jeremiah Mahler
2015-06-05 7:57 ` Ingo Molnar [this message]
2015-06-05 9:14 ` Thomas Gleixner
2015-06-05 10:07 ` Ingo Molnar
2015-06-05 18:52 ` John Stultz
2015-06-08 7:44 ` Thomas Gleixner
2015-06-08 17:37 ` John Stultz
2015-06-08 19:31 ` Thomas Gleixner
2015-06-05 14:02 ` 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=20150605075734.GA25340@gmail.com \
--to=mingo@kernel.org \
--cc=fweisbec@gmail.com \
--cc=jmmahler@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=peterz@infradead.org \
--cc=preeti@linux.vnet.ibm.com \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
/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