Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-09 Thread Arnd Bergmann
On Wed, Aug 8, 2018 at 11:51 PM Arnd Bergmann wrote: > I already found a couple of things: > > - Failure to copy always happens at the *end* of a 16 byte aligned > physical address, it misses between 1 and 6 bytes, never 7 or more, > and it's more likely to be fewer bytes that are affected. >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Arnd Bergmann
On Wed, Aug 8, 2018 at 8:25 PM Mikulas Patocka wrote: > On Wed, 8 Aug 2018, Arnd Bergmann wrote: > > > On Wed, Aug 8, 2018 at 5:15 PM Catalin Marinas > > wrote: > > > > > > On Wed, Aug 08, 2018 at 04:01:12PM +0100, Richard Earnshaw wrote: > > > > On 08/08/18 15:12, Mikulas Patocka wrote: > > > >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > No that works fine for me. VDPAU acceleration works as well, but it > depends on your chromium build whether it can actually use it, I > think? In any case, mplayer can use vdpau to play 1080p h264 without > breaking a sweat on this system. I didn't

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, David Laight wrote: > From: Arnd Bergmann > > Sent: 08 August 2018 17:31 > .. > > > They do modify the same byte, but with the same value. Suppose that you > > > want to copy a piece of data that is between 8 and 16 bytes long. You can > > > do this: > > > > > > add src_end,

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Wed, Aug 08, 2018 at 10:12:27AM -0400, Mikulas Patocka wrote: > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > > > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > > > while (1) { > > > > start = (unsign

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, David Laight wrote: > From: Mikulas Patocka > > Sent: 08 August 2018 14:47 > ... > > The problem on ARM is that I see data corruption when the overlapping > > unaligned writes are done just by a single core. > > Is this a sequence of unaligned writes (that shouldn't modify

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Robin Murphy wrote: > I would strongly suspect this issue is particular to Armada 8k, so its' > probably one for the Marvell folks to take a closer look at - I believe > some previous interconnect issues on those SoCs were actually fixable in > firmware. > > Robin. Do y

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, Arnd Bergmann wrote: > On Wed, Aug 8, 2018 at 5:15 PM Catalin Marinas > wrote: > > > > On Wed, Aug 08, 2018 at 04:01:12PM +0100, Richard Earnshaw wrote: > > > On 08/08/18 15:12, Mikulas Patocka wrote: > > > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > > > >> On Fri, Aug

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread David Laight
From: Arnd Bergmann > Sent: 08 August 2018 17:31 .. > > They do modify the same byte, but with the same value. Suppose that you > > want to copy a piece of data that is between 8 and 16 bytes long. You can > > do this: > > > > add src_end, src, len > > add dst_end, dst, len > > ldr x0, [src] > > ld

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Arnd Bergmann
On Wed, Aug 8, 2018 at 6:22 PM Mikulas Patocka wrote: > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > > > On Wed, Aug 08, 2018 at 02:26:11PM +, David Laight wrote: > > > From: Mikulas Patocka > > > > Sent: 08 August 2018 14:47 > > > ... > > > > The problem on ARM is that I see data corruption

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Wed, Aug 08, 2018 at 02:26:11PM +, David Laight wrote: > > From: Mikulas Patocka > > > Sent: 08 August 2018 14:47 > > ... > > > The problem on ARM is that I see data corruption when the overlapping > > > unaligned writes are done just by a sin

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Arnd Bergmann
On Wed, Aug 8, 2018 at 5:15 PM Catalin Marinas wrote: > > On Wed, Aug 08, 2018 at 04:01:12PM +0100, Richard Earnshaw wrote: > > On 08/08/18 15:12, Mikulas Patocka wrote: > > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > > >> On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > - fai

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Catalin Marinas
On Wed, Aug 08, 2018 at 04:01:12PM +0100, Richard Earnshaw wrote: > On 08/08/18 15:12, Mikulas Patocka wrote: > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > >> On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > >>> while (1) { > >>> start = (unsigned)random() % (LEN +

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Richard Earnshaw (lists)
On 08/08/18 15:12, Mikulas Patocka wrote: > > > On Wed, 8 Aug 2018, Catalin Marinas wrote: > >> On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: >>> while (1) { >>> start = (unsigned)random() % (LEN + 1); >>> end = (unsigned)random() % (LEN + 1); >>>

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Catalin Marinas
On Wed, Aug 08, 2018 at 02:26:11PM +, David Laight wrote: > From: Mikulas Patocka > > Sent: 08 August 2018 14:47 > ... > > The problem on ARM is that I see data corruption when the overlapping > > unaligned writes are done just by a single core. > > Is this a sequence of unaligned writes (that

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Catalin Marinas
On Wed, Aug 08, 2018 at 10:12:27AM -0400, Mikulas Patocka wrote: > On Wed, 8 Aug 2018, Catalin Marinas wrote: > > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > > while (1) { > > > start = (unsigned)random() % (LEN + 1); > > > end = (unsigned)random() % (

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread David Laight
From: Mikulas Patocka > Sent: 08 August 2018 14:47 ... > The problem on ARM is that I see data corruption when the overlapping > unaligned writes are done just by a single core. Is this a sequence of unaligned writes (that shouldn't modify the same physical locations) or an aligned write followed

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Tue, 7 Aug 2018, David Laight wrote: > From: Mikulas Patocka > > Sent: 07 August 2018 15:07 > ... > > Unaccelerated scrolling is still painfully slow > > even on modern computers because of slow framebuffer read. > > I solved that many years ago on a strongarm system by mapping > the screen

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, Catalin Marinas wrote: > On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > > while (1) { > > start = (unsigned)random() % (LEN + 1); > > end = (unsigned)random() % (LEN + 1); > > if (start > end) > >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, Marcin Wojtas wrote: > Hi Mikulas, > > wt., 7 sie 2018 o 19:39 Mikulas Patocka napisa?(a): > > > > > > > > On Tue, 7 Aug 2018, Marcin Wojtas wrote: > > > > > Ard, Mikulas, > > > > > > After some self-caused setup issues I was able to run the test on my > > > MacchiatoBin w

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Mikulas Patocka
On Wed, 8 Aug 2018, David Laight wrote: > From: Catalin Marinas > > Sent: 08 August 2018 13:17 > ... > > I think hazarding is what goes wrong here, especially since with > > overlapping unaligned addresses. However, I disagree that it is > > impossible to implement this properly on a platform w

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread David Laight
From: Catalin Marinas > Sent: 08 August 2018 13:17 ... > I think hazarding is what goes wrong here, especially since with > overlapping unaligned addresses. However, I disagree that it is > impossible to implement this properly on a platform with PCIe so that > Normal NC mappings can be used. I've

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Catalin Marinas
Hi Matt, On Fri, Aug 03, 2018 at 03:44:44PM -0500, Matt Sealey wrote: > On 3 August 2018 at 13:25, Mikulas Patocka wrote: > > On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > >> Are we still talking about overlapping unaligned accesses here? Or do > >> you see other failures as well? > > > > Yes - it

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-08 Thread Catalin Marinas
On Fri, Aug 03, 2018 at 01:09:02PM -0400, Mikulas Patocka wrote: > while (1) { > start = (unsigned)random() % (LEN + 1); > end = (unsigned)random() % (LEN + 1); > if (start > end) > continue; > for (i = start; i < e

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Mikulas Patocka
On Tue, 7 Aug 2018, Ard Biesheuvel wrote: > On 7 August 2018 at 19:39, Mikulas Patocka wrote: > > > > > > On Tue, 7 Aug 2018, Marcin Wojtas wrote: > > > >> Ard, Mikulas, > >> > >> After some self-caused setup issues I was able to run the test on my > >> MacchiatoBin with the kernel v4.18-rc8.

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Ard Biesheuvel
On 7 August 2018 at 19:39, Mikulas Patocka wrote: > > > On Tue, 7 Aug 2018, Marcin Wojtas wrote: > >> Ard, Mikulas, >> >> After some self-caused setup issues I was able to run the test on my >> MacchiatoBin with the kernel v4.18-rc8. It's been running for 1h+ now, >> loading the CPU to 100% and no

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Mikulas Patocka
On Tue, 7 Aug 2018, Marcin Wojtas wrote: > Ard, Mikulas, > > After some self-caused setup issues I was able to run the test on my > MacchiatoBin with the kernel v4.18-rc8. It's been running for 1h+ now, > loading the CPU to 100% and no single error event... > > I built the binary file with: >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Marcin Wojtas
Ard, Mikulas, pon., 6 sie 2018 o 22:11 Ard Biesheuvel napisał(a): > > On 6 August 2018 at 21:54, Mikulas Patocka wrote: > > > > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > > > >> On 6 August 2018 at 19:09, Mikulas Patocka wrote: > >> > > >> > > >> > On Mon, 6 Aug 2018, Ard Biesheuvel wrote:

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Ard Biesheuvel
On 7 August 2018 at 16:14, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> No that works fine for me. VDPAU acceleration works as well, but it >> depends on your chromium build whether it can actually use it, I >> think? In any case, mplayer can use vdpau to play 1080p

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread David Laight
From: Mikulas Patocka > Sent: 07 August 2018 15:07 ... > Unaccelerated scrolling is still painfully slow > even on modern computers because of slow framebuffer read. I solved that many years ago on a strongarm system by mapping the screen memory at two separate virtual addresses. One uncached used

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > No that works fine for me. VDPAU acceleration works as well, but it > depends on your chromium build whether it can actually use it, I > think? In any case, mplayer can use vdpau to play 1080p h264 without > breaking a sweat on this system. > > Note

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-07 Thread Mikulas Patocka
On Mon, 6 Aug 2018, David Laight wrote: > From: Mikulas Patocka > > Sent: 05 August 2018 15:36 > > To: David Laight > ... > > There's an instruction movntdqa (and vmovntdqa) that can actually do > > prefetch on write-combining memory type. It's the only instruction that > > can do it. > > > >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > > Unfortunatelly, it doesn't work. I verified that the bit is set after > > booting Linux, but the memcpy corruption was still present. > > > > I also tried the other chicken bits, it slowed down the system noticeably, > > but had no effect on the mem

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 21:54, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> On 6 August 2018 at 19:09, Mikulas Patocka wrote: >> > >> > >> > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: >> > >> >> On 6 August 2018 at 14:42, Robin Murphy wrote: >> >> > On 06/08/18 11:25, M

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > On 6 August 2018 at 19:09, Mikulas Patocka wrote: > > > > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > > > >> On 6 August 2018 at 14:42, Robin Murphy wrote: > >> > On 06/08/18 11:25, Mikulas Patocka wrote: > >> > [...] > >> >>> > >> >>> None of t

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 19:09, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> On 6 August 2018 at 14:42, Robin Murphy wrote: >> > On 06/08/18 11:25, Mikulas Patocka wrote: >> > [...] >> >>> >> >>> None of this explains why some transactions fail to make it across >> >>> e

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Catalin Marinas wrote: > On Mon, Aug 06, 2018 at 05:47:36PM +0200, Ard Biesheuvel wrote: > > On 6 August 2018 at 14:42, Robin Murphy wrote: > > > On 06/08/18 11:25, Mikulas Patocka wrote: > > > [...] > > >>> > > >>> None of this explains why some transactions fail to make i

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Catalin Marinas
On Mon, Aug 06, 2018 at 05:47:36PM +0200, Ard Biesheuvel wrote: > On 6 August 2018 at 14:42, Robin Murphy wrote: > > On 06/08/18 11:25, Mikulas Patocka wrote: > > [...] > >>> > >>> None of this explains why some transactions fail to make it across > >>> entirely. The overlapping writes in question

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > On 6 August 2018 at 14:42, Robin Murphy wrote: > > On 06/08/18 11:25, Mikulas Patocka wrote: > > [...] > >>> > >>> None of this explains why some transactions fail to make it across > >>> entirely. The overlapping writes in question write the same da

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 14:42, Robin Murphy wrote: > On 06/08/18 11:25, Mikulas Patocka wrote: > [...] >>> >>> None of this explains why some transactions fail to make it across >>> entirely. The overlapping writes in question write the same data to >>> the memory locations that are covered by both, a

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Sun, 5 Aug 2018, Pavel Machek wrote: > Hi! > > > > Can you run the test program on x86 using the similar framebuffer > > > setup? Does doing two writes (one aligned and one unaligned but > > > overlapping with previous one) cause the same issue? I suspect it > > > does, then using memcpy

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Tulio Magno Quites Machado Filho
Florian Weimer writes: > On 08/04/2018 01:04 PM, Mikulas Patocka wrote: >> There's plenty of memcpy's in the graphics stack. No one will be rewriting >> all the graphics drivers because of tiny market share that ARM has in >> desktop computers. So if you refuse to fix things and blame everyone el

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Marcin Wojtas wrote: > > Hi Marcin, > > > > Could you please try running his reproducer? > > This is exactly what I plan to do, as soon as I can plug my GFX card > back to the board (tomorrow). Just to remain aligned - is it ok, if I > boot my debian with GT630 plugged, com

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Marcin Wojtas
Hi Ard, Mikulas, pon., 6 sie 2018 o 15:48 Ard Biesheuvel napisał(a): > > On 6 August 2018 at 15:41, Marcin Wojtas wrote: > > Hi Mikulas, > > > > pon., 6 sie 2018 o 14:42 Robin Murphy napisał(a): > >> > >> On 06/08/18 11:25, Mikulas Patocka wrote: > >> [...] > >> >> None of this explains why som

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 15:41, Marcin Wojtas wrote: > Hi Mikulas, > > pon., 6 sie 2018 o 14:42 Robin Murphy napisał(a): >> >> On 06/08/18 11:25, Mikulas Patocka wrote: >> [...] >> >> None of this explains why some transactions fail to make it across >> >> entirely. The overlapping writes in question

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Marcin Wojtas
Hi Mikulas, pon., 6 sie 2018 o 14:42 Robin Murphy napisał(a): > > On 06/08/18 11:25, Mikulas Patocka wrote: > [...] > >> None of this explains why some transactions fail to make it across > >> entirely. The overlapping writes in question write the same data to > >> the memory locations that are c

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 14:42, Robin Murphy wrote: > On 06/08/18 11:25, Mikulas Patocka wrote: > [...] >>> >>> None of this explains why some transactions fail to make it across >>> entirely. The overlapping writes in question write the same data to >>> the memory locations that are covered by both, a

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Robin Murphy
On 06/08/18 11:25, Mikulas Patocka wrote: [...] None of this explains why some transactions fail to make it across entirely. The overlapping writes in question write the same data to the memory locations that are covered by both, and so the ordering in which the transactions are received should n

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 14:19, Ard Biesheuvel wrote: > On 6 August 2018 at 14:09, Mikulas Patocka wrote: >> >> >> On Mon, 6 Aug 2018, Ard Biesheuvel wrote: >> >>> >> Are we talking about a quirk for the Armada 8040 or about PCIe on ARM >>> >> in general? >>> > >>> > I don't know - there are not any o

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 14:09, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> >> Are we talking about a quirk for the Armada 8040 or about PCIe on ARM >> >> in general? >> > >> > I don't know - there are not any other easily available PCIe ARM boards >> > except for Armada

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> Are we talking about a quirk for the Armada 8040 or about PCIe on ARM > >> in general? > > > > I don't know - there are not any other easily available PCIe ARM boards > > except for Armada 8040. > > ... indeed, and sadly, the ones that are availab

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 13:19, Siddhesh Poyarekar wrote: > On 08/06/2018 04:01 PM, Mikulas Patocka wrote: >> >> I think there are three possible solutions: >> >> 1. provide an alternative memcpy implementation that doesn't do unaligned >> accesses and recompile the graphics software with -mstrict-alig

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Siddhesh Poyarekar
On 08/06/2018 04:01 PM, Mikulas Patocka wrote: I think there are three possible solutions: 1. provide an alternative memcpy implementation that doesn't do unaligned accesses and recompile the graphics software with -mstrict-align Given that there's already a tunable glibc.cpu.cached_memopt for

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 12:42, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> On 6 August 2018 at 12:31, Mikulas Patocka wrote: >> > >> > >> > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: >> > >> >> On 6 August 2018 at 10:02, Mikulas Patocka wrote: >> >> > >> >> > >> >> > O

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > On 6 August 2018 at 12:31, Mikulas Patocka wrote: > > > > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > > > >> On 6 August 2018 at 10:02, Mikulas Patocka wrote: > >> > > >> > > >> > On Sun, 5 Aug 2018, Florian Weimer wrote: > >> > > >> >> On 08/04

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 12:31, Mikulas Patocka wrote: > > > On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > >> On 6 August 2018 at 10:02, Mikulas Patocka wrote: >> > >> > >> > On Sun, 5 Aug 2018, Florian Weimer wrote: >> > >> >> On 08/04/2018 01:04 PM, Mikulas Patocka wrote: >> >> > There's plenty of mem

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Mon, 6 Aug 2018, Ard Biesheuvel wrote: > On 6 August 2018 at 10:02, Mikulas Patocka wrote: > > > > > > On Sun, 5 Aug 2018, Florian Weimer wrote: > > > >> On 08/04/2018 01:04 PM, Mikulas Patocka wrote: > >> > There's plenty of memcpy's in the graphics stack. No one will be > >> > rewriting

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > On 3 August 2018 at 22:44, Matt Sealey wrote: > > On 3 August 2018 at 13:25, Mikulas Patocka wrote: > >> > >> > >> On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > >> > >>> Are we still talking about overlapping unaligned accesses here? Or do > >>> you s

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread David Laight
From: Mikulas Patocka > Sent: 05 August 2018 15:36 > To: David Laight ... > There's an instruction movntdqa (and vmovntdqa) that can actually do > prefetch on write-combining memory type. It's the only instruction that > can do it. > > It this instruction is used on non-write-combining memory type

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 10:44, Pavel Machek wrote: > On Mon 2018-08-06 09:04:33, Ramana Radhakrishnan wrote: >> On Sun, Aug 5, 2018 at 10:36 PM, Pavel Machek wrote: >> > Hi! >> > >> >> > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit >> >> > a >> >> > strange problem. >> >>

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Pavel Machek
On Mon 2018-08-06 09:04:33, Ramana Radhakrishnan wrote: > On Sun, Aug 5, 2018 at 10:36 PM, Pavel Machek wrote: > > Hi! > > > >> > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a > >> > strange problem. > >> > > >> > When I use the links browser in graphics mode on the fra

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ard Biesheuvel
On 6 August 2018 at 10:02, Mikulas Patocka wrote: > > > On Sun, 5 Aug 2018, Florian Weimer wrote: > >> On 08/04/2018 01:04 PM, Mikulas Patocka wrote: >> > There's plenty of memcpy's in the graphics stack. No one will be rewriting >> > all the graphics drivers because of tiny market share that ARM

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Ramana Radhakrishnan
On Sun, Aug 5, 2018 at 10:36 PM, Pavel Machek wrote: > Hi! > >> > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a >> > strange problem. >> > >> > When I use the links browser in graphics mode on the framebuffer, I get >> > occasional pixel corruption. Links does memcpy, m

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-06 Thread Mikulas Patocka
On Sun, 5 Aug 2018, Florian Weimer wrote: > On 08/04/2018 01:04 PM, Mikulas Patocka wrote: > > There's plenty of memcpy's in the graphics stack. No one will be rewriting > > all the graphics drivers because of tiny market share that ARM has in > > desktop computers. So if you refuse to fix thin

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-05 Thread Pavel Machek
Hi! > > Can you run the test program on x86 using the similar framebuffer > > setup? Does doing two writes (one aligned and one unaligned but > > overlapping with previous one) cause the same issue? I suspect it > > does, then using memcpy for frame buffers is wrong. I'm pretty sure it will wor

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-05 Thread Pavel Machek
Hi! > > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a > > strange problem. > > > > When I use the links browser in graphics mode on the framebuffer, I get > > occasional pixel corruption. Links does memcpy, memset and 4-byte writes > > on the framebuffer - nothing else.

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-05 Thread Florian Weimer
On 08/04/2018 01:04 PM, Mikulas Patocka wrote: There's plenty of memcpy's in the graphics stack. No one will be rewriting all the graphics drivers because of tiny market share that ARM has in desktop computers. So if you refuse to fix things and blame everyone else, you can as well announce that

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-05 Thread Mikulas Patocka
On Fri, 3 Aug 2018, David Laight wrote: > From: Mikulas Patocka > > Sent: 03 August 2018 13:05 > ... > > > 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

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-04 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Matt Sealey wrote: > On 3 August 2018 at 13:25, Mikulas Patocka wrote: > > > > > > On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > > > >> Are we still talking about overlapping unaligned accesses here? Or do > >> you see other failures as well? > > > > Yes - it is caused by ove

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-04 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Andrew Pinski wrote: > On Fri, Aug 3, 2018 at 5:58 PM Mikulas Patocka wrote: > > > > > > > > On Fri, 3 Aug 2018, Richard Earnshaw (lists) wrote: > > > > > Whoa, hold on. > > > > > > Memcpy should never be used on device memory. Period. Memcpy doesn't > > > know anything a

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Andrew Pinski
On Fri, Aug 3, 2018 at 5:58 PM Mikulas Patocka wrote: > > > > On Fri, 3 Aug 2018, Richard Earnshaw (lists) wrote: > > > Whoa, hold on. > > > > Memcpy should never be used on device memory. Period. Memcpy doesn't > > know anything about what size of access is needed for accessing a device. > > >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Richard Earnshaw (lists) wrote: > Whoa, hold on. > > Memcpy should never be used on device memory. Period. Memcpy doesn't > know anything about what size of access is needed for accessing a device. > > But why is the buffer in device memory rather than some other form of

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ard Biesheuvel
On 3 August 2018 at 22:44, Matt Sealey wrote: > On 3 August 2018 at 13:25, Mikulas Patocka wrote: >> >> >> On Fri, 3 Aug 2018, Ard Biesheuvel wrote: >> >>> Are we still talking about overlapping unaligned accesses here? Or do >>> you see other failures as well? >> >> Yes - it is caused by overlap

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Matt Sealey
On 3 August 2018 at 13:25, Mikulas Patocka wrote: > > > On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > >> Are we still talking about overlapping unaligned accesses here? Or do >> you see other failures as well? > > Yes - it is caused by overlapping unaligned accesses inside memcpy. When I > put "dmb

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Ard Biesheuvel wrote: > (- libc-alpha) > > On 3 August 2018 at 19:09, Mikulas Patocka wrote: > > > > > > On Fri, 3 Aug 2018, Will Deacon wrote: > > > >> On Fri, Aug 03, 2018 at 09:16:39AM +0200, Ard Biesheuvel wrote: > >> > On 3 August 2018 at 08:35, Mikulas Patocka wrote

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ard Biesheuvel
(- libc-alpha) On 3 August 2018 at 19:09, Mikulas Patocka wrote: > > > On Fri, 3 Aug 2018, Will Deacon wrote: > >> On Fri, Aug 03, 2018 at 09:16:39AM +0200, Ard Biesheuvel wrote: >> > On 3 August 2018 at 08:35, Mikulas Patocka wrote: >> > > >> > > >> > > On Thu, 2 Aug 2018, Matt Sealey wrote: >>

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Sinan Kaya
On 8/3/2018 1:09 PM, Mikulas Patocka wrote: Most accelerated graphics drivers rely heavily on the ability to map the VRAM normal-non-cacheable (ioremap_wc, basically), and treat it as ordinary memory. Yeah, I'd expect framebuffers to be mapped as normal NC. That should be fine for prefetchable B

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Will Deacon wrote: > On Fri, Aug 03, 2018 at 09:16:39AM +0200, Ard Biesheuvel wrote: > > On 3 August 2018 at 08:35, Mikulas Patocka wrote: > > > > > > > > > On Thu, 2 Aug 2018, Matt Sealey wrote: > > > > > >> The easiest explanation for this would be that the memory isn?t m

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Richard Earnshaw (lists)
On 03/08/18 14:31, Mikulas Patocka wrote: > > > On Fri, 3 Aug 2018, Andrew Pinski wrote: > >> On Thu, Aug 2, 2018 at 12:31 PM Mikulas Patocka wrote: >>> >>> Hi >>> >>> I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a >>> strange problem. >>> >>> When I use the links bro

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Andrew Pinski wrote: > On Thu, Aug 2, 2018 at 12:31 PM Mikulas Patocka wrote: > > > > Hi > > > > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a > > strange problem. > > > > When I use the links browser in graphics mode on the framebuffer, I get >

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, Florian Weimer wrote: > On 08/03/2018 09:11 AM, Andrew Pinski wrote: > > Yes fix Links not to use memcpy on the framebuffer. > > It is undefined behavior to use device memory with memcpy. > > Some (de facto) ABIs require that it is supported, though. For example, > the PO

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread David Laight
From: Mikulas Patocka > Sent: 03 August 2018 13:05 ... > > 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 x8

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Mikulas Patocka
On Fri, 3 Aug 2018, David Laight wrote: > 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 > >

RE: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread David Laight
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 i

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Richard Earnshaw (lists)
On 03/08/18 10:29, Ard Biesheuvel wrote: > On 3 August 2018 at 11:15, Ramana Radhakrishnan > wrote: >> On Fri, Aug 3, 2018 at 8:53 AM, Florian Weimer wrote: >>> On 08/03/2018 09:11 AM, Andrew Pinski wrote: Yes fix Links not to use memcpy on the framebuffer. It is undefined behavior

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Will Deacon
On Fri, Aug 03, 2018 at 09:16:39AM +0200, Ard Biesheuvel wrote: > On 3 August 2018 at 08:35, Mikulas Patocka wrote: > > > > > > On Thu, 2 Aug 2018, Matt Sealey wrote: > > > >> The easiest explanation for this would be that the memory isn?t mapped > >> correctly. You can?t use PCIe memory spaces wi

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ramana Radhakrishnan
< snip> > I guess the semantics of a framebuffer are not strictly defined, but > the current reality is that it is expected to have memory semantics > (by Linux/glibc) > > Matt is saying fundamental properties of the underlying interconnects > (AMBA) make that impossible on ARM, but I'd like to un

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ard Biesheuvel
On 3 August 2018 at 11:15, Ramana Radhakrishnan wrote: > On Fri, Aug 3, 2018 at 8:53 AM, Florian Weimer wrote: >> On 08/03/2018 09:11 AM, Andrew Pinski wrote: >>> >>> Yes fix Links not to use memcpy on the framebuffer. >>> It is undefined behavior to use device memory with memcpy. >> >> >> Some (

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ramana Radhakrishnan
On Fri, Aug 3, 2018 at 8:53 AM, Florian Weimer wrote: > On 08/03/2018 09:11 AM, Andrew Pinski wrote: >> >> Yes fix Links not to use memcpy on the framebuffer. >> It is undefined behavior to use device memory with memcpy. > > > Some (de facto) ABIs require that it is supported, though. For example

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Szabolcs Nagy
On 03/08/18 08:53, Florian Weimer wrote: On 08/03/2018 09:11 AM, Andrew Pinski wrote: Yes fix Links not to use memcpy on the framebuffer. It is undefined behavior to use device memory with memcpy. Some (de facto) ABIs require that it is supported, though.  For example, the POWER string functio

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Florian Weimer
On 08/03/2018 09:11 AM, Andrew Pinski wrote: Yes fix Links not to use memcpy on the framebuffer. It is undefined behavior to use device memory with memcpy. Some (de facto) ABIs require that it is supported, though. For example, the POWER string functions avoid unaligned loads and stores for t

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Ard Biesheuvel
On 3 August 2018 at 08:35, Mikulas Patocka wrote: > > > On Thu, 2 Aug 2018, Matt Sealey wrote: > >> The easiest explanation for this would be that the memory isn?t mapped >> correctly. You can?t use PCIe memory spaces with anything other than >> Device-nGnRE or stricter mappings. That?s just diffe

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-03 Thread Andrew Pinski
On Thu, Aug 2, 2018 at 12:31 PM Mikulas Patocka wrote: > > Hi > > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a > strange problem. > > When I use the links browser in graphics mode on the framebuffer, I get > occasional pixel corruption. Links does memcpy, memset and 4-

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-02 Thread Mikulas Patocka
On Thu, 2 Aug 2018, Matt Sealey wrote: > The easiest explanation for this would be that the memory isn?t mapped > correctly. You can?t use PCIe memory spaces with anything other than > Device-nGnRE or stricter mappings. That?s just differences between the > AMBA and PCIe (posted/unposted) me

Re: framebuffer corruption due to overlapping stp instructions on arm64

2018-08-02 Thread Matt Sealey
The easiest explanation for this would be that the memory isn’t mapped correctly. You can’t use PCIe memory spaces with anything other than Device-nGnRE or stricter mappings. That’s just differences between the AMBA and PCIe (posted/unposted) memory models. Normal memory (cacheable or uncacheable,

framebuffer corruption due to overlapping stp instructions on arm64

2018-08-02 Thread Mikulas Patocka
Hi I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a strange problem. When I use the links browser in graphics mode on the framebuffer, I get occasional pixel corruption. Links does memcpy, memset and 4-byte writes on the framebuffer - nothing else. I found out that th