linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Joao Pinto <Joao.Pinto@synopsys.com>,
	libc-alpha@sourceware.org,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Jingoo Han <jingoohan1@gmail.com>,
	Will Deacon <will.deacon@arm.com>,
	Russell King <linux@armlinux.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Matt Sealey <neko@bakuhatsu.net>,
	linux-pci@vger.kernel.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64
Date: Wed, 8 Aug 2018 15:28:53 +0100	[thread overview]
Message-ID: <20180808142852.GD24736@iMac.local> (raw)
In-Reply-To: <alpine.LRH.2.02.1808081011110.9997@file01.intranet.prod.int.rdu2.redhat.com>

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() % (LEN + 1);
> > > 		if (start > end)
> > > 			continue;
> > > 		for (i = start; i < end; i++)
> > > 			data[i] = val++;
> > > 		memcpy(map + start, data + start, end - start);
> > > 		if (memcmp(map, data, LEN)) {
> > 
> > It may be worth trying to do a memcmp(map+start, data+start, end-start)
> > here to see whether the hazard logic fails when the writes are unaligned
> > but the reads are not.
> > 
> > This problem may as well appear if you do byte writes and read longs
> > back (and I consider this a hardware problem on this specific board).
> 
> I triad to insert usleep(10000) between the memcpy and memcmp, but the 
> same corruption occurs. So, it can't be read-after-write hazard. It is 
> caused by the improper handling of hazard between the overlapping writes 
> inside memcpy.

It could get it wrong between subsequent writes to the same 64-bit range
(e.g. the address & ~63 is the same but the data strobes for which bytes
to write are different). If it somehow thinks that it's a
write-after-write hazard even though the strobes are different, it could
cancel one of the writes.

It may be worth trying with a byte-only memcpy() function while keeping
the default memcmp().

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2018-08-08 14:28 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LRH.2.02.1808021242320.31834@file01.intranet.prod.int.rdu2.redhat.com>
     [not found] ` <CAHCPf3tFGqkYEcWNN4LaWThw_rVqT316pzLv6T7RfxwO-eZ0EA@mail.gmail.com>
     [not found]   ` <alpine.LRH.2.02.1808030212340.17672@file01.intranet.prod.int.rdu2.redhat.com>
     [not found]     ` <CAKv+Gu8DeuksZhk1g3q_msSKV_hSY_2e1uzVten9-oGO3j9Sqg@mail.gmail.com>
     [not found]       ` <20180803094129.GB17798@arm.com>
2018-08-03 17:09         ` framebuffer corruption due to overlapping stp instructions on arm64 Mikulas Patocka
2018-08-03 17:32           ` Sinan Kaya
2018-08-03 17:33           ` Ard Biesheuvel
2018-08-03 18:25             ` Mikulas Patocka
2018-08-03 20:44               ` Matt Sealey
2018-08-03 21:20                 ` Ard Biesheuvel
2018-08-06 10:25                   ` Mikulas Patocka
2018-08-06 12:42                     ` Robin Murphy
2018-08-06 12:53                       ` Ard Biesheuvel
2018-08-06 13:41                       ` Marcin Wojtas
2018-08-06 13:48                         ` Ard Biesheuvel
2018-08-06 14:07                           ` Marcin Wojtas
2018-08-06 14:13                             ` Mikulas Patocka
2018-08-06 15:47                       ` Ard Biesheuvel
2018-08-06 17:09                         ` Mikulas Patocka
2018-08-06 17:21                           ` Ard Biesheuvel
2018-08-06 19:54                             ` Mikulas Patocka
2018-08-06 20:11                               ` Ard Biesheuvel
2018-08-06 20:31                                 ` Mikulas Patocka
2018-08-07 16:40                                 ` Marcin Wojtas
2018-08-07 17:39                                   ` Mikulas Patocka
2018-08-07 18:07                                     ` Ard Biesheuvel
2018-08-07 18:17                                       ` Mikulas Patocka
     [not found]                                     ` <CAPv3WKcKoEe=Qysp6Oac2C=G9bUhUQf1twSRCY+_qJ6XEC-iag@mail.gmail.com>
2018-08-08 14:10                                       ` Mikulas Patocka
2018-08-06 17:13                         ` Catalin Marinas
2018-08-06 17:19                           ` Mikulas Patocka
2018-08-08 18:31                       ` Mikulas Patocka
2018-08-04 13:29                 ` Mikulas Patocka
2018-08-08 12:16                 ` Catalin Marinas
2018-08-08 13:02                   ` David Laight
2018-08-08 13:46                     ` Mikulas Patocka
2018-08-08 14:26                       ` David Laight
2018-08-08 14:50                         ` Catalin Marinas
2018-08-08 16:21                           ` Mikulas Patocka
2018-08-08 16:31                             ` Arnd Bergmann
2018-08-08 16:43                               ` David Laight
2018-08-08 18:56                                 ` Mikulas Patocka
2018-08-08 18:37                         ` Mikulas Patocka
2018-08-08 11:39           ` Catalin Marinas
2018-08-08 14:12             ` Mikulas Patocka
2018-08-08 14:28               ` Catalin Marinas [this message]
2018-08-08 18:40                 ` Mikulas Patocka
2018-08-08 15:01               ` Richard Earnshaw (lists)
2018-08-08 15:14                 ` Catalin Marinas
2018-08-08 16:01                   ` Arnd Bergmann
2018-08-08 18:25                     ` Mikulas Patocka
2018-08-08 21:51                       ` Arnd Bergmann
2018-08-09 15:29                         ` Arnd Bergmann

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=20180808142852.GD24736@iMac.local \
    --to=catalin.marinas@arm.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=jingoohan1@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mpatocka@redhat.com \
    --cc=neko@bakuhatsu.net \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=will.deacon@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).