Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1786382ybb; Fri, 29 Mar 2019 11:16:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2pOkSYcFLgFZYAJaUUqFDg2eJyURg9pGUvxqUGA6IZGinJOEIXqV9fPGA/1MsuNQSfV4Z X-Received: by 2002:a63:2f44:: with SMTP id v65mr46613996pgv.141.1553883413099; Fri, 29 Mar 2019 11:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553883413; cv=none; d=google.com; s=arc-20160816; b=OIa7qqrI2x14AcJcveNg06UbRvaBAsmEDTusBCaVOIaqTexwdhCHIknw1IIZ2OnDlt jEVlamrxJaL7i/RV8hop5HQ8KSJVrosW8SUVTOEshe/T7CSKiE4yx8Pdd3yBope0RHXZ z7iTa0dGIR6iGXDcA5+yTvVR0karh6NccHn+zs+eEEe6etLOle4tx2eVbykPKcWoLNhx kI2DsnUUBXDkgad+hXnOQ/M1LQOjHSvqlJmW3/YKTyP12v/VDnUOa/FOJXJLpL/T4Rku slVf5F40Inu6bJQUmuGOA/Vge4mfGYwF+XmdxRJg945DvpT93uUdaAADBOErivkGqOjP Mg6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from; bh=Y80JVtrlBRRPaIvyVn96nGQh//rwzP1GVSsposa76f4=; b=S/u5Ga/78iVkm/4kSJE1HB5bhXNDA8eaXN54BanO2oLKmnyjl08nNxs9jCv/1KiTwG oTZvpvrVF3V2+6+eC8RHiS44it8adjsf/J0UuQcR7oG786M0LcTZtUp/jbTQ55ljqPlY f528M8kXVPnTQz0Pgcl0CMs4OpD27o1/qOzdrnelXlTanLHe4RfZjskRQlGKOQ7/Ee1M rJb7s6AgWrKWXrSnPKGNlxwFOLTmhj6ixke2m98jlLsyy+qiqFpIoG8Q2bDWZWpfcekI 1biqs+Xcj/qC4xB/fjYHy+HzodZnRK9th/+9XhQ5eg+XLkgX6JZ/6FoZ5ozpvKUmA4EA KcWw== 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 o1si2360399plk.7.2019.03.29.11.16.37; Fri, 29 Mar 2019 11:16:53 -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 S1730058AbfC2SOO (ORCPT + 99 others); Fri, 29 Mar 2019 14:14:14 -0400 Received: from anholt.net ([50.246.234.109]:33616 "EHLO anholt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729652AbfC2SON (ORCPT ); Fri, 29 Mar 2019 14:14:13 -0400 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id C829410A1518; Fri, 29 Mar 2019 11:14:12 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2gFnKf8qZt2K; Fri, 29 Mar 2019 11:14:11 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id F146D10A05DD; Fri, 29 Mar 2019 11:14:10 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 7F1E62FE2F72; Fri, 29 Mar 2019 11:14:10 -0700 (PDT) From: Eric Anholt To: Paul Kocialkowski , Daniel Vetter Cc: Daniel Stone , dri-devel , Linux Kernel Mailing List , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Eben Upton , Thomas Petazzoni Subject: Re: [PATCH v2 1/2] drm/file: Rehabilitate the firstopen hook for non-legacy drivers In-Reply-To: <901ea65c770c80e22c69032affe3b1a22652b608.camel@bootlin.com> References: <20190320154809.14823-1-paul.kocialkowski@bootlin.com> <20190320154809.14823-2-paul.kocialkowski@bootlin.com> <87zhpph4c2.fsf@anholt.net> <82618ee8c2a2380a62b1fb894e5c35c602e20f3d.camel@bootlin.com> <20190328185307.GZ2665@phenom.ffwll.local> <5ed7c5f361bca47d3f9771f9ed27e28e2fccb179.camel@bootlin.com> <20190329152502.GO2665@phenom.ffwll.local> <901ea65c770c80e22c69032affe3b1a22652b608.camel@bootlin.com> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Fri, 29 Mar 2019 11:14:09 -0700 Message-ID: <87r2appmz2.fsf@anholt.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Paul Kocialkowski writes: > Hi, > > Le vendredi 29 mars 2019 =C3=A0 16:25 +0100, Daniel Vetter a =C3=A9crit : >> On Fri, Mar 29, 2019 at 04:02:23PM +0100, Paul Kocialkowski wrote: >> > Hi, >> >=20 >> > On Fri, 2019-03-29 at 09:09 +0000, Daniel Stone wrote: >> > > Hi, >> > >=20 >> > > On Thu, 28 Mar 2019 at 18:53, Daniel Vetter wrote: >> > > > On Thu, Mar 21, 2019 at 04:27:06PM +0100, Paul Kocialkowski wrote: >> > > > > I don't see other options either, and using firstclose/lastopen = feels >> > > > > overall more readable in the driver code. >> > > > >=20 >> > > > > I'm not sure there is such a big overhead associated with alloca= ting >> > > > > the binner BO (it seems that the current implementation tries to= alloc >> > > > > until the specific memory constraints for the buffer are met, so >> > > > > perhaps that can take time). But if there is, I suppose it's bes= t to >> > > > > have that when starting up rather than delaying the first render >> > > > > operation. >> > > >=20 >> > > > I'm not entirely buying the "we don't need this for fbcon only" ar= gument - >> > > > there's plenty of dumb kms clients too (boot splash and whatever e= lse >> > > > there might be). If you don't want to keep this around I think all= ocating >> > > > on first non-dumb bo allocation and dropping it when the last such= fd >> > > > closes sounds like a much better idea. Needs a bit more state, you= need to >> > > > track per drm_file whether you've already allocated a non-dumb bo,= and a >> > > > drm_device refcount, but that's not much. Firstopen feels like the= wrong >> > > > thing. >> > > >=20 >> > > > Another option would be first_renderopen or something like that, e= xcept >> > > > you can also render on the legacy node and I'm not sure how much t= here's a >> > > > demand for this in other drivers. In the end you have open/close >> > > > callbacks, you can do all the driver specific things you want to d= o in >> > > > there. >> > >=20 >> > > I'd like to avoid doing it in open where possible, since that hurts >> > > device enumeration from userspace. >> >=20 >> > I've noticed the same issue with firstopen, where our buffer is >> > allocated/liberated a couple of times during enumeration, before the >> > final open that stays alive during use. >> >=20 >> > I'm not sure what is preferable between that and allocating when the >> > GPU is first used. Slowing down the first GPU operation with the >> > allocation does not sound too great either and it feels like the buffer >> > should have been allocated earlier. >> >=20 >> > To me, it feels I think it's better to have delays due to allocation at >> > enumeration / startup rather than later on, but I might be missing some >> > elements to have a clear idea. >> >=20 >> > What do you think? >>=20 >> We'll have the delay somewhere on driver load. Better to have it only on= ce >> (when the driver starts using gem for real), than a bunch of time, at >> least once while enumerating and then once more while actually >> initializing. I think if you allocat this on first non-dumb gem_create, >> and on first command submission (just so evil userspace can't screw up t= he >> hw too badly), that should be perfectly fine. > > I'm not totally convinced that it's okay to have a delay outside of > init/enumeration, even if it's a smaller delay. You'll have non-dumb buffers created during GL context creation, so early in xserver or other KMS-and-GL-using application init anyway. Seems like a perfectly fine plan to me. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyeYHIACgkQtdYpNtH8 nuhPIA/+K0tMT0orfpgyXvw725SRAhlrTO24BGljRqgYHPENY1sx/2UuVnsfPioN qKFVulOOTP5H3y0J+4wNq9pgKmWc09EVgTsRbhM4d+x5SN8YFCjfeLYU3Hjje1HW VJRgNAQKUvVFZTiac6Z8URjR1GzDmirFpsRqIL7Q3eJ2FyPpCit5ZX6vqBeOOHez Ib5fAbiiQCRwocyqUqzutQWwxYg/K3a8A+N0RKiqxBi3DT9MUD8IXT1JgpnXb5Go B+6KeolL9gvCd8Nyz7dyqh3Qpi0AMHOcXEZF8e/J6XGpguHYm3do7NF2ZCNugnJU A+fFEG9hA6DluLCTGd9jqpKUB/Ub7DY7ILue6xxSAdECIC6jkv133b+DBB5cUur+ iUw5eRLeU7Vt3FZlEKFFK7EW3jH1Q4PLW40g4gzR5Hv7hqz1R+mPMCrxzsi4HhCw eUMIE76p+x7zTIBSxIYk3C+Er10hfEClYZtWFCGdEZurYrOltDU6dWRJEPEy4LZC Ye1rmjbj7CF8ZxrKQMcigfSezxfrE29X+Uc5Jk82SEIxTe0Ggtd3fbsLCN/j8vQV pF05JwcnjFoAeb816UrbJNOHInEx5G1klUoKNznpg7yWPMH5RXSZxBH4yKumPkyK G/GcXKKVoD53cINjhFpiZKRiqKOe+31T+9kRjOaGRsjqan/J8kA= =fnRm -----END PGP SIGNATURE----- --=-=-=--