Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932118AbcDOT0D (ORCPT ); Fri, 15 Apr 2016 15:26:03 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32843 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753059AbcDOTZz (ORCPT ); Fri, 15 Apr 2016 15:25:55 -0400 Date: Fri, 15 Apr 2016 21:25:50 +0200 From: Daniel Vetter To: Gustavo Padovan , Christian =?iso-8859-1?Q?K=F6nig?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Stone , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Riley Andrews , Rob Clark , Greg Hackmann , John Harrison , laurent.pinchart@ideasonboard.com, seanpaul@google.com, marcheu@google.com, m.chehab@samsung.com, Maarten Lankhorst , Gustavo Padovan Subject: Re: [RFC 1/8] dma-buf/fence: add fence_collection fences Message-ID: <20160415192550.GZ2510@phenom.ffwll.local> Mail-Followup-To: Gustavo Padovan , Christian =?iso-8859-1?Q?K=F6nig?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Stone , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Riley Andrews , Rob Clark , Greg Hackmann , John Harrison , laurent.pinchart@ideasonboard.com, seanpaul@google.com, marcheu@google.com, m.chehab@samsung.com, Maarten Lankhorst , Gustavo Padovan References: <1460683781-22535-1-git-send-email-gustavo@padovan.org> <1460683781-22535-2-git-send-email-gustavo@padovan.org> <20160415080254.GQ2510@phenom.ffwll.local> <5710AE61.9040308@amd.com> <20160415182750.GA23954@joana> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160415182750.GA23954@joana> X-Operating-System: Linux phenom 4.4.0-1-amd64 User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1271 Lines: 26 On Fri, Apr 15, 2016 at 11:27:50AM -0700, Gustavo Padovan wrote: > 2016-04-15 Christian K?nig : > > Amdgpu also has an implementation for a fence collection which uses a a > > hashtable to keep the fences grouped by context (e.g. only the latest fence > > is keept for each context). See amdgpu_sync.c for reference. > > > > We should either make the collection similar in a way that you can add as > > many fences as you want (like the amdgpu implementation) or make it static > > and only add a fixed number of fences right from the beginning. > > > > I can certainly see use cases for both, but if you want to stick with a > > static approach you should probably call the new object fence_array instead > > of fence_collection and do as Daniel suggested. > > Maybe we can go for something in between. Have fence_collection_init() > need at least two fences to create the fence_collection. Then > fence_collection_add() would add more dinamically. The problem with adding fences later on is that it makes it trivial to add deadlocks and loops. Just add the fence collection to itself, boom. From that pov it's an unsafe api, and hence something to avoid. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch