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=-7.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 432A0C33CAC for ; Mon, 3 Feb 2020 10:50:40 +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 F1DB920661 for ; Mon, 3 Feb 2020 10:50:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1DB920661 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 84ACF6E2DA; Mon, 3 Feb 2020 10:50:39 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB09D6E2DA for ; Mon, 3 Feb 2020 10:50:37 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2020 02:50:20 -0800 X-IronPort-AV: E=Sophos;i="5.70,397,1574150400"; d="scan'208";a="223899246" Received: from aabader-mobl1.ccr.corp.intel.com (HELO [10.252.21.249]) ([10.252.21.249]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 03 Feb 2020 02:50:19 -0800 To: Chris Wilson , intel-gfx@lists.freedesktop.org References: <20200203094152.4150550-1-chris@chris-wilson.co.uk> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: Date: Mon, 3 Feb 2020 10:50:17 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200203094152.4150550-1-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 1/6] drm/i915: Hold reference to previous active fence as we queue 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: , Cc: matthew.auld@intel.com 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 03/02/2020 09:41, Chris Wilson wrote: > Take a reference to the previous exclusive fence on the i915_active, as > we wish to add an await to it in the caller (and so must prevent it from > being freed until we have completed that task). > > Fixes: e3793468b466 ("drm/i915: Use the async worker to avoid reclaim tainting the ggtt->mutex") > Signed-off-by: Chris Wilson > Cc: Matthew Auld > --- > drivers/gpu/drm/i915/i915_active.c | 6 +++++- > drivers/gpu/drm/i915/i915_vma.c | 4 +++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c > index da58e5d084f4..9ccb931a733e 100644 > --- a/drivers/gpu/drm/i915/i915_active.c > +++ b/drivers/gpu/drm/i915/i915_active.c > @@ -398,9 +398,13 @@ i915_active_set_exclusive(struct i915_active *ref, struct dma_fence *f) > /* We expect the caller to manage the exclusive timeline ordering */ > GEM_BUG_ON(i915_active_is_idle(ref)); > > + rcu_read_lock(); > prev = __i915_active_fence_set(&ref->excl, f); > - if (!prev) > + if (prev) > + prev = dma_fence_get_rcu(prev); > + else > atomic_inc(&ref->count); > + rcu_read_unlock(); > > return prev; > } > diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c > index e801e28de470..74dc3ba59ce5 100644 > --- a/drivers/gpu/drm/i915/i915_vma.c > +++ b/drivers/gpu/drm/i915/i915_vma.c > @@ -422,10 +422,12 @@ int i915_vma_bind(struct i915_vma *vma, > * execution and not content or object's backing store lifetime. > */ > prev = i915_active_set_exclusive(&vma->active, &work->base.dma); > - if (prev) > + if (prev) { > __i915_sw_fence_await_dma_fence(&work->base.chain, > prev, > &work->cb); > + dma_fence_put(prev); > + } > > work->base.dma.error = 0; /* enable the queue_work() */ > > Reviewed-by: Tvrtko Ursulin Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx