Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3521665imm; Mon, 6 Aug 2018 06:19:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8meHxpGKG/kr/+s0pHJljuISNJVmmH7nfMf2ubPv1LY/5ujlao8Qi8qYVd0HYZo03B88m X-Received: by 2002:a17:902:bd42:: with SMTP id b2-v6mr13990984plx.205.1533561587105; Mon, 06 Aug 2018 06:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533561587; cv=none; d=google.com; s=arc-20160816; b=HN4UpbsytKOMEvKDRVn5Y30/eA2utT5xMw2glq8Zswgokh0NyW5lEWCn1zE8HZiypP UUNVJRCHI4FcJzjp/qId90w+9QRR2Z5fxV2ofOBivjx4YB+HsW7i5q0yARHEw5d1rldm j8pO5A0LxJpUUadgq+5ntS+V8Dl98OuetdRYAb6rK9UzCQQi6ALJTgcjIj/kgwqmjiTR YMhUqoOqnTd/R6EhmMubVvhVn8jgbbjl/Tx+sRDipyAY2xV2S0ITsc3e1HMdQ+4LE/zL sKhcS1GmvPuc5mmDLFYUzJ5emzapNRwx/YCe+IooSty8UjUKEtIh4740re4xP3gWgM4O 8XHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=8IZgJnrHcdBF9vNwG3q57EF9HztlMG74k7CuyBh3X+E=; b=xpHfQC+hhg/+tkByWj2+RguoplCFr3YmBHY9kp/Lg+bnUrMBHw4pFy/c/2q88oIGgR IsZoJFf3O42jaxd8733KHwjuVHc8cBua43dxDfNBH6LVnSCyk+FOswVY0ZU8Y26tUkpT XgUtkpjOncIyhtaFCxsLtqxhHwNDsAqgB3VSpzWFKe9q328gnpvayvX04Bz+zKeRXrp0 lG2D7H7GaOFi4FiR5fft1admljbEZ3jZ2Ot2Rrl9qgPwl/IjklzthuipvHloLpPamLHz TY0gLphME2eoLl8cnQEamadWzIdcXS2CuPOA+mQkHY9lcSlozHjPzFlDw3xh+MBOdjvY 2y3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V9isvjqX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4-v6si12316346pga.320.2018.08.06.06.19.32; Mon, 06 Aug 2018 06:19:47 -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; dkim=pass header.i=@linaro.org header.s=google header.b=V9isvjqX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730380AbeHFPCH (ORCPT + 99 others); Mon, 6 Aug 2018 11:02:07 -0400 Received: from mail-io0-f169.google.com ([209.85.223.169]:37275 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727340AbeHFPCH (ORCPT ); Mon, 6 Aug 2018 11:02:07 -0400 Received: by mail-io0-f169.google.com with SMTP id z19-v6so10914071ioh.4 for ; Mon, 06 Aug 2018 05:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8IZgJnrHcdBF9vNwG3q57EF9HztlMG74k7CuyBh3X+E=; b=V9isvjqXYX8Lb27pqy4AfCOn1QNi6VWUos1xyOjv/69KcmWbZfILLf5Qobf8NgBDU8 1zpxFMvXZKmcbZK/i0363B/4ZNiw91IKPgXBgW9dd0vGstxGydCBNRoasAvTXOnGAhV6 Bxxr3FvzOMatFQylJYF6i8HwHTxx/skZ5tMF8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8IZgJnrHcdBF9vNwG3q57EF9HztlMG74k7CuyBh3X+E=; b=arizgIutWfBUj6FlVFA3G5a7jO7g0R2F396o0NgI368bPCoBDolmokzKWGnDLjnC8I VGjBak5wYgRYpof9IYNDKopxl2XJlvdbPBUY2g8Sl83vjEosDrBFdfNnX8BpAUK20ivm OvKAZRloR6LKHMaXUcTot1RtUO0O5dFfKByIW73T7Gl6TVGU7Ea/ZgzrIl+OQLxlmn3D cVccHfx30jHKwWtoFuOLg+Eof7g307K6piUU+/Kkz/Kka4NOWfhLm6avnQTatiRDGkf8 sGcW7oc3zLrMaBVS5F0MHvUCA1Hjm9VkmKDdJNlSUiSObU9mhYRIz7Jnpyk4VCUh1Fus cCZw== X-Gm-Message-State: AOUpUlFhH5pqlrQYXulEgUrCVkVuBH3ufOmQ1IQeQhi+AnvBM3RXd57B +Zx2CfQbyT0tf2+S/nC6ivbsafilACjghMVMB9tH8w== X-Received: by 2002:a6b:5208:: with SMTP id g8-v6mr15623883iob.60.1533559988112; Mon, 06 Aug 2018 05:53:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Mon, 6 Aug 2018 05:53:07 -0700 (PDT) In-Reply-To: <99fff4fe-afa9-f12f-a518-472a9dd1c530@arm.com> References: <20180803094129.GB17798@arm.com> <99fff4fe-afa9-f12f-a518-472a9dd1c530@arm.com> From: Ard Biesheuvel Date: Mon, 6 Aug 2018 14:53:07 +0200 Message-ID: Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 To: Robin Murphy Cc: Mikulas Patocka , Thomas Petazzoni , Joao Pinto , linux-pci , Jingoo Han , Will Deacon , Russell King , Linux Kernel Mailing List , Matt Sealey , Catalin Marinas , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > >> I observe these kinds of corruptions: >> - failing to write a few bytes > > > That could potentially be explained by the reordering/atomicity issues Matt > mentioned, i.e. the load is observing part of the store, before the store > has fully completed. > OK, so that means the unaligned transaction gets split, and the subtransactions are reordered with the aligned transaction so that the sub-writes contain stale values from the sub-reads? >> - writing a few bytes that were written 16 bytes before >> - writing a few bytes that were written 16 bytes after > > > Those sound more like the interconnect or root complex ignoring the byte > strobes on an unaligned burst, of which I think the simplistic view would be > "it's broken". > > FWIW I stuck my old Nvidia 7600GT card in my Arm Juno r2 board (2x > Cortex-A72), built your test program natively with GCC 8.1.1 at -O2, and > it's still happily flickering pixels in the corner of the console after > nearly an hour (in parallel with some iperf3 just to ensure plenty of PCIe > traffic). I would strongly suspect this issue is particular to Armada 8k, so > its' probably one for the Marvell folks to take a closer look at - I believe > some previous interconnect issues on those SoCs were actually fixable in > firmware. > IIRC that was DVM dropping a few VA bits at the top, and a single MMIO control bit to put it back into 'non-broken' mode.