Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp473587imm; Fri, 3 Aug 2018 06:33:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe3CRzNLbcayxG58fEO6TQyOb7RiwIQax1/ts+O5TKhdB2nGYg4hx1R2KV/fzPSe1otwfQh X-Received: by 2002:a17:902:aa8f:: with SMTP id d15-v6mr3682609plr.64.1533303190486; Fri, 03 Aug 2018 06:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533303190; cv=none; d=google.com; s=arc-20160816; b=ubA4vTEdTLn9dgLkR627Q0zceEG/g1ivMf1rjz9WfVEKzNPuuphuvm+/OyUpl0d4Am ezrezJFmwch2nshYADNeXA6v76LYZg9PnOTGXZSxW+vM0iGSSVmlao2JJVmNey3SWUfL agcI3qkyTovctanYEpaLt7fSBITd8ZoiZR3btaMDVGBaDZ5yD53N0Om/FEouYpV1e+2i GoOXC0AmuQ5l2h/aIL0J+dUBiD5Me314w3z/GmUk36oRL/zQ0BG7jJgwvcgO1kf8pzqV b2vV4qVabyZJ+FvDAzgW3GWe64WBD7B2GdS90nGPY/S0moRxn5yabG0R/DlTM8sC/pRa QM3Q== 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=A8Q9QdgYncO8ux9GkIBvQ/KNONbN3ww4Wwpj6mshk6c=; b=G5cJJYL7uAN1iRHhfHQVNdtxqFBv/SlbIUJQlVaXmCZc/EQm/b+FE1mBrzr6nDmSUk 152Ds9R/oN1GKhD263bs2tBMvvc0KKAmTKLap0wnuOVGVz4EPhd3vg9wctZC5I1xvqED lqey4i4YKXGSAF3P162CkkDi9YO0DuO3KXUGxZ4ouxHwg8BT25iHqCjfhS2lwRvRWurq hKHKOJnyigczbhQGCzvfbAxo+NJmHBevUnkLLiWUiYM4inb1/4XcXP36S9lp5KW2e2lc wqaLKAt80YjYs2kf6cJdTBJYr/upT96ibmUevnhlePYbuMWjVBs5iR5ZI/NFO7eEfGv1 6gpA== 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 n2-v6si3546982plp.276.2018.08.03.06.32.55; Fri, 03 Aug 2018 06:33:10 -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 S1732271AbeHCP1k (ORCPT + 99 others); Fri, 3 Aug 2018 11:27:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58674 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728758AbeHCP1k (ORCPT ); Fri, 3 Aug 2018 11:27: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 C5C97401DE61; Fri, 3 Aug 2018 13:31: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 87B9A100725D; Fri, 3 Aug 2018 13:31:17 +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 w73DVHaW029676; Fri, 3 Aug 2018 09:31:17 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w73DVHm7029672; Fri, 3 Aug 2018 09:31:17 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 3 Aug 2018 09:31:16 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Andrew Pinski cc: Catalin Marinas , Will Deacon , linux@armlinux.org.uk, thomas.petazzoni@free-electrons.com, linux-arm-kernel@lists.infradead.org, LKML , GNU C Library Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: Message-ID: References: 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.6]); Fri, 03 Aug 2018 13:31:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 13:31: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 Fri, 3 Aug 2018, Andrew Pinski wrote: > On Thu, Aug 2, 2018 at 12:31 PM Mikulas Patocka wrote: > > > > Hi > > > > I tried to use a PCIe graphics card on the MacchiatoBIN board and I hit a > > strange problem. > > > > When I use the links browser in graphics mode on the framebuffer, I get > > occasional pixel corruption. Links does memcpy, memset and 4-byte writes > > on the framebuffer - nothing else. > > > > I found out that the pixel corruption is caused by overlapping unaligned > > stp instructions inside memcpy. In order to avoid branching, the arm64 > > memcpy implementation may write the same destination twice with different > > alignment. If I put "dmb sy" between the overlapping stp instructions, the > > pixel corruption goes away. > > > > This seems like a hardware bug. Is it a known errata? Do you have any > > workarounds for it? > > Yes fix Links not to use memcpy on the framebuffer. > It is undefined behavior to use device memory with memcpy. > > Thanks, > Andrew Pinski Links can be fixed easily - but there is exterme amount of code that accesses videoram via C pointers in the Xserver and in the GPU drivers. How do you intend to fix that? What should we use instead of direct access or memcpy? Libc doesn't provide any macros or functions for framebuffer access. Using hardcoded assembler doesn't make the the programs portable. Mikulas