From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 06/20] drm/gem: inline drm_gem_object_handle_reference Date: Tue, 23 Jul 2013 14:31:07 +0200 Message-ID: References: <1373958731-4132-1-git-send-email-daniel.vetter@ffwll.ch> <1373958731-4132-7-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-oa0-f48.google.com (mail-oa0-f48.google.com [209.85.219.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 27D3CE5C8F for ; Tue, 23 Jul 2013 05:31:09 -0700 (PDT) Received: by mail-oa0-f48.google.com with SMTP id f4so11133703oah.35 for ; Tue, 23 Jul 2013 05:31:08 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Rob Clark Cc: DRI Development List-Id: dri-devel@lists.freedesktop.org On Tue, Jul 23, 2013 at 2:07 PM, Rob Clark wrote: > On Tue, Jul 16, 2013 at 3:11 AM, Daniel Vetter wrote: >> Only one callsite and since ->handle_count is not a simple reference >> count (it can resurrect) it's imo better to be explicit about things >> than hide the refcount dance. > > I'm not really sure I like this one.. I guess it could be that I'm > just used to the handle-ref stuff, so it doesn't seem odd not-inlined. > And it does seem kinda odd / unsymmetric to have an unref w/out a > ref. I guess I kinda like the bikeshed's current color in this case. I generally agree but in this case a follow-up patch ("drm/gem: fix up flink name create race") will change obj->handle_count from an atomic_t to a normal int protected by the dev->object_name_lock spinlock. To avoid races we need to hold that spinlock over a few different instructions, so with the refcounting dance inlined it's much more obvious that that obj->handle_count is always correctly protected imo. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch