lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Jun 2016 18:09:00 +0300
From:	Saeed Mahameed <saeedm@....mellanox.co.il>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Matan Barak <matanb@...lanox.com>,
	Leon Romanovsky <leonro@...lanox.com>,
	Saeed Mahameed <saeedm@...lanox.com>,
	"David S. Miller" <davem@...emloft.net>,
	Achiad Shochat <achiad@...lanox.com>,
	Tariq Toukan <tariqt@...lanox.com>,
	Gal Pressman <galp@...lanox.com>,
	Maor Gottlieb <maorg@...lanox.com>,
	Huy Nguyen <huyn@...lanox.com>,
	Linux Netdev List <netdev@...r.kernel.org>,
	linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mlx5: fix 64-bit division on times

On Wed, Jun 15, 2016 at 6:27 PM, Arnd Bergmann <arnd@...db.de> wrote:
> The mlx5 driver fails to build on 32-bit architectures after some
> references to 64-bit divisions got added:
>
> drivers/net/built-in.o: In function `mlx5e_rx_am':
> :(.text+0xf88ac): undefined reference to `__aeabi_ldivmod'
>
> The driver even performs three division here, and it uses the
> obsolete 'struct timespec' that we want to get rid of.
>
> Using ktime_t and ktime_us_delta() replaces one of the divisions
> and is mildly more efficient, aside from working across 'settimeofday'
> calls and being the right type for the y2038 conversion.
>
> Using a u32 instead of s64 to store the number of microseconds
> limits the maximum time to about 71 minutes, but if we exceed that
> time, we probably don't care about the result any more for the
> purpose of rx coalescing.
>
> For the number of packets, we are taking the difference between
> two 'unsigned int', so the result won't ever be greater than that
> either.
>
> After those changes, the other two divisions are done as 32-bit
> arithmetic operations, which are much faster.

Nice catch Arnd,  we originally fixed this with div_u64, but your
solution looks wiser.
does ktime_t gives time in a resolution same as timespec ?

As discussed before this patch can't be applied on net-next as
the original patch which it meant to fix is yet to be submitted,
I will CC you once we submit the fixed patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ