Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1019519imm; Wed, 8 Aug 2018 09:23:29 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyFLlSqdi6TjtfGBklkuJWrtepsyzJKZHE7MzGKZnKLyug2K/ixT56PurbYQMO4GfQXwxBe X-Received: by 2002:a63:df50:: with SMTP id h16-v6mr3054227pgj.300.1533745409340; Wed, 08 Aug 2018 09:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533745409; cv=none; d=google.com; s=arc-20160816; b=ow/jzX2BykqtuWBcuE9LWpq7REdkpWslnT7zhWFPjl1ThFajxFwYyqw4dRQTOLvB94 D+zmXyvUWAOC9s0fQdkWMsK3BgR6bbrN5q48KxPnApJhluc0ihWa3W3Gd/1zjFl8XkEE IDRFtxvqIpla/CP9z+0Hv6EH4UE1T8C2bbhPX8iX8AYgdR95VDFgERbQ6/RqNs+YFcQL 8329oOTotdHL3kdDiGcXqKDi4hfVxSzjjqS3DcHy1aTRZAZL9SNcG2Buoz+l6xymfYqs W+HqPEC1PVfSEzFApofHrGcniMbDR2xiiorL3dRUsSaEjKj7lrxVLDbWPQFNujcBJp5B pnTQ== 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=SpHPIEZe8lzeieldUS8FSO6/pB/gpm2Fw/5F/0qJDtc=; b=J/gd/G9O7BVIAnEBOKaUN1huBdrTGZ4I1X7iqBH5o9lVVeEDaCVdrpQIozKSYRSW// KpM2WSWSaS+sfdUMWcpM6rz9l8Ai5X8B4Td6spWmTIwtTU/r0j3xh55O+bLArk6lLSZb YtAVWqnE5OYjSESaX/dEZSHCIEpEJ9LT9kN4w0WRjOBkNUyunSZFkT3Y5KJIL12qVPl7 dN3XcuA4zjhNBhvleuR3lTwMzATKbeILDU4Vjg/xKWWUHi3HXlnCza7BdFnaBmg73peb xJd/HBkRYamyCtceAuuZNMzPKtb1ej7auAhcma7vG5mwSYg3gr+lQN9ut5b+J3sQVL3J 7njA== 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 n1-v6si4027500pge.57.2018.08.08.09.23.14; Wed, 08 Aug 2018 09:23:29 -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 S1728075AbeHHSl6 (ORCPT + 99 others); Wed, 8 Aug 2018 14:41:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727062AbeHHSl6 (ORCPT ); Wed, 8 Aug 2018 14:41:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 02E1B402316D; Wed, 8 Aug 2018 16:21:33 +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 B4E091C73B; Wed, 8 Aug 2018 16:21:32 +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 w78GLWpm002695; Wed, 8 Aug 2018 12:21:32 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w78GLVoR002682; Wed, 8 Aug 2018 12:21:31 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 8 Aug 2018 12:21:31 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Catalin Marinas cc: David Laight , Thomas Petazzoni , Joao Pinto , Ard Biesheuvel , Will Deacon , Russell King , Linux Kernel Mailing List , Matt Sealey , linux-pci , Jingoo Han , linux-arm-kernel Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <20180808145017.GE24736@iMac.local> 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.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 08 Aug 2018 16:21:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 08 Aug 2018 16:21:33 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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, Catalin Marinas wrote: > On Wed, Aug 08, 2018 at 02:26:11PM +0000, 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 the > > same physical locations) or an aligned write followed by an > > unaligned one that updates part of the earlier write. > > (Or the opposite order?) > > In the memcpy() case, there can be a sequence of unaligned writes but > they would not modify the same byte (so no overlapping address at the > byte level). 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] The ARM64 memcpy uses this trick heavily in order to reduce branching, and this is what makes the PCIe controller choke. Mikulas