This is the mail archive of the
mailing list for the glibc project.
RE: framebuffer corruption due to overlapping stp instructions on arm64
- From: David Laight <David dot Laight at ACULAB dot COM>
- To: 'Ard Biesheuvel' <ard dot biesheuvel at linaro dot org>, Ramana Radhakrishnan <ramana dot gcc at googlemail dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, Thomas Petazzoni <thomas dot petazzoni at free-electrons dot com>, GNU C Library <libc-alpha at sourceware dot org>, Andrew Pinski <pinskia at gmail dot com>, "Catalin Marinas" <catalin dot marinas at arm dot com>, Will Deacon <will dot deacon at arm dot com>, "Russell King" <linux at armlinux dot org dot uk>, LKML <linux-kernel at vger dot kernel dot org>, "Mikulas Patocka" <mpatocka at redhat dot com>, linux-arm-kernel <linux-arm-kernel at lists dot infradead dot org>
- Date: Fri, 3 Aug 2018 11:24:28 +0000
- Subject: RE: framebuffer corruption due to overlapping stp instructions on arm64
- References: <alpine.LRH.email@example.com> <CA+=Sn1mWkjuwVnjw6OWWUM=UcP76bdFa680FebCseewHfx3NpA@mail.gmail.com> <firstname.lastname@example.org> <CAJA7tRZbmnZq7RfvQeYEy_a1ZObWqpFpVdvgsXgsioQ3RyPMuA@mail.gmail.com> <CAKv+Gu97QvwoLLK_zueiA_gjg_4Q5cqU4YVUyHUVFFfffdyJaw@mail.gmail.com>
From: Ard Biesheuvel
> Sent: 03 August 2018 10:30
> The discussion about whether memcpy() should rely on unaligned
> accesses, and whether you should use it on device memory is orthogonal
> to that, and not the heart of the matter IMO
Even on x86 using memcpy() on PCIe memory (maybe mmap()ed into userspace)
isn't a good idea.
In the kernel memcpy_to/fromio() ought to be a better choice but that
is just an alternate name for memcpy().
The problem on x86 is that memcpy() is likely to be implemented as
'rep movsb' on modern cpu - relying on the cpu hardware to perform
cache-line sized transfers (etc).
Unfortunately on uncached locations it has to revert to byte copies.
So PCIe transfers (especially reads) are very slow.
The transfers need to use the largest size register available.
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)