All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: Liav Rehana <liavr@mellanox.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	lkml <linux-kernel@vger.kernel.org>,
	Elad Kanfi <eladkan@mellanox.com>,
	Noam Camus <noamca@mellanox.com>
Subject: Re: [PATCH] timekeeping: Change type of nsec variable to unsigned in its calculation.
Date: Sun, 25 Sep 2016 23:02:04 -0700	[thread overview]
Message-ID: <CALAqxLVAy5mST2ChwQ4hJUXcz8e6wep7y9hYs=fo6ZPtMiGv9Q@mail.gmail.com> (raw)
In-Reply-To: <1474868736-22724-1-git-send-email-liavr@mellanox.com>

On Sun, Sep 25, 2016 at 10:45 PM, Liav Rehana <liavr@mellanox.com> wrote:
> From: Liav Rehana <liavr@mellanox.com>
>
> During the calculation of the nsec variable in the inline function
> timekeeping_delta_to_ns, it may undergo a sign extension if its msb
> is set just before the shift. The sign extension may, in some cases,
> gain it a value near the maximum value of the 64-bit range. This is
> bad when it is later used in a division function, such as
> __iter_div_u64_rem, where the amount of loops it will go through to
> calculate the division will be too large.
> The following commit fixes that chance of sign extension, while
> maintaining the type of the nsec variable as signed for other
> functions that use this variable, for possible legit negative
> time intervals.

Apologies for my foggy memory here (just got off a plane).  But remind
me, is this something that you actually ran into, or is it more of
just a theoretical concern?

If it is something that you did trip on, please describe your case in
the changelog so that the proper urgency is applied when weighing if
such a commit should go into -stable.

thanks
-john

  reply	other threads:[~2016-09-26  6:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26  5:45 [PATCH] timekeeping: Change type of nsec variable to unsigned in its calculation Liav Rehana
2016-09-26  6:02 ` John Stultz [this message]
2016-09-27  0:01 ` Thomas Gleixner
2016-09-27  5:10   ` Liav Rehana
2016-09-27 14:18     ` Thomas Gleixner
2016-09-26  6:13 Liav Rehana
2016-11-19  4:53 John Stultz
2016-11-28 22:50 ` John Stultz
2016-11-29 14:22 ` Thomas Gleixner
2016-11-29 23:57   ` David Gibson
2016-11-30 23:21     ` Thomas Gleixner
2016-12-01  2:12       ` David Gibson
2016-12-01 11:59         ` Thomas Gleixner
2016-12-01 20:23           ` John Stultz
2016-12-01 20:46             ` Thomas Gleixner
2016-12-01 21:19               ` John Stultz
2016-12-01 22:44                 ` Thomas Gleixner
2016-12-01 23:03                   ` John Stultz
2016-12-01 23:08                     ` Thomas Gleixner
2016-12-01 23:32           ` David Gibson
2016-12-02  8:36             ` Thomas Gleixner
2016-12-03  0:33               ` David Gibson

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='CALAqxLVAy5mST2ChwQ4hJUXcz8e6wep7y9hYs=fo6ZPtMiGv9Q@mail.gmail.com' \
    --to=john.stultz@linaro.org \
    --cc=eladkan@mellanox.com \
    --cc=liavr@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noamca@mellanox.com \
    --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 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.