From: David Laight <david.laight.linux@gmail.com>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: Niko Nikolov <nikolay.niko.nikolov@gmail.com>,
shuah@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/tsc: Replace do_div() with div64_u64()/div64_ul()
Date: Mon, 28 Jul 2025 20:06:44 +0100 [thread overview]
Message-ID: <20250728200644.3bcc1f3e@pumpkin> (raw)
In-Reply-To: <c6eb6734-93d3-4a59-8869-49ecc438fff9@linuxfoundation.org>
On Thu, 24 Jul 2025 16:32:43 -0600
Shuah Khan <skhan@linuxfoundation.org> wrote:
> On 7/24/25 15:53, Niko Nikolov wrote:
> > Replace do_div() with the recommended division helpers to avoid
> > truncation and follow kernel best practices, as flagged by static
> > analysis.
>
> You are making more changes than what change log indicates.
>
> >
> > ./arch/x86/kernel/tsc.c:409:1-7:
> > WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
> > ./arch/x86/kernel/tsc.c:492:1-7:
> > WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead.
> > ./arch/x86/kernel/tsc.c:831:2-8:
> > WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead.
>
> It is hard to see where you are addressing the above warnings with all
> the other changes.
>
> Also you don't have the right reviewers cc'ed
And the change is entirely broken...
David
>
> >
> > Signed-off-by: Niko Nikolov <nikolay.niko.nikolov@gmail.com>
> > ---
> > arch/x86/kernel/tsc.c | 185 +++++++++++++++++++++---------------------
> > 1 file changed, 91 insertions(+), 94 deletions(-)
> >
> > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> > index 87e749106dda..96f40759340e 100644
> > --- a/arch/x86/kernel/tsc.c
> > +++ b/arch/x86/kernel/tsc.c
> > @@ -34,13 +34,13 @@
> > #include <asm/uv/uv.h>
> > #include <asm/sev.h>
> >
> > -unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
> > +unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
> > EXPORT_SYMBOL(cpu_khz);
> >
> > unsigned int __read_mostly tsc_khz;
> > EXPORT_SYMBOL(tsc_khz);
> >
> > -#define KHZ 1000
> > +#define KHZ 1000
>
> What changed here?
>
> >
> > /*
> > * TSC can be unstable due to cpufreq or due to unsynced TSCs
> > @@ -55,13 +55,13 @@ int tsc_clocksource_reliable;
> > static int __read_mostly tsc_force_recalibrate;
> >
> > static struct clocksource_base art_base_clk = {
> > - .id = CSID_X86_ART,
> > + .id = CSID_X86_ART,
>
> Tabs removed? Why?
>
> > };
> > static bool have_art;
> >
>
> Same questions for the rest of the format changes.
>
> thanks,
> -- Shuah
>
prev parent reply other threads:[~2025-07-28 19:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 21:53 [PATCH] x86/tsc: Replace do_div() with div64_u64()/div64_ul() Niko Nikolov
2025-07-24 22:32 ` Shuah Khan
2025-07-28 19:06 ` David Laight [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=20250728200644.3bcc1f3e@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikolay.niko.nikolov@gmail.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.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.