From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EF38C433F5 for ; Fri, 1 Oct 2021 16:22:17 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC84F619EE for ; Fri, 1 Oct 2021 16:22:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AC84F619EE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 79C5E4160C; Fri, 1 Oct 2021 16:22:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LYftXXC6r43N; Fri, 1 Oct 2021 16:22:15 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id B86A0425E2; Fri, 1 Oct 2021 16:22:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8E6E7C0011; Fri, 1 Oct 2021 16:22:14 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 496A6C000D for ; Fri, 1 Oct 2021 16:22:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2686184519 for ; Fri, 1 Oct 2021 16:22:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0pEw2HLqfIdg for ; Fri, 1 Oct 2021 16:22:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3EE7C84518 for ; Fri, 1 Oct 2021 16:22:12 +0000 (UTC) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1A4C51F45289; Fri, 1 Oct 2021 17:22:10 +0100 (BST) Date: Fri, 1 Oct 2021 18:22:06 +0200 From: Boris Brezillon To: Steven Price Subject: Re: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag Message-ID: <20211001182206.78eb87ab@collabora.com> In-Reply-To: <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> References: <20211001143427.1564786-1-boris.brezillon@collabora.com> <20211001143427.1564786-5-boris.brezillon@collabora.com> <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> Organization: Collabora X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Cc: Tomeu Vizoso , Will Deacon , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, Rob Herring , Alyssa Rosenzweig , Robin Murphy , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, 1 Oct 2021 16:13:42 +0100 Steven Price wrote: > On 01/10/2021 15:34, Boris Brezillon wrote: > > This lets the driver reduce shareability domain of the MMU mapping, > > which can in turn reduce access time and save power on cache-coherent > > systems. > > > > Signed-off-by: Boris Brezillon > > This seems reasonable to me - it matches the kbase > BASE_MEM_COHERENT_SYSTEM (only backwards obviously) and it worked > reasonably well for the blob. > > But I'm wondering if we need to do anything special to deal with the > fact we will now have some non-coherent mappings on an otherwise > coherent device. > > There are certainly some oddities around how these buffers will be > mapped into user space if requested, e.g. panfrost_gem_create_object() > sets 'map_wc' based on pfdev->coherent which is arguably wrong for > GPUONLY. So there are two things we could consider: > > a) Actually prevent user space mapping GPUONLY flagged buffers. Which > matches the intention of the name. I intended to do that, just forgot to add wrappers around drm_gem_shmem_{mmap,vmap}() to forbid CPU-mappings on gpuonly buffers. > > b) Attempt to provide user space with the tools to safely interact with > the buffers (this is the kbase approach). This does have the benefit of > allowing *mostly* GPU access. An example here is the tiler heap where > the CPU could zero out as necessary but mostly the GPU has ownership and > the CPU never reads the contents. GPUONLY/DEVONLY might not be the best > name in that case. Uh, right, I forgot we had to zero the tiler heap on Midgard (most of the time done with a WRITE_VALUE job, but there's an exception on some old Midgard GPUs IIRC). _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBFE3C433F5 for ; Fri, 1 Oct 2021 16:22:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A3C79611C8 for ; Fri, 1 Oct 2021 16:22:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A3C79611C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7D6B6EE5C; Fri, 1 Oct 2021 16:22:12 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC23A6EE5C for ; Fri, 1 Oct 2021 16:22:11 +0000 (UTC) Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1A4C51F45289; Fri, 1 Oct 2021 17:22:10 +0100 (BST) Date: Fri, 1 Oct 2021 18:22:06 +0200 From: Boris Brezillon To: Steven Price Cc: Joerg Roedel , iommu@lists.linux-foundation.org, Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , Robin Murphy , Will Deacon , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag Message-ID: <20211001182206.78eb87ab@collabora.com> In-Reply-To: <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> References: <20211001143427.1564786-1-boris.brezillon@collabora.com> <20211001143427.1564786-5-boris.brezillon@collabora.com> <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> Organization: Collabora X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, 1 Oct 2021 16:13:42 +0100 Steven Price wrote: > On 01/10/2021 15:34, Boris Brezillon wrote: > > This lets the driver reduce shareability domain of the MMU mapping, > > which can in turn reduce access time and save power on cache-coherent > > systems. > > > > Signed-off-by: Boris Brezillon > > This seems reasonable to me - it matches the kbase > BASE_MEM_COHERENT_SYSTEM (only backwards obviously) and it worked > reasonably well for the blob. > > But I'm wondering if we need to do anything special to deal with the > fact we will now have some non-coherent mappings on an otherwise > coherent device. > > There are certainly some oddities around how these buffers will be > mapped into user space if requested, e.g. panfrost_gem_create_object() > sets 'map_wc' based on pfdev->coherent which is arguably wrong for > GPUONLY. So there are two things we could consider: > > a) Actually prevent user space mapping GPUONLY flagged buffers. Which > matches the intention of the name. I intended to do that, just forgot to add wrappers around drm_gem_shmem_{mmap,vmap}() to forbid CPU-mappings on gpuonly buffers. > > b) Attempt to provide user space with the tools to safely interact with > the buffers (this is the kbase approach). This does have the benefit of > allowing *mostly* GPU access. An example here is the tiler heap where > the CPU could zero out as necessary but mostly the GPU has ownership and > the CPU never reads the contents. GPUONLY/DEVONLY might not be the best > name in that case. Uh, right, I forgot we had to zero the tiler heap on Midgard (most of the time done with a WRITE_VALUE job, but there's an exception on some old Midgard GPUs IIRC). From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B620C433EF for ; Fri, 1 Oct 2021 16:24:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14013619EE for ; Fri, 1 Oct 2021 16:24:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 14013619EE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2mZV5BBueeO+XRyhyb5wPb1bBJTiqQfr5W/14BpD8dM=; b=ovngp5A45+XM7u Yop+U3T7BMYQZDSJj7cdhxv61xOG1OEIcxUkRSGMzo/yj4Oah8Vi05EL0MTD9+fLQgXsm6FeTLMQK OIoK96jtWRbSePoEUtegR8NSQIHMogRrQFD3p8ea6jSXODuuOgTGNYm/xVWRspxsYx4Tfgwqj4rx+ iFBAzMsCPxx4bx2QK/NyMeqGkkBoasP0XlZbGbV+zt1EJ+n2n+FAIce11CLG7bFABrxZC339vl3xO /MpgMPt3/mFd2sSc6mGbld2QyWvYwE72kB9M6fx+TM2FXKZH/nma0AJhMfqkENlM5SNx/vcIfpqjs U/3GHmVTcUNQow8c7rPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWLId-000qae-UV; Fri, 01 Oct 2021 16:22:16 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mWLIa-000qa0-B2 for linux-arm-kernel@lists.infradead.org; Fri, 01 Oct 2021 16:22:13 +0000 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1A4C51F45289; Fri, 1 Oct 2021 17:22:10 +0100 (BST) Date: Fri, 1 Oct 2021 18:22:06 +0200 From: Boris Brezillon To: Steven Price Cc: Joerg Roedel , iommu@lists.linux-foundation.org, Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , Robin Murphy , Will Deacon , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 4/5] drm/panfrost: Add a PANFROST_BO_GPUONLY flag Message-ID: <20211001182206.78eb87ab@collabora.com> In-Reply-To: <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> References: <20211001143427.1564786-1-boris.brezillon@collabora.com> <20211001143427.1564786-5-boris.brezillon@collabora.com> <02cb188d-e77d-3dd6-ad62-fe56d42724ae@arm.com> Organization: Collabora X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211001_092212_545250_691DA131 X-CRM114-Status: GOOD ( 23.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 1 Oct 2021 16:13:42 +0100 Steven Price wrote: > On 01/10/2021 15:34, Boris Brezillon wrote: > > This lets the driver reduce shareability domain of the MMU mapping, > > which can in turn reduce access time and save power on cache-coherent > > systems. > > > > Signed-off-by: Boris Brezillon > > This seems reasonable to me - it matches the kbase > BASE_MEM_COHERENT_SYSTEM (only backwards obviously) and it worked > reasonably well for the blob. > > But I'm wondering if we need to do anything special to deal with the > fact we will now have some non-coherent mappings on an otherwise > coherent device. > > There are certainly some oddities around how these buffers will be > mapped into user space if requested, e.g. panfrost_gem_create_object() > sets 'map_wc' based on pfdev->coherent which is arguably wrong for > GPUONLY. So there are two things we could consider: > > a) Actually prevent user space mapping GPUONLY flagged buffers. Which > matches the intention of the name. I intended to do that, just forgot to add wrappers around drm_gem_shmem_{mmap,vmap}() to forbid CPU-mappings on gpuonly buffers. > > b) Attempt to provide user space with the tools to safely interact with > the buffers (this is the kbase approach). This does have the benefit of > allowing *mostly* GPU access. An example here is the tiler heap where > the CPU could zero out as necessary but mostly the GPU has ownership and > the CPU never reads the contents. GPUONLY/DEVONLY might not be the best > name in that case. Uh, right, I forgot we had to zero the tiler heap on Midgard (most of the time done with a WRITE_VALUE job, but there's an exception on some old Midgard GPUs IIRC). _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel