All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	gregory.greenman@intel.com,  kvalo@kernel.org, trix@redhat.com,
	avraham.stern@intel.com,  krishnanand.prabhu@intel.com,
	linux-wireless@vger.kernel.org,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, Arnd Bergmann <arnd@arndb.de>,
	"kernelci.org bot" <bot@kernelci.org>,
	Craig Topper <craig.topper@sifive.com>
Subject: Re: [PATCH wireless-next] wifi: iwlwifi: mvm: Avoid 64-bit division in iwl_mvm_get_crosstimestamp_fw()
Date: Wed, 29 Mar 2023 21:00:47 +0200	[thread overview]
Message-ID: <465e2312486da2c68f26811884474d080e906d87.camel@sipsolutions.net> (raw)
In-Reply-To: <CAKwvOdnQ9feXGYV2CUyVwg-FNAOmb4HBmDxMg243v28DzSfLuA@mail.gmail.com>

On Wed, 2023-03-29 at 10:30 -0700, Nick Desaulniers wrote:
> > 
> > > 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.
> 
> The result is still stored in a u32; there is a loss of precision
> regardless of use of div_u64 or open coded binary operator /.  
> 

Right, obviously.

> So is
> the loss of precision before the division as tolerable as after the
> division?

For all I can tell this is meant to be 'gp2' with an additional lower
bits to reach a unit/granularity of 10ns, basically in FW something like

  gp2_10ns = gp2 * 100 + subsampling_10ns_unit

(and gp2 in FW is a 32-bit value, so it rolls over eventually).

But I _think_ we want to make a proper division by 100 to obtain back
the original 'gp2' value here.

johannes

      reply	other threads:[~2023-03-29 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 17:05 [PATCH wireless-next] wifi: iwlwifi: mvm: Avoid 64-bit division in iwl_mvm_get_crosstimestamp_fw() Nathan Chancellor
2023-03-29 17:20 ` Johannes Berg
2023-03-29 17:24   ` Nathan Chancellor
2023-03-29 17:30   ` Nick Desaulniers
2023-03-29 19:00     ` Johannes Berg [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=465e2312486da2c68f26811884474d080e906d87.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=arnd@arndb.de \
    --cc=avraham.stern@intel.com \
    --cc=bot@kernelci.org \
    --cc=craig.topper@sifive.com \
    --cc=gregory.greenman@intel.com \
    --cc=krishnanand.prabhu@intel.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=trix@redhat.com \
    /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.