From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67F4BC433EC for ; Fri, 17 Jul 2020 13:23:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 430502064B for ; Fri, 17 Jul 2020 13:23:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 430502064B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B529F6EC69; Fri, 17 Jul 2020 13:23:26 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E563C6EC69 for ; Fri, 17 Jul 2020 13:23:25 +0000 (UTC) IronPort-SDR: JGSD0WiEpQ40Bp9puZVPcQh/InZviG9aGblTjRyca9Nad96QBxek87QB8qDMTtEnpDXb9vbHg6 JW8qrZgze15w== X-IronPort-AV: E=McAfee;i="6000,8403,9684"; a="147568555" X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="147568555" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 06:23:25 -0700 IronPort-SDR: E1x4befntIXD+bVPrpYlat9E1RJ6uxsBDcO5PdrNOZxiEN3Eh7+TNvEs+k577Cus+5pHTRnaGp 6DGZGxy5BJHA== X-IronPort-AV: E=Sophos;i="5.75,362,1589266800"; d="scan'208";a="460845889" Received: from gpanagop-mobl.ger.corp.intel.com (HELO [10.249.33.238]) ([10.249.33.238]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 06:23:24 -0700 To: Chris Wilson , intel-gfx@lists.freedesktop.org References: <20200715115147.11866-1-chris@chris-wilson.co.uk> <20200715115147.11866-9-chris@chris-wilson.co.uk> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: Date: Fri, 17 Jul 2020 14:23:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200715115147.11866-9-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 09/66] drm/i915: Provide a fastpath for waiting on vma bindings X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 15/07/2020 12:50, Chris Wilson wrote: > Before we can execute a request, we must wait for all of its vma to be > bound. This is a frequent operation for which we can optimise away a > few atomic operations (notably a cmpxchg) in lieu of the RCU protection. > > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/i915_active.h | 15 +++++++++++++++ > drivers/gpu/drm/i915/i915_vma.c | 9 +++++++-- > 2 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h > index b9e0394e2975..fb165d3f01cf 100644 > --- a/drivers/gpu/drm/i915/i915_active.h > +++ b/drivers/gpu/drm/i915/i915_active.h > @@ -231,4 +231,19 @@ struct i915_active *i915_active_create(void); > struct i915_active *i915_active_get(struct i915_active *ref); > void i915_active_put(struct i915_active *ref); > > +static inline int __i915_request_await_exclusive(struct i915_request *rq, > + struct i915_active *active) > +{ > + struct dma_fence *fence; > + int err = 0; > + > + fence = i915_active_fence_get(&active->excl); > + if (fence) { > + err = i915_request_await_dma_fence(rq, fence); > + dma_fence_put(fence); > + } > + > + return err; > +} > + > #endif /* _I915_ACTIVE_H_ */ > diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c > index bc64f773dcdb..cd12047c7791 100644 > --- a/drivers/gpu/drm/i915/i915_vma.c > +++ b/drivers/gpu/drm/i915/i915_vma.c > @@ -1167,6 +1167,12 @@ void i915_vma_revoke_mmap(struct i915_vma *vma) > list_del(&vma->obj->userfault_link); > } > > +static int > +__i915_request_await_bind(struct i915_request *rq, struct i915_vma *vma) > +{ > + return __i915_request_await_exclusive(rq, &vma->active); > +} > + > int __i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq) > { > int err; > @@ -1174,8 +1180,7 @@ int __i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq) > GEM_BUG_ON(!i915_vma_is_pinned(vma)); > > /* Wait for the vma to be bound before we start! */ > - err = i915_request_await_active(rq, &vma->active, > - I915_ACTIVE_AWAIT_EXCL); > + err = __i915_request_await_bind(rq, vma); > if (err) > return err; > > Looks like for like, apart from missing i915_active_acquire_if_busy across the operation. Remind me please what is acquire/release protecting against? :) Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx