Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp92630imm; Thu, 2 Aug 2018 23:36:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpchB0deBDHr//f+bwE3aPeU79XuJ+1DLi7+nYDA23PNrskATxBRm3Fsrq7yDdRoIDRnQP3F X-Received: by 2002:a62:4cd3:: with SMTP id e80-v6mr2898870pfj.234.1533278211550; Thu, 02 Aug 2018 23:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533278211; cv=none; d=google.com; s=arc-20160816; b=qiSLZFVmVf5UQ2DGmxMbqJbnVGaofYxA3rfwHW7ZIsKPeZ9wGxWNbdYwjVoRxpkfYQ r0otVBSJTBPMKCWHwYmJy10A7FdGCjdZ/8SMklLmGqQPb1qTnT/Zl/7+H9uWUWld4/2E rPFZcPd2uFVMBL4Epr2DLv2hYsZWUbnoTQqxJGfqy+lzABqHl152cAhs3ilHmPTqKEqi 5jVHZjYSmpubAZIYGoM6wRAv95Sq5Z9+lFkFDNub2G8tUMmZ7wFWF/XVEWpkCZu2d9Bw NJ5ylNQvx3gM2aukyvX99aBTXe6oKcU3dCR7odjIj4v/eLLZwy5PRr2MGdlSVxa/nZdB ygPA== 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=XjzY6EEAHMiWtO0UM7NzR9KYn8OE7Ubvg248TdId5zg=; b=Kj42RqI1K+oi+GtzgHTcXVHJOoxWcOrnlgpWCcGN41syFSJmbk83t+nioOZ5uu4uZ4 BPoRGkn5bPsBVoimBFtzCfk+gsS8CRMwo+yL8/kAwC0syh/rF7cSU5vDTs+knkRdwVTV fylHucxzty9whBX+1tNIbPi+4GKR5TfVNZ2MmjJfsFewk4g7rW3PqO8kY6nTQ+d8hw65 i+ad6QFPSU/IRKwwGTvYfsXKvnmj+KHut18n60I83cibFC8cLwnCKHvk+dXrSzr3Mb+5 mjAb8+ppdekcAPJooB/MP5uTsSJWlXmv0RinDLyOny4WoAeLtOO6ytUYD8vNWch39yQV ObkQ== 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 e14-v6si4054135pfi.184.2018.08.02.23.36.36; Thu, 02 Aug 2018 23:36:51 -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 S1728061AbeHCIaf (ORCPT + 99 others); Fri, 3 Aug 2018 04:30:35 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47806 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726851AbeHCIae (ORCPT ); Fri, 3 Aug 2018 04:30:34 -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 9238A4023132; Fri, 3 Aug 2018 06:35:47 +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 2FA1110CD88E; Fri, 3 Aug 2018 06:35:47 +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 w736ZlUd020836; Fri, 3 Aug 2018 02:35:47 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w736Zkcd020832; Fri, 3 Aug 2018 02:35:46 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 3 Aug 2018 02:35:46 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Matt Sealey cc: Catalin Marinas , Russell King , Thomas Petazzoni , Will Deacon , libc-alpha@sourceware.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 06:35:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 06:35:47 +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 Thu, 2 Aug 2018, Matt Sealey wrote: > The easiest explanation for this would be that the memory isn?t mapped > correctly. You can?t use PCIe memory spaces with anything other than > Device-nGnRE or stricter mappings. That?s just differences between the > AMBA and PCIe (posted/unposted) memory models. I've tried to use Device-nGnRE mapping and I've got unaligned access traps. Gcc have store-merging pass so that it generates unaligned accesses even in code that has none explicit unaligned accesses. Perhaps it would be possible to recompile the kernel without the store-merging pass, but recompiling all the userspace code is impossible. Should we catch the unaligned access traps in the kernel and emulate them? There are a lot of instructions that access memory in the ARMv8 ISA, so the emulator would be quite complicated. > Normal memory (cacheable or uncacheable, which Linux tends to call > ?memory? and ?writecombine? respectively) is not a good idea. > > There are two options; make sure Links maps it?s framebuffer as Device > memory, or the driver, or both - and make sure that only aligned > accesses happen (otherwise you?ll just get a synchronous exception) and > there isn?t a Normal memory alias. > > Alternatively, tell the PCIe driver that the framebuffer is in system > memory But how would the graphics card display from it? You'd have to periodically copy the framebuffer from the system memory to the real videoram. I'm not an expert in graphics drivers, I don't know if the graphics drivers have this possibility. > - you can map it however you like but there?ll be a performance > hit if you start to use GPU acceleration, but a significant performance > boost from the PoV of the CPU. Only memory accessed from the PCIe master > interface (i.e. reads and writes generated by the card itself - telling > the GPU to pull from system memory or other DMA) can be in Normal memory > and this allows PCIe to be cache coherent with the right interconnect. > The slave port on a PCIe root complex (i.e. CPU writes) can?t be used > with Normal, or reorderable, and therefore your 2GB of graphics memory > is going to be slow from the point of view of the CPU. > > To find the correct mapping you?ll need to know just how cache coherent > the PCIe RC is... > > Ta, > Matt Mikulas