From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754783AbcEWL3V (ORCPT ); Mon, 23 May 2016 07:29:21 -0400 Received: from pegasos-out.vodafone.de ([80.84.1.38]:52061 "EHLO pegasos-out.vodafone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbcEWL3T (ORCPT ); Mon, 23 May 2016 07:29:19 -0400 X-Spam-Flag: NO X-Spam-Score: -0.045 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 856FB261A6C Subject: Re: [PATCH 2/2] dma-buf/fence: add fence_array fences v4 To: Gustavo Padovan , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <1463752571-28688-1-git-send-email-deathsimple@vodafone.de> <1463752571-28688-2-git-send-email-deathsimple@vodafone.de> <20160520144728.GE15150@joana> <20160523074149.GW27098@phenom.ffwll.local> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <5742E987.3030609@vodafone.de> Date: Mon, 23 May 2016 13:29:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160523074149.GW27098@phenom.ffwll.local> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 23.05.2016 um 09:41 schrieb Daniel Vetter: > On Fri, May 20, 2016 at 11:47:28AM -0300, Gustavo Padovan wrote: >> 2016-05-20 Christian König : >> >>> From: Gustavo Padovan >>> >>> struct fence_collection inherits from struct fence and carries a >>> collection of fences that needs to be waited together. >>> >>> It is useful to translate a sync_file to a fence to remove the complexity >>> of dealing with sync_files on DRM drivers. So even if there are many >>> fences in the sync_file that needs to waited for a commit to happen, >>> they all get added to the fence_collection and passed for DRM use as >>> a standard struct fence. >>> >>> That means that no changes needed to any driver besides supporting fences. >>> >>> fence_collection's fence doesn't belong to any timeline context, so >>> fence_is_later() and fence_later() are not meant to be called with >>> fence_collections fences. >>> >>> v2: Comments by Daniel Vetter: >>> - merge fence_collection_init() and fence_collection_add() >>> - only add callbacks at ->enable_signalling() >>> - remove fence_collection_put() >>> - check for type on to_fence_collection() >>> - adjust fence_is_later() and fence_later() to WARN_ON() if they >>> are used with collection fences. >>> >>> v3: - Initialize fence_cb.node at fence init. >>> >>> Comments by Chris Wilson: >>> - return "unbound" on fence_collection_get_timeline_name() >>> - don't stop adding callbacks if one fails >>> - remove redundant !! on fence_collection_enable_signaling() >>> - remove redundant () on fence_collection_signaled >>> - use fence_default_wait() instead >>> >>> v4 (chk): Rework, simplification and cleanup: >>> - Drop FENCE_NO_CONTEXT handling, always allocate a context. >>> - Rename to fence_array. >>> - Return fixed driver name. >>> - Register only one callback at a time. >>> - Document that create function takes ownership of array. >> This looks good to me. Dropping NO_CONTEXT was a good idea, also >> registering only one callback makes it looks better. > This will make it even harder to eventually add a real fence_context > structure for tracking and debugging. I know you don't care for amdgpu > since you have amdgpu-specific debug files, and there's some lifetime fun > that makes it not immediately obvious how to resolve it. Completely independent of my work on amdgpu I still think that it's not such a good idea to use a complex structure for the fence context. Especially on SoCs and small embedded systems you probably don't want to overhead associated with that only for debugging purposes in a production environment. > But on "lots of > shitty little drivers" systems aka SoCs generic debugging information is > crucial I think. Not liking too much where this is going. Yeah I agree that generic debugging information is usually crucial, but the lifetime issues indeed can't be solved without reference counting and a hole bunch of overhead. How about V5 of the patch I've just send out? Apart from fixing a few issues I've made the context and sequence number parameters of the fence_array object. This way you don't need to always allocate a new context for each object, but just enough to keep your timelines straight. E.g. you don't get a lot of contexts only used once. This is at least sufficient for my amdgpu use case. Regards, Christian. > -Daniel