From: Greg KH <greg@kroah.com>
To: "Nuno Gonçalves" <nunojpg@gmail.com>
Cc: stable@vger.kernel.org, linux-tip-commits@vger.kernel.org,
mingo@kernel.org, hpa@zytor.com, john.stultz@linaro.org,
mlichvar@redhat.com, richardcochran@gmail.com,
peterz@infradead.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, prarit@redhat.com,
torvalds@linux-foundation.org
Subject: Re: [tip:timers/urgent] time: Fix timekeeping_freqadjust()' s incorrect use of abs() instead of abs64()
Date: Tue, 6 Oct 2015 09:05:51 +0100 [thread overview]
Message-ID: <20151006080551.GE18449@kroah.com> (raw)
In-Reply-To: <CAEXMXLSaLfbZSGVQVX10wp2vLNZfamRsy+uLNuc7Jpw5nmpZPg@mail.gmail.com>
On Mon, Oct 05, 2015 at 04:10:28PM +0100, Nuno Gonçalves wrote:
> On Sun, Sep 13, 2015 at 12:07 PM, tip-bot for John Stultz
> <tipbot@zytor.com> wrote:
> > Commit-ID: 2619d7e9c92d524cb155ec89fd72875321512e5b
> > Gitweb: http://git.kernel.org/tip/2619d7e9c92d524cb155ec89fd72875321512e5b
> > Author: John Stultz <john.stultz@linaro.org>
> > AuthorDate: Wed, 9 Sep 2015 16:07:30 -0700
> > Committer: Ingo Molnar <mingo@kernel.org>
> > CommitDate: Sun, 13 Sep 2015 10:30:47 +0200
> >
> > time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()
> >
> > The internal clocksteering done for fine-grained error
> > correction uses a logarithmic approximation, so any time
> > adjtimex() adjusts the clock steering, timekeeping_freqadjust()
> > quickly approximates the correct clock frequency over a series
> > of ticks.
> >
> > Unfortunately, the logic in timekeeping_freqadjust(), introduced
> > in commit:
> >
> > dc491596f639 ("timekeeping: Rework frequency adjustments to work better w/ nohz")
> >
> > used the abs() function with a s64 error value to calculate the
> > size of the approximated adjustment to be made.
> >
> > Per include/linux/kernel.h:
> >
> > "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()".
> >
> > Thus on 32-bit platforms, this resulted in the clocksteering to
> > take a quite dampended random walk trying to converge on the
> > proper frequency, which caused the adjustments to be made much
> > slower then intended (most easily observed when large
> > adjustments are made).
> >
> > This patch fixes the issue by using abs64() instead.
> >
> > Reported-by: Nuno Gonçalves <nunojpg@gmail.com>
> > Tested-by: Nuno Goncalves <nunojpg@gmail.com>
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > Cc: <stable@vger.kernel.org> # v3.17+
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Miroslav Lichvar <mlichvar@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Prarit Bhargava <prarit@redhat.com>
> > Cc: Richard Cochran <richardcochran@gmail.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Link: http://lkml.kernel.org/r/1441840051-20244-1-git-send-email-john.stultz@linaro.org
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> > kernel/time/timekeeping.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> > index f6ee2e6..3739ac6 100644
> > --- a/kernel/time/timekeeping.c
> > +++ b/kernel/time/timekeeping.c
> > @@ -1614,7 +1614,7 @@ static __always_inline void timekeeping_freqadjust(struct timekeeper *tk,
> > negative = (tick_error < 0);
> >
> > /* Sort out the magnitude of the correction */
> > - tick_error = abs(tick_error);
> > + tick_error = abs64(tick_error);
> > for (adj = 0; tick_error > interval; adj++)
> > tick_error >>= 1;
> >
>
> I think this got lost on its way to the linux-stable queue (or I don't
> understand the stable rules).
It's still in the "todo" queue, along with 159 other patches that I have
yet to get to :(
thanks,
greg k-h
WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: "Nuno Gonçalves" <nunojpg@gmail.com>
Cc: stable@vger.kernel.org, linux-tip-commits@vger.kernel.org,
mingo@kernel.org, hpa@zytor.com, john.stultz@linaro.org,
mlichvar@redhat.com, richardcochran@gmail.com,
peterz@infradead.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, prarit@redhat.com,
torvalds@linux-foundation.org
Subject: Re: [tip:timers/urgent] time: Fix timekeeping_freqadjust()' s incorrect use of abs() instead of abs64()
Date: Tue, 6 Oct 2015 09:05:51 +0100 [thread overview]
Message-ID: <20151006080551.GE18449@kroah.com> (raw)
In-Reply-To: <CAEXMXLSaLfbZSGVQVX10wp2vLNZfamRsy+uLNuc7Jpw5nmpZPg@mail.gmail.com>
On Mon, Oct 05, 2015 at 04:10:28PM +0100, Nuno Gon�alves wrote:
> On Sun, Sep 13, 2015 at 12:07 PM, tip-bot for John Stultz
> <tipbot@zytor.com> wrote:
> > Commit-ID: 2619d7e9c92d524cb155ec89fd72875321512e5b
> > Gitweb: http://git.kernel.org/tip/2619d7e9c92d524cb155ec89fd72875321512e5b
> > Author: John Stultz <john.stultz@linaro.org>
> > AuthorDate: Wed, 9 Sep 2015 16:07:30 -0700
> > Committer: Ingo Molnar <mingo@kernel.org>
> > CommitDate: Sun, 13 Sep 2015 10:30:47 +0200
> >
> > time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()
> >
> > The internal clocksteering done for fine-grained error
> > correction uses a logarithmic approximation, so any time
> > adjtimex() adjusts the clock steering, timekeeping_freqadjust()
> > quickly approximates the correct clock frequency over a series
> > of ticks.
> >
> > Unfortunately, the logic in timekeeping_freqadjust(), introduced
> > in commit:
> >
> > dc491596f639 ("timekeeping: Rework frequency adjustments to work better w/ nohz")
> >
> > used the abs() function with a s64 error value to calculate the
> > size of the approximated adjustment to be made.
> >
> > Per include/linux/kernel.h:
> >
> > "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()".
> >
> > Thus on 32-bit platforms, this resulted in the clocksteering to
> > take a quite dampended random walk trying to converge on the
> > proper frequency, which caused the adjustments to be made much
> > slower then intended (most easily observed when large
> > adjustments are made).
> >
> > This patch fixes the issue by using abs64() instead.
> >
> > Reported-by: Nuno Gon�alves <nunojpg@gmail.com>
> > Tested-by: Nuno Goncalves <nunojpg@gmail.com>
> > Signed-off-by: John Stultz <john.stultz@linaro.org>
> > Cc: <stable@vger.kernel.org> # v3.17+
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: Miroslav Lichvar <mlichvar@redhat.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Prarit Bhargava <prarit@redhat.com>
> > Cc: Richard Cochran <richardcochran@gmail.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Link: http://lkml.kernel.org/r/1441840051-20244-1-git-send-email-john.stultz@linaro.org
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> > kernel/time/timekeeping.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> > index f6ee2e6..3739ac6 100644
> > --- a/kernel/time/timekeeping.c
> > +++ b/kernel/time/timekeeping.c
> > @@ -1614,7 +1614,7 @@ static __always_inline void timekeeping_freqadjust(struct timekeeper *tk,
> > negative = (tick_error < 0);
> >
> > /* Sort out the magnitude of the correction */
> > - tick_error = abs(tick_error);
> > + tick_error = abs64(tick_error);
> > for (adj = 0; tick_error > interval; adj++)
> > tick_error >>= 1;
> >
>
> I think this got lost on its way to the linux-stable queue (or I don't
> understand the stable rules).
It's still in the "todo" queue, along with 159 other patches that I have
yet to get to :(
thanks,
greg k-h
next prev parent reply other threads:[~2015-10-06 8:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 23:07 [PATCH 1/2] time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64() John Stultz
2015-09-09 23:07 ` [PATCH 2/2 (v2)] kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments John Stultz
2015-09-10 12:02 ` Miroslav Lichvar
2015-09-10 17:42 ` John Stultz
2015-09-10 18:14 ` John Stultz
2015-09-14 14:48 ` Miroslav Lichvar
2015-10-02 20:25 ` John Stultz
2015-10-02 20:27 ` John Stultz
2015-10-02 20:49 ` John Stultz
2015-09-13 8:32 ` [PATCH 1/2] time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64() Ingo Molnar
2015-09-14 23:24 ` John Stultz
2015-09-13 11:07 ` [tip:timers/urgent] time: Fix timekeeping_freqadjust()' s " tip-bot for John Stultz
2015-10-05 15:10 ` Nuno Gonçalves
2015-10-06 8:05 ` Greg KH [this message]
2015-10-06 8:05 ` Greg KH
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=20151006080551.GE18449@kroah.com \
--to=greg@kroah.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mlichvar@redhat.com \
--cc=nunojpg@gmail.com \
--cc=peterz@infradead.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.