From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933562AbcKHMwO (ORCPT ); Tue, 8 Nov 2016 07:52:14 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36266 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932477AbcKHMwL (ORCPT ); Tue, 8 Nov 2016 07:52:11 -0500 Date: Tue, 8 Nov 2016 13:52:06 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, marcheu@google.com, Daniel Stone , seanpaul@google.com, linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com Subject: Re: [PATCH v7 0/3] drm: add explict fencing Message-ID: <20161108125206.f7l42lqlpt76wd5a@phenom.ffwll.local> Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, marcheu@google.com, Daniel Stone , seanpaul@google.com, linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com References: <1478588090-8664-1-git-send-email-gustavo@padovan.org> <20161108103508.GH18604@nuc-i3427.alporthouse.com> <20161108113256.q52243qihb6kwe2h@phenom.ffwll.local> <20161108114551.GL18604@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 4.6.0-1-amd64 User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 08, 2016 at 01:44:34PM +0100, Christian König wrote: > Am 08.11.2016 um 12:45 schrieb Chris Wilson: > > On Tue, Nov 08, 2016 at 12:32:56PM +0100, Daniel Vetter wrote: > > > On Tue, Nov 08, 2016 at 10:35:08AM +0000, Chris Wilson wrote: > > > > On Tue, Nov 08, 2016 at 03:54:47PM +0900, Gustavo Padovan wrote: > > > > > From: Gustavo Padovan > > > > > > > > > > Hi, > > > > > > > > > > This is yet another version of the DRM fences patches. Please refer > > > > > to the cover letter[1] in a previous version to check for more details. > > > > Explicit fencing is not a superset of the implicit fences. The driver > > > > may be using implicit fences (on a reservation object) to serialise > > > > asynchronous operations wrt to each other (such as dispatching threads > > > > to flush cpu caches to memory, manipulating page tables and the like > > > > before the flip). Since the user doesn't know about these operations, > > > > they are not included in the explicit fence they provide, at which point > > > > we can't trust their fence to the exclusion of the implicit fences... > > > My thoughts are that in atomic_check drivers just fill in the fence from > > > the reservation_object (i.e. the uapi implicit fencing part). If there's > > > any additional work that's queued up in ->prepare_fb then I guess the > > > driver needs to track that internally, but _only_ for kernel-internally > > > queued work. > > That's not a trivial task to work out which of the fence contexts within > > the reservation object are required and which are to be replaced by the > > explicit fence, esp. when you have to consider external fences. > > > The reason for that is that with explicit fencing we want to allow > > > userspace to overwrite any existing implicit fences that might hang > > > around. > > I'm just suggesting the danger of that when userspace doesn't know > > everything and the current interfaces do not allow for userspace to know, > > we only tell userspace about its own action (more or less). > > It's even worse than that. See the kernel can for example swap out objects > any time it wants. > > Userspace doesn't know about such operations and so can't provide them as > explicit fence. > > Same is true for example in situations where one userspace process doesn't > know about operations another process does. E.g. for backward compatibility > with DRI2/3 for example. > > So we will always have a mixture of implicit fences and explicit fences. > > The approach we used for amdgpu is that we implicit wait for all fences > which the initiator of an operation can't know about (e.g. from another > process or kernel internally) and explicitly wait for all additional fences > provided by the initiator or an operation. On android userspace is also supposed to know about explicit fences from other users, i.e. shared buffers. So there you shouldn't wait for implicit fences from other processes, only for kernel-internal stuff. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch