From: Zhao Yakui Subject: Re: [PATCH V2 6/6] drm/i915:Use the coarse ping-pong mechanism based on drm fd to dispatch the BSD command on BDW GT3 Date: Mon, 14 Apr 2014 16:46:35 +0800 Message-ID: <1397465195.2039.270.camel@genxdev-ykzhao.sh.intel.com> References: <1397449304-3224-1-git-send-email-yakui.zhao@intel.com> <1397449304-3224-7-git-send-email-yakui.zhao@intel.com> <20140414072214.GE8068@phenom.ffwll.local> <1397462719.2039.246.camel@genxdev-ykzhao.sh.intel.com> <20140414081922.GD4415@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id B7AFC6E735 for ; Mon, 14 Apr 2014 01:48:24 -0700 (PDT) In-Reply-To: <20140414081922.GD4415@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Chris Wilson Cc: "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org On Mon, 2014-04-14 at 02:19 -0600, Chris Wilson wrote: > On Mon, Apr 14, 2014 at 04:05:19PM +0800, Zhao Yakui wrote: > > On Mon, 2014-04-14 at 01:22 -0600, Daniel Vetter wrote: > > > You're still using atomic_t for no real good reason. > > > gen8_dispatch_bsd_ring is always called with the dev->struct_mutex lock > > > held, so there's really no reason for it. > > > > If the struct_mutex is used in the gen8_dispatch_bsd_ring, I can remove > > the atomic_t. > > It seems that the struct_mutex is a big lock and it is used very > > frequently(i915_gem.c, i915_dma.c and so on). In my point it is a little > > heavier than the atomic_t if one counter is increased and returned. > > > > If you think that the mutex is better than atomic, I will follow your > > advice. > > You are already holding the struct_mutex whenever we touch the ring and > execbuffer. Even in a fine-grained world, there will still be a mutex > around all operations that touch the rings. Hi, Chris I understand your concern. From the source code the struct_mutex will be held when trying to do the buffer relocation and dispatch the command in one ring. But my code is only to select one BSD ring. In such case the atomic_t usage is enough and it is unnecessary to hold the struct_mutex. If you also think that the struct_mutex is better, I can update the code to use the struct_mutex. Thanks. Yakui > -Chris >