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>] [day] [month] [year] [list]
Date:   Wed, 22 Nov 2017 10:43:02 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     "'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
Subject: memcpy_to/fromio() is badly optimised on x86

I believe that it is valid to use memcpy_to/fromio() to copy
data to/from memory BARs on PCIe cards.

However on x86 they are both aliases for memcpy().

The x86 kernel has several implementations of memcpy().
The 'best' one for the current cpu is selected during boot.

For more recent Intel cpus (probably Haswell and later) the
selected implementation is just 'rep movsb' relying on
the hardware to do all its 'clever' optimisations.

These optimisations are only done for cached addresses,
for uncached ones (and definitely for PCIe ones) single
byte copies are used.
(Verified on 4.13 with a PCIe monitor (of sorts).)

With the typical large read latency of PCIe this makes
memcpy_fromio() particularly painful.

memcpy_to/fromio() should be using 'rep movsd' for
the bulk of the copy.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ