From patchwork Fri Mar 17 18:27:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9631183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84D0460249 for ; Fri, 17 Mar 2017 18:27:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F56B2852D for ; Fri, 17 Mar 2017 18:27:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 741512856B; Fri, 17 Mar 2017 18:27:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE59F2852D for ; Fri, 17 Mar 2017 18:27:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32DA86E099; Fri, 17 Mar 2017 18:27:16 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC5866E099 for ; Fri, 17 Mar 2017 18:27:14 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id u132so4566329wmg.1 for ; Fri, 17 Mar 2017 11:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=tbBbWr6p4Jm9gMvlt8gAwnPCWXozW5eAi6g1R3xa6hc=; b=N9P0X3oB6xHhM7WlxoryNMJOrcwm10GU0l2Bp3HnF/l+brwUt9Jll5haJkszuFqHa/ SbYykZQxxR5Hk4eqXUSyNwwStQe7EWBsEsm/g6FOn0gIX4LpUFYQOhEbhwZ5XC8lrSO2 8pA+K1SkdZChrD5viMoNuGbfJqQpFzpTo0g835svPt3eKWk9WWwz1++YSJ4asd78YPQ2 RcCFwCOytFdOGWJAanjbsSsS1TBfhLsXzI5QqWVAnjjCZ0i+8UE3/pQlfeXgbm3Vphpu T2Rtzs4bhvgpk66rbGBBZWMqafuOBbHdwD/xFUkJAIKAUgeyhYgdrl1TNUCwI3tDBYtN 0xwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=tbBbWr6p4Jm9gMvlt8gAwnPCWXozW5eAi6g1R3xa6hc=; b=FD6K3M9Xe9wZ7vFDUL/k02YwWiIVZnXrw5+MQAHqbMiqTxuGIGwpxKjT4dpeYsPrp9 gLQDqz8CvTniQWH8rcEe4+QLLBIwVRQPRA15V4IB2tSwFs8k9v0GWdHOu0G2bv5/gExS 8pq+sOb1PHRX4RediwnyGv753f31tLNpB44ixz7SsFSdkGKkt3knJmlfL0LLKYG6GP3/ APpI32tRW2851R3ul/N5HphCMJxbd0S1zk1juehh68rqQc9p03lPfiBVdl6eyJAed7u+ 5wTOFmpHamuTGPO1B2mUM2pT7AyUFpxRQvCpW0JS+M/YPP+XpZg5czjzz1PSH5igNHDx 5V2A== X-Gm-Message-State: AFeK/H2fD9EzX++0LCdSPeQD67jaOrxDGAW35TC7QNECTxD2t6txvOC6OiA0/MduK3xD6A== X-Received: by 10.28.69.72 with SMTP id s69mr4268520wma.85.1489775233387; Fri, 17 Mar 2017 11:27:13 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id t195sm3497491wmt.32.2017.03.17.11.27.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Mar 2017 11:27:12 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Mar 2017 18:27:11 +0000 Message-Id: <20170317182711.24800-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 Cc: Mika Kuoppala , Matthew Auld Subject: [Intel-gfx] [PATCH] drm/i915: Reinstate reservation_object zapping for batch_pool objects X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP I removed the zapping of the reservation_object->fence array of shared fences prematurely. We don't yet have the code to zap that array when retiring the object, and so currently it remains possible to continually grow the shared array trapping requests when reusing the batch_pool object across many timelines. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Joonas Lahtinen Cc: Matthew Auld --- drivers/gpu/drm/i915/i915_gem_batch_pool.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_batch_pool.c b/drivers/gpu/drm/i915/i915_gem_batch_pool.c index 41aa598c4f3b..414e46e2f072 100644 --- a/drivers/gpu/drm/i915/i915_gem_batch_pool.c +++ b/drivers/gpu/drm/i915/i915_gem_batch_pool.c @@ -114,12 +114,26 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool, list_for_each_entry(obj, list, batch_pool_link) { /* The batches are strictly LRU ordered */ if (i915_gem_object_is_active(obj)) { - if (!reservation_object_test_signaled_rcu(obj->resv, - true)) + struct reservation_object *resv = obj->resv; + + if (!reservation_object_test_signaled_rcu(resv, true)) break; i915_gem_retire_requests(pool->engine->i915); GEM_BUG_ON(i915_gem_object_is_active(obj)); + + /* The object is now idle, clear the array of shared + * fences before we add a new request. Although, we + * remain on the same engine, we may be on a different + * timeline and so may continually grow the array, + * trapping a reference to all the old fences, rather + * than replace the existing fence. + */ + if (rcu_access_pointer(resv->fence)) { + reservation_object_lock(resv, NULL); + reservation_object_add_excl_fence(resv, NULL); + reservation_object_unlock(resv); + } } GEM_BUG_ON(!reservation_object_test_signaled_rcu(obj->resv,