Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1986980yba; Mon, 15 Apr 2019 02:32:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzFF1xQJ3ZGSosPQSRKMY4Nfqxlh/F3uF/LDElyv5Yi5y1GUyhBOKSmlR5gMapcapweUvG X-Received: by 2002:a63:3185:: with SMTP id x127mr23154788pgx.299.1555320768051; Mon, 15 Apr 2019 02:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555320768; cv=none; d=google.com; s=arc-20160816; b=FgT/LeLCLqnR08WtKYxjldUSkpTK6dm/drjGxV9uh+AcgJar4xoTzx8tdi8FQ2UpXD po63MDSI3cj0b+BDrqum1J9MZpuITRgWyv6LOM+igwYNygC1xZK0JtBe2hDAScL+pd5x AgHlYgaNP20ZYpgwwVlS/zNTOWJ47UtCh+EqFoSvweAEgkG+DXwXToD5V7oW/BxmzCH5 0/zgbXg2tRGsH7Xn9EZaW3KxPVY1pwN3KYhYkhBXWGS/GCyeVV/PXGKBO4FHAT0nUd59 jkALKdyvXnlgzxPTUvBvEUk8m6FfIN1CFdntq4Ga/GTqO7U3IKw6CSvoGaF21/yvSV51 rnwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=uVPuUWL3VcYTU4RYA9m2vEQaYTu8hzcmia3tyKCA0iQ=; b=LENr5o/s37jPgjLTcqKmigjWoq2UlUHa22LlfEldB9c7ME5F18MSSCpwS/EKDHN45q /4N6lvAXHyqC/m+W754LpxaE8pRmuE8q70uruCc0EREFQldi1q2XfadHoz9RUbygpMqm ZetxYB/Cslk9XG6ZVl3YHHjuCDPZ6RAI5UkEcwO6Bpx96WquFd9PSdmh0qpqTcl/EWYn PRZJPhDM9dPFBHdJf9GUjRpHpABhpC/RFLuP6c4juxA+Kqxjy++o3HaA/zL+Sp9l62rI 6T+x4KEgO9GaDLhuOeSwV7qQp3s1ux8qXM6kaR4mySoY8kVeBASzhsyWEjzaAGOgGJpc Ke2Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z64si45121991pgd.106.2019.04.15.02.32.31; Mon, 15 Apr 2019 02:32:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbfDOJaU (ORCPT + 99 others); Mon, 15 Apr 2019 05:30:20 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59124 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbfDOJaT (ORCPT ); Mon, 15 Apr 2019 05:30:19 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DB7C374; Mon, 15 Apr 2019 02:30:18 -0700 (PDT) Received: from [10.1.196.69] (e112269-lin.cambridge.arm.com [10.1.196.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6578F3F557; Mon, 15 Apr 2019 02:30:16 -0700 (PDT) Subject: Re: [PATCH v2 3/3] drm/panfrost: Add initial panfrost driver To: Alyssa Rosenzweig , Tomeu Vizoso , Neil Armstrong , Maxime Ripard , Sean Paul , Will Deacon , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, David Airlie , iommu@lists.linux-foundation.org, "Marty E . Plummer" , Robin Murphy , linux-arm-kernel@lists.infradead.org References: <20190401074730.12241-1-robh@kernel.org> <20190401074730.12241-4-robh@kernel.org> <5efdc3cb-7367-65e1-d1bf-14051db5da10@arm.com> <20190405161632.GA9160@rosenzweig.io> <34a7038e-34f0-0cc4-4fc4-9b7dda356df6@arm.com> <20190415091837.GV2665@phenom.ffwll.local> From: Steven Price Message-ID: <50682635-4134-f36b-dcb0-2a4d98eedb3c@arm.com> Date: Mon, 15 Apr 2019 10:30:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190415091837.GV2665@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/04/2019 10:18, Daniel Vetter wrote: > On Fri, Apr 05, 2019 at 05:42:33PM +0100, Steven Price wrote: >> On 05/04/2019 17:16, Alyssa Rosenzweig wrote: >>> acronym once ever and have it as a "??"), I'm not sure how to respond to >>> that... We don't know how to allocate memory for the GPU-internal data >>> structures (the tiler heap, for instance, but also a few others I've >>> just named "misc_0" and "scratchpad" -- guessing one of those is for >>> "TLS"). With kbase, I took the worst-case strategy of allocating >>> gigantic chunks on startup with tiny commit counts and GROW_ON_GPF set. >>> With the new driver, well, our memory consumption is scary since >>> implementing GROW_ON_GPF in an upstream-friendly way is a bit more work >>> and isn't expected to hit the 5.2 window. >> >> Yes GROW_ON_GPF is pretty much required for the tiler heap - it's not >> (reasonably) possible to determine how big it should be. The Arm user >> space driver does the same approach (tiny commit count, but allow it to >> grow). > > Jumping in here with a drive through comment ... > > Growing gem bo and dma-buf is going to be endless amounts of fun, since we > hard-coded that their size is invariant. > > I think the only reasonable way to implement this is if you allocate a > really huge bo, map it, but only put the pages in on faulting. Or when > really evil userspace tries to export it. Actually changing the underlying > buffer size is not going to work I think. Yes the idea is that you allocate a large amount of virtual address space, but only put a few physical pages in. If the GPU needs more you fault them in as necessary. The "buffer size" (i.e. virtual address region) never changes size. > Note: I didn't read kbase, so might be totally wrong in how GROW_ON_GPF > works. For kbase we simply don't support exporting this type of memory, and are fairly restrictive about mapping it into user space (user space shouldn't normally need to read it). Since Panfrost is using GEM BO it will have to deal with malicious user space. But it would be sufficient to simply fully back the region in that case. Recent version of kbase also support what is termed JIT (Just In Time memory allocation). Basically this involves the kernel driver allocating/freeing memory regions just before the job is loaded onto the GPU. These regions might also be GROW_ON_GPF. The intention is that when there isn't memory pressure these regions can be kept between jobs, but under memory pressure they can be discarded and recreated if they turn out to be needed again. Given the differences between the Panfrost and the proprietary user space I'm not sure exactly what form this will need to be for Panfrost, but Vulkan makes memory management "more interesting"! Allocating upfront for the worst case can become prohibitively expensive. Steve