Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3765567imm; Mon, 6 Aug 2018 10:11:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeuzykLNsPPiQJY0F4pOuCqcKtZC3cPJFDh7fP3R/ITHTjlz8GwCLCCnqo1mleFFYmbq0FM X-Received: by 2002:a63:6604:: with SMTP id a4-v6mr14983424pgc.404.1533575479540; Mon, 06 Aug 2018 10:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533575479; cv=none; d=google.com; s=arc-20160816; b=MjgsL99KLMGVpOri04Rwb0O4Nn2RMKpzflqh7by1Bp7uOfcsgZ6FRmgTUWUpsRodkk mra+WF6GUkhGKVOw4VqEVtlFO82aiiHKRLfeUPrASCxc6zaIWRz8DbEluKGg7fAJjdvv n8sHcDzI3HeMHfGezAKrmA/01l8JmLPyCbL1aKolY7Qz6odRvGTCer+lMrLOvbAxaPqu /NEJfVoLp/J+L9L9viNEWw2+Ri1t2Vc1HDwNKEWJo6mWGMhIF7f4Yek271cAn5buNXie I3iYMcEipQt6O0HMjBvNxn3ivbkq/VVyFn19iBw19d3Rre4aCPkjxGybr7VAPP1CQVVl KG3A== 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=SQKufpz44d3FS6+liCM1dzNg9XoHG8WJPPGvedeF7OE=; b=j8/XJ+4AbaMPx9SwoGV+kalh2KIglqFMAf1uzU6xEheSLpyQbXY6HUvCueFdenJvQB vwTm+iFYT7CJubmTq9l8mtORhXCY+S6+dnC6eFBl6gAZOpvCsp0kBV3A+0Q1HaN/btBW zvqqCLFYlyeFdkSzpMn5OXmccHVIi0BgQw6F2WdX43XI6tbwsnR0jgHXAfzy+bNjdN09 SF5odlImy/YtXoECDUG5LxzFsmuv1r6hfD93LT+8liqITNbZKJ8KpddQxzzLmnnYLZR/ N71JfR+sVHri/rGsNWx+Pd1pIAa4xfVkkbWfPsDB+D006YgSUTmoY3tl2n3MEjOgBj5m noDg== 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 x11-v6si10444405plo.172.2018.08.06.10.11.04; Mon, 06 Aug 2018 10:11:19 -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 S1732514AbeHFTTY (ORCPT + 99 others); Mon, 6 Aug 2018 15:19:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36450 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728349AbeHFTTY (ORCPT ); Mon, 6 Aug 2018 15:19:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EBC07C6CA; Mon, 6 Aug 2018 17:09:21 +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 302FA1049497; Mon, 6 Aug 2018 17:09:21 +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 w76H9LDY013564; Mon, 6 Aug 2018 13:09:21 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w76H9I0n013559; Mon, 6 Aug 2018 13:09:19 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 6 Aug 2018 13:09:18 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Ard Biesheuvel cc: Robin Murphy , Thomas Petazzoni , Joao Pinto , linux-pci , Jingoo Han , Will Deacon , Russell King , Linux Kernel Mailing List , Matt Sealey , Catalin Marinas , linux-arm-kernel Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: Message-ID: References: <20180803094129.GB17798@arm.com> <99fff4fe-afa9-f12f-a518-472a9dd1c530@arm.com> 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.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 06 Aug 2018 17:09:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Mon, 06 Aug 2018 17:09:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 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 data to > >>> the memory locations that are covered by both, and so the ordering in > >>> which the transactions are received should not affect the outcome. > >> > >> > >> You're right that the corruption couldn't be explained just by reordering > >> writes. My hypothesis is that the PCIe controller tries to disambiguate > >> the overlapping writes, but the disambiguation logic was not tested and it > >> is buggy. If there's a barrier between the overlapping writes, the PCIe > >> controller won't see any overlapping writes, so it won't trigger the > >> faulty disambiguation logic and it works. > >> > >> Could the ARM engineers look if there's some chicken bit in Cortex-A72 > >> that could insert barriers between non-cached writes automatically? > > > > > > I don't think there is, and even if there was I imagine it would have a > > pretty hideous effect on non-coherent DMA buffers and the various other > > places in which we have Normal-NC mappings of actual system RAM. > > > > Looking at the A72 manual, there is one chicken bit that looks like it > may be related: > > CPUACTLR_EL1 bit #50: > > 0 Enables store streaming on NC/GRE memory type. This is the reset value. > 1 Disables store streaming on NC/GRE memory type. > > so putting something like > > mrs x0, S3_1_C15_C2_0 > orr x0, x0, #(1 << 50) > msr S3_1_C15_C2_0, x0 > > in __cpu_setup() would be worth a try. It won't boot. But if i write the same value that was read, it also won't boot. I created a simple kernel module that reads this register and it has bit 32 set, all other bits clear. But when I write the same value into it, the core that does the write is stuck in infinite loop. So, it seems that we are writing this register from a wrong place. Mikulas