Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1079873imm; Fri, 3 Aug 2018 18:00:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYqM4aHpIs1yAfs/oU1Y6m6tWvJU8LBEp2bYI2x6FPd6KwSJdaXNgBSlVloL4io6BU20mD X-Received: by 2002:a62:3306:: with SMTP id z6-v6mr6736000pfz.85.1533344410314; Fri, 03 Aug 2018 18:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533344410; cv=none; d=google.com; s=arc-20160816; b=giRXWaWMRaYWdJEESHrhQLvM+PDhchSCYaxiD4woEqTh/kV496nkzgbuVqLyXHXt6s LSJGWrFj/kZUpEkot4PQ+01PM5/5KOOe4AYWlAEaVPkGsE17jzBEBatve1msRYircSBb 8qApjFsk1gSY1XcXWJzV8fUmbY0sppb+d7PuUUo9dYf2nHtLvaiSxGbB+5NIfmAf/Ji7 iA+lDXVw7L9yAkQ9+F1H2quBs2dQdxIVw0gUN1SKupMN3GVsbxrzNHi3bbLwJHKefw8I e1qGOCrPXURFEAWk7pO6kdpQRhwtNaQTtIVSFbA+p+ASZshRU+gdM5ss/Pcx8+jSWoed ucmw== 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=YnrZu4QUcIhSWOfrj+9fQODO1wptnix2OsNegGHUKzo=; b=CIG0CxyqU8G/K8ofK5D+3aJEj9amU6Rcm0vda0ly2XHguZ/0PvrLNHLgRIcMY4pU1W id1m4hYeDfKgUFZer6pgJ0tMQDUOjZpbRr/ebT7dJm80MWi6gOv5xC8F6cFOXil6Zne6 W/ThyMZTBSE+UOYM8C1ZFMGsogKCsFXTJlk90B8CLDltCA3TRsYFIBQBN1B0JQ9nHxrj v0v8TBaepNeQju7oilHLqpxfhrdLl3uc6tKaArnVaYXsdBGm4ZjT4HsDXnXplQ8YJ/MM wbRBqAXZqonMkLHHcGZGIVcfLZa0LFYwq/nqvBdLFak68aSkLsBwVA8Z2CdpjST6tVy+ 4fsQ== 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 s27-v6si5723948pgn.159.2018.08.03.17.59.42; Fri, 03 Aug 2018 18:00: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 S1732222AbeHDC47 (ORCPT + 99 others); Fri, 3 Aug 2018 22:56:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731959AbeHDC47 (ORCPT ); Fri, 3 Aug 2018 22:56:59 -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 291F24067720; Sat, 4 Aug 2018 00:58:20 +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 B8BC81DB47; Sat, 4 Aug 2018 00:58:19 +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 w740wJEA026593; Fri, 3 Aug 2018 20:58:19 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w740wI0n026589; Fri, 3 Aug 2018 20:58:18 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 3 Aug 2018 20:58:18 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: "Richard Earnshaw (lists)" cc: Ard Biesheuvel , Ramana Radhakrishnan , Florian Weimer , Thomas Petazzoni , GNU C Library , Andrew Pinski , Catalin Marinas , Will Deacon , Russell King , LKML , linux-arm-kernel Subject: Re: framebuffer corruption due to overlapping stp instructions on arm64 In-Reply-To: <11f9185a-7f71-83df-3a57-0a0ae9c1f934@arm.com> Message-ID: References: <9acdacdb-3bd5-b71a-3003-e48132ee1371@redhat.com> <11f9185a-7f71-83df-3a57-0a0ae9c1f934@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.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.7]); Sat, 04 Aug 2018 00:58:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sat, 04 Aug 2018 00:58:20 +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 Fri, 3 Aug 2018, Richard Earnshaw (lists) wrote: > Whoa, hold on. > > Memcpy should never be used on device memory. Period. Memcpy doesn't > know anything about what size of access is needed for accessing a device. > > But why is the buffer in device memory rather than some other form of > uncached memory? > > If you change memcpy to deal with an aspect of the system hardware, > you'll end up hosing performance EVERYWHERE. DON'T DO IT! memcpy in glibc uses ifunc selection and it already has optimized variants for Falkor and Thunder-X. You can add just another variant for Armada-8040 that works around this bug and you won't be harming anyone but users of Armada-8040. Furthermore, you can detect in the kernel that the PCI bus has some device with prefetchable BAR and activate the workaround only if there is videocard plugged in the PCIe slot. > If you must, create a new API with tighter semantics, but don't change > memcpy to accommodate this. > > Anyway, back to the original report. What memory mapping is being used? > In detail? It is PCI prefetchable BAR. It is mapped using pgprot_writecombine, which results in MT_NORMAL_NC page attributes. (the MT_DEVICE_nGnRE can't be used because it results in crashes due to unaligned accesses to videoram). > R. Mikulas