Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp376604imm; Fri, 3 Aug 2018 05:05:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf/uOcBi/g8tsvomIORJh0USg1Vy3AdTpvATTC3wsrT01y18n81R14JTRw4NsZ9EBCdOBtQ X-Received: by 2002:a63:dc17:: with SMTP id s23-v6mr3596985pgg.40.1533297954526; Fri, 03 Aug 2018 05:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533297954; cv=none; d=google.com; s=arc-20160816; b=j3um+/ZPufND9nZYH8xiRyptOvMtCJD9l+/DyIS+ppwpSPW+R4tHofOE4rPBkrYc0Y 6LA3aBzAI4Z9/V7Mfu04FYm33NLM3lvU15gQUtbMGsC8v9a8wSXJp0wLYlNFlBfW4dJh n5iY5lB6BYaBg7lutpHGQTPDIwnjt4enkdokGM5FNjv+NI7MTNV37aETnnkvh471zsLs FIjwxSZErikSP200UxaioxdJWBYPl5vMDST4kvT3gTfFwG81gV64lm4PcX77OBVwAid0 ommLIKf/ADU31ae0zNGIkUt3lRiBzm0O/AEsUn3HqPlGzevRB0FAGaDSZ2DQdYuVk5zG ATxw== 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=18w4uSPovGn9pDRiChpRQvaURpzV2CvjoIt1Yu7X5j4=; b=VaCeVkNIv2Opo+H4+JftkJT2zqF1qktKvaMENuVR3ecfsIeT3Lm83tgcbymaeJI3r0 y+NfNAg8BSXdLMuJBCgTvzv8gMoFl664Fax8mu1OEA6uSaoKmuMywH8m07vLrTP3Yscy vmDsEG3gQOleFaYg9qCmV9ebZrcRi610C8eGjqmhpcYJJTQktEWAUhrICpboLWplad42 B5ACgR7uHsnsAvF970jGTSauAZfw7Cw99VZHuIAP/y5NckiSHncFa9gPwPX3D4S9vDD/ AjCsJfMHVEf3Y9IAifi2psfpanDw7Ag2Qd4wegJDdeUXcVfISXAvz5TtXs/CgY/DR8cu Ziiw== 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 j6-v6si3783232plk.438.2018.08.03.05.05.38; Fri, 03 Aug 2018 05:05:54 -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 S1727532AbeHCOAh (ORCPT + 99 others); Fri, 3 Aug 2018 10:00:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40090 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727291AbeHCOAh (ORCPT ); Fri, 3 Aug 2018 10:00:37 -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 1D001819701E; Fri, 3 Aug 2018 12:04:35 +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 A8CB81CBBF; Fri, 3 Aug 2018 12:04:34 +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 w73C4Ygd014850; Fri, 3 Aug 2018 08:04:34 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w73C4WfT014841; Fri, 3 Aug 2018 08:04:33 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Fri, 3 Aug 2018 08:04:32 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: David Laight 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: Message-ID: References: <9acdacdb-3bd5-b71a-3003-e48132ee1371@redhat.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.8]); Fri, 03 Aug 2018 12:04:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 03 Aug 2018 12:04:35 +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, David Laight wrote: > From: Ard Biesheuvel > > Sent: 03 August 2018 10:30 > ... > > The discussion about whether memcpy() should rely on unaligned > > accesses, and whether you should use it on device memory is orthogonal > > to that, and not the heart of the matter IMO > > Even on x86 using memcpy() on PCIe memory (maybe mmap()ed into userspace) > isn't a good idea. > In the kernel memcpy_to/fromio() ought to be a better choice but that > is just an alternate name for memcpy(). > > The problem on x86 is that memcpy() is likely to be implemented as > 'rep movsb' on modern cpu - relying on the cpu hardware to perform > cache-line sized transfers (etc). > Unfortunately on uncached locations it has to revert to byte copies. > So PCIe transfers (especially reads) are very slow. > > The transfers need to use the largest size register available. > > David On x86, the framebuffer is mapped as write-combining memory type, so "rep movsb" could merge the byte writes to larger chunks. I don't have a cpu with the ERMS feature - could anyone try it if rep movsb works worse or better than explicit writes to the framebuffer? Mikulas