Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3600125imm; Mon, 6 Aug 2018 07:33:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfhtUeOkLzR3bBGdFtVeMtjjVgUm0YQ6vnB/tJZZzFExbuqFsCaMlx/AM628en1CBOXqdJQ X-Received: by 2002:a62:c0c4:: with SMTP id g65-v6mr17262817pfk.72.1533565986993; Mon, 06 Aug 2018 07:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533565986; cv=none; d=google.com; s=arc-20160816; b=0dWu+p0HsTYs1YlEku9eXU28QbUkNfbSt63nqxu7E+iITLg9aYL7ZM8ZVz7ialTGa0 xH15qZNij8BJdvOIFzpxG2fCf3LjuClkN9lRl9TxGTSgYNzIDHucAcdk6PH4Jb/RqwLG 194/q7QEoGUeEzRFKxyFUngcs7YPZf9UfYdNcaN0I3rGcbmEWPXz6O0geZsyRGjG2c9R rwvmFIDOmbmx5T3hP7aG59FN+b9yv8ObN9I6fomsvI//eAnpqaEdiDF9MjGt2mMVwucz BcFrDHR+S4vEJJf0yHm03Uf/AR4S7PnyM8Q6na971GuosuKJepozKVVFB5Nn6Gn2AZKz KHvw== 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=sDtRsZGytiqEgphLvGTTCam/VfuISecx6ML5HojZbTo=; b=j5w5ZSxgk1hGNmHOgop3AfthLD8htl6kqroFWUue33QDuHmVlRHmMQVTKDJ/FERq0g MiIHyqQAiNVxkIrU9L6XcOZ4DM3Gok0PPEsr8yJzW3+vNK9RDLzulL3/PlOeEs6+5saJ YYXxD76sZr/vEBJG6MlPqs4Wt3j5uOkWynnbcQNFF6K2wXUsdt1P1Ovxf4flt04C0JUx FZPb6ADvnBXujKkSp/qDfKLJD1RCFSo6wFhtS6yTidP2YzjkOaLm4+RF2kCYXyIbVx0U 4/KZqEmf6VhobpQWUDd2GcfZQoRn7x6+WG1eGluVYrgvy0Z6BajeS1F7xV2q8WkgOKbC DsMQ== 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 x63-v6si14395243pfb.299.2018.08.06.07.32.51; Mon, 06 Aug 2018 07:33:06 -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 S1731524AbeHFQjk (ORCPT + 99 others); Mon, 6 Aug 2018 12:39:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60688 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728723AbeHFQjk (ORCPT ); Mon, 6 Aug 2018 12:39:40 -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 3189281663F1; Mon, 6 Aug 2018 14:30:17 +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 D49801049487; Mon, 6 Aug 2018 14:30:16 +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 w76EUGOx015286; Mon, 6 Aug 2018 10:30:16 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w76EUFkb015282; Mon, 6 Aug 2018 10:30:16 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Mon, 6 Aug 2018 10:30:15 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Pavel Machek cc: Andrew Pinski , Richard Earnshaw , ard.biesheuvel@linaro.org, Ramana Radhakrishnan , Florian Weimer , thomas.petazzoni@free-electrons.com, GNU C Library , Catalin Marinas , Will Deacon , linux@armlinux.org.uk, LKML , linux-arm-kernel@lists.infradead.org Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <20180805215150.GB1862@amd> Message-ID: References: <9acdacdb-3bd5-b71a-3003-e48132ee1371@redhat.com> <11f9185a-7f71-83df-3a57-0a0ae9c1f934@arm.com> <20180805215150.GB1862@amd> 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.8]); Mon, 06 Aug 2018 14:30:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 06 Aug 2018 14:30:17 +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 Sun, 5 Aug 2018, Pavel Machek wrote: > Hi! > > > > Can you run the test program on x86 using the similar framebuffer > > > setup? Does doing two writes (one aligned and one unaligned but > > > overlapping with previous one) cause the same issue? I suspect it > > > does, then using memcpy for frame buffers is wrong. > > I'm pretty sure it will work ok on x86. > > > Overlapping unaligned writes work on x86 - they have to, because of > > backward compatibility. > > It is not that easy. 8086s (and similar) did not have MTRRs and PATs > either. Overlapping unaligned writes _on main memory_, _with normal > MTRR settings_ certainly work ok on x86. It works even with write-combining. Write-combining specifies, that the writes may hit the framebuffer in unspecified order. But if the writes are overlapping, the CPU can't just reorder them and write the wrong result to the framebuffer. > Chances is memory type can be configured to work similar way on your > ARM/PCIe case? ARM has memory types GRE, nGRE, nGnRE, nGnRnE - that allow or not allow gathering, reordering, early write acknowledgement. Unfortunatelly, all these memory types will trigger a fault on unaligned accesses. It has also Non-Cached memory type (some people on this thread believe that it can't be used for GPUs, some believe that it can) - this memory type supports unaligned accesses, so it is actually used for framebuffers on ARM. If we had a memory type that didn't do early write acknowledgement and supported unaligned accesses, it would solve this problem. Mikulas