From: Greg KH <greg@kroah.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>, stable@vger.kernel.org
Subject: Re: [PATCH stable] x86/tsc: Prevent result truncation on 32 bit
Date: Wed, 12 Sep 2018 20:41:00 +0200 [thread overview]
Message-ID: <20180912184100.GC10317@kroah.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1809121439390.9957@nanos.tec.linutronix.de>
On Wed, Sep 12, 2018 at 02:42:08PM +0200, Thomas Gleixner wrote:
> Subject: x86/tsc: Prevent result truncation on 32 bit
> From: Chuanhua Lei <chuanhua.lei@linux.intel.com>
> Date: Thu Sep 6 18:03:23 2018 +0800
>
> From: Chuanhua Lei <chuanhua.lei@linux.intel.com>
>
> Commit 17f6bac2249356c795339e03a0742cd79be3cab8 upstream.
>
> Loops per jiffy is calculated by multiplying tsc_khz with 1e3 and then
> dividing it by HZ.
>
> Both tsc_khz and the temporary variable holding the multiplication result
> are of type unsigned long, so on 32bit the result is truncated to the lower
> 32bit.
>
> Use u64 as type for the temporary variable and cast tsc_khz to it before
> multiplying.
>
> [ tglx: Backport to stable. Due to massive code changes is the upstream
> commit not applicable anymore. The issue has gone unnoticed in
> kernels pre 4.19 because the bogus LPJ value gets fixed up in a
> later stage of early boot, but it still might cause subtle and hard
> to debug issues between these two points. ]
Thanks for the backport, now queued up.
greg k-h
prev parent reply other threads:[~2018-09-12 18:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 12:42 [PATCH stable] x86/tsc: Prevent result truncation on 32 bit Thomas Gleixner
2018-09-12 18:41 ` Greg KH [this message]
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=20180912184100.GC10317@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.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 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.