Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1166566imm; Wed, 8 Aug 2018 11:57:12 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyoC8rk5lxf1540sNgi46Caga7sZsBoIfc8DnH8Ly5Kw1NDRHkPn7T3gUVAdv/BcGYx/VYW X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr3635009plg.153.1533754632788; Wed, 08 Aug 2018 11:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533754632; cv=none; d=google.com; s=arc-20160816; b=lwHdnh8snXmWiFBSnbvytuFoGMNK02XLoMwadyh0CmQ9MlY44b3PF976kdkoS8Z7kH 49OGEBeh2yiQF+WnaBFNGQSmrgCJOV9sPQmiBqbOcd0lxdS+vcfo+N8/+tJnRs0n9AST wHpKYOT/fOYoHXJc4NUALwwJ5nRY5ABJaAn459EtpIKWWMlgbdy1mqUIIJsmhrraSjnK iIHxMihh3OZfwzrRV1WdWYuWkqav5Aud9W9SA/Wcche/o9qjIpymlEhv+cp2x+iLMU4R ADXhLx+dgtGJWL6AapHtbLeAcfAE6gkfkI4Xiw0bsxIVVsGk88SkzaleD5by3Dfcc9FQ hCPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=tlsbcJvI43WRTzt5tS508h0zl7tVcUAYxl/cpU3uJLw=; b=RFIASWD1NkeUg08z+1s/3GWwqLqyQE6X9abmT3JkuIEIvsobFAq7iuvxRiqj29fM9Y B4GUzSAWpfndK5jNgcP2kFqgMT8GJoUYKzKh51rDU3N2FC4JqNElUpqPuVT4rPUITa+r PIhz/ZqJ5d/dpJNfHXeb0TUUELxcdDwU/KjDVPZ4B60Mt93onatbCZAVnOtOyS3BOGG5 59jl/1al/1fcM1MkSdCjtucAzX9nZK9YPaZMt8RVM8wkXXNOPpBHz/wipuuyzHCAKJ3f mtJU5o8RUOhVdeo3w+prEj8SYrX+kiOG4hIGFhmBjQvhsLvkiUZIQqFw/UHVpVSskzVD jXpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c32-v6si4745321pgc.129.2018.08.08.11.56.56; Wed, 08 Aug 2018 11:57:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729997AbeHHVRE (ORCPT + 99 others); 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