From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DCACC46470 for ; Wed, 8 Aug 2018 18:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0278021797 for ; Wed, 8 Aug 2018 18:56:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0278021797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730019AbeHHVRE (ORCPT ); Wed, 8 Aug 2018 17:17:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727609AbeHHVRE (ORCPT ); Wed, 8 Aug 2018 17:17:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 604DC40241C7; Wed, 8 Aug 2018 18:56:03 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 020C02166BA0; Wed, 8 Aug 2018 18:56:03 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w78Iu2mj031439; Wed, 8 Aug 2018 14:56:02 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w78Iu2XG031435; Wed, 8 Aug 2018 14:56:02 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 8 Aug 2018 14:56:02 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: David Laight cc: "'Arnd Bergmann'" , Catalin Marinas , Thomas Petazzoni , Joao Pinto , Ard Biesheuvel , linux-pci , Will Deacon , Russell King - ARM Linux , Linux Kernel Mailing List , "neko@bakuhatsu.net" , Jingoo Han , Linux ARM Subject: RE: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: Message-ID: References: <20180803094129.GB17798@arm.com> <20180808121641.GB24736@iMac.local> <19c70d2a0b224db78f72dd316ad006b8@AcuMS.aculab.com> <20180808145017.GE24736@iMac.local> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 08 Aug 2018 18:56:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 08 Aug 2018 18:56:03 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, src, len > > > add dst_end, dst, len > > > ldr x0, [src] > > > ldr x1, [src_end - 8] > > > str x0, [dst] > > > str x1, [dst_end - 8] > > I've done that myself (on x86) copied the last 'word' first then > everything else in increasing address order. > > > > The ARM64 memcpy uses this trick heavily in order to reduce branching, and > > > this is what makes the PCIe controller choke. > > More likely the write combining buffer? When I write to memory (using the NC mapping - that is also used in the PCI BAR), I get no corruption. So the corruption must be in the PCIe controller, not the core or memory subsystem. I also tried to disable write streaming on NC mapping with a chicken bit, but it didn't help. > > So when a single unaligned 'stp' gets translated into a PCIe with TLP > > with length=5 (20 bytes) and LastBE = ~1stBE, write combining the > > overlapping stores gives us a TLP with a longer length (5..8 for two > > stores), and byte-enable bits that are not exactly a complement. > > Write combining should generate a much longer TLP. > Depending on the size of the write combining buffer. > > But in the above case I'd have thought that the second write > would fail to 'combine' - because it isn't contiguous with the > stored data. > > So something more complex will be going on. > > David Mikulas