[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230329172458.GA209886@dev-arch.thelio-3990X>
Date: Wed, 29 Mar 2023 10:24:58 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: gregory.greenman@...el.com, kvalo@...nel.org,
ndesaulniers@...gle.com, trix@...hat.com, avraham.stern@...el.com,
krishnanand.prabhu@...el.com, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, patches@...ts.linux.dev,
Arnd Bergmann <arnd@...db.de>,
"kernelci.org bot" <bot@...nelci.org>
Subject: Re: [PATCH wireless-next] wifi: iwlwifi: mvm: Avoid 64-bit division
in iwl_mvm_get_crosstimestamp_fw()
On Wed, Mar 29, 2023 at 07:20:43PM +0200, Johannes Berg wrote:
> On Wed, 2023-03-29 at 10:05 -0700, Nathan Chancellor wrote:
> >
> > GCC has optimizations for division by a constant that clang does not
> > implement, so this issue is not visible when building with GCC.
>
> Huh yeah, we did 32-bit builds with gcc ...
>
> > Using div_u64() would resolve this issue, but Arnd points out that this
> > can be quite expensive and the timestamp is being read at nanosecond
> > granularity.
>
> Doesn't matter though, all the calculations are based on just the
> command response from the firmware, which (tries to) take it in a
> synchronised fashion.
Okay, that is good information, thanks for providing it!
> So taking more time here would be fine, as far as I can tell.
>
> > Nick pointed out that the result of this division is being
> > stored to a 32-bit type anyways, so truncate gp2_10ns first then do the
> > division, which elides the need for libcalls.
>
> That loses ~7 top bits though, no? I'd be more worried about that, than
> the time div_u64() takes.
Right, I sent this version of the fix to spur discussion around whether
or not this was an acceptable approach, rather than having the question
sit unanswered in our issue tracker :) I have no problems sending a v2
to use div_u64() and be done with it, which I will do shortly.
Thanks for the quick input, cheers!
Nathan
Powered by blists - more mailing lists