lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] time/sched_clock: Allow architecture to override cyc_to_ns()
On Sat, Nov 13, 2021 at 11:47 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> The current cyc_to_ns() implementation is like this:
>
> static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
> {
> return (cyc * mult) >> shift;
> }
>
> But u64*u32 maybe overflow, so introduce ARCH_HAS_CYC_TO_NS to allow
> architecture to override it.
>

If that's the case, it would seem too large a mult/shift pair had been selected.

What sort of cycle range are you considering to be valid here? Can you
provide more rationale as to why this needs the ability to be
overridden?

And what sort of arch-specific logic do you envision, rather than
having a common implementation to avoid the overflow?

thanks
-john

\
 
 \ /
  Last update: 2021-11-16 03:13    [W:0.256 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site