From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932908AbcHEHmv (ORCPT ); Fri, 5 Aug 2016 03:42:51 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:50498 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752081AbcHEHmr (ORCPT ); Fri, 5 Aug 2016 03:42:47 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Date: Fri, 5 Aug 2016 08:42:16 +0100 From: Chris Wilson To: Gustavo Padovan , dri-devel@lists.freedesktop.org, marcheu@google.com, Daniel Stone , seanpaul@google.com, Daniel Vetter , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com Subject: Re: [PATCH v5 5/5] dma-buf/sync_file: only enable fence signalling on poll() Message-ID: <20160805074216.GG12034@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Gustavo Padovan , dri-devel@lists.freedesktop.org, marcheu@google.com, Daniel Stone , seanpaul@google.com, Daniel Vetter , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com References: <1470363854-7846-1-git-send-email-gustavo@padovan.org> <1470363854-7846-5-git-send-email-gustavo@padovan.org> <20160805072815.GE12034@nuc-i3427.alporthouse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160805072815.GE12034@nuc-i3427.alporthouse.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 05, 2016 at 08:28:15AM +0100, Chris Wilson wrote: > On Thu, Aug 04, 2016 at 11:24:14PM -0300, Gustavo Padovan wrote: > > From: Gustavo Padovan > > > > Signalling doesn't need to be enabled at sync_file creation, it is only > > required if userspace waiting the fence to signal through poll(). > > > > Thus we delay fence_add_callback() until poll is called. It only adds the > > callback the first time poll() is called. This avoid re-adding the same > > callback multiple times. > > > > v2: rebase and update to work with new fence support for sync_file > > > > v3: use atomic operation to set enabled and protect fence_add_callback() > > > > v4: use user bit from fence flags (comment from Chris Wilson) > > > > Signed-off-by: Gustavo Padovan > > --- > > + if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { > > + if (fence_add_callback(sync_file->fence, &sync_file->cb, > > + fence_check_cb_func) < 0) > > + wake_up_all(&sync_file->wq); > > + } > > + > > status = fence_is_signaled(sync_file->fence); > > status can only be true/false here. > return fence_is_signaled(sync_file->fence) ? POLLIN : 0; > > Reviwed-by: Chris Wilson Reviewed-by /me goes back to drinking his coffee -Chris -- Chris Wilson, Intel Open Source Technology Centre