From patchwork Tue Aug 6 15:01:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11085755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 567D414F7 for ; Fri, 9 Aug 2019 09:16:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F8C28B38 for ; Fri, 9 Aug 2019 09:16:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38DE328C3E; Fri, 9 Aug 2019 09:16:32 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 045E028B38 for ; Fri, 9 Aug 2019 09:16:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D98A86ED50; Fri, 9 Aug 2019 09:15:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CCA36E3AC; Tue, 6 Aug 2019 15:01:39 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id g17so88234166wrr.5; Tue, 06 Aug 2019 08:01:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AWEQZoXJ7Lv+PikX4O1dFQhLFUVrnvufpDvNejlOGH4=; b=uCMmmV8QGKuWyCI3cyyQIEJ+f0xBMUDeuufnAVApVPQtn/UPCMzJqYScrLJXGJBGSD +0+MHoUYkkjmN4xQqn2wBBHDwPqBKcS7bq2gK3hcdF5aUWE70SVQppmOLCS85+vahOO/ JG+T3Q4+GOFtR91RYwfR3J20KthQf4Vy1/AigXBaMx0r9EYBmcc5wGQJGKNzyfgfuVrl vLlaqWfHFyJYGohbJLCvwbeGDz8ob9Gfu2B/LIMBWGwcZMahV5d8qlBNTIg/HYR6Itzb FL6TOU2I9vi6eK8U7VGqY74ykfTJm4nqpyVS/4Zi7DgNyev6zOEYMaf6SQFFoqa6444y YllQ== X-Gm-Message-State: APjAAAU76do5EArAcImzD5XSz/s7O+b2MHDxlelvjpYapMysIX5UwcPI YuHGs7DpUpFDKP+xPrx0CfaSPBPi X-Google-Smtp-Source: APXvYqxNUff5gRQUSR6MwQ8LIyUILMM1JJ8O1BxsAgqVbIbytaK1nsDoScmjjGF/QXYzyCBYt4MTXA== X-Received: by 2002:adf:ed8a:: with SMTP id c10mr5498627wro.33.1565103697985; Tue, 06 Aug 2019 08:01:37 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:d1e0:fffc:b0e3:c66d]) by smtp.gmail.com with ESMTPSA id g2sm78766828wmh.0.2019.08.06.08.01.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 08:01:37 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk Date: Tue, 6 Aug 2019 17:01:29 +0200 Message-Id: <20190806150134.104222-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190806150134.104222-1-christian.koenig@amd.com> References: <20190806150134.104222-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 09 Aug 2019 09:15:44 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=AWEQZoXJ7Lv+PikX4O1dFQhLFUVrnvufpDvNejlOGH4=; b=QSSKRK0YOzRwPGq1YzIWAguTcnw7OhIcQcyqCKmiHYpmwSVWFIrv+lrbf1YxJnnWbe JsXunHpz6nKlVc4Tv71LkWiYfkQhSAIVkWbZWiXVyOwLmNaNpEEHVST9rxG8jOnaN/D+ uP5HD5RnMQFb4i0l7DYjY2kL8lk9T9awNVoTqCC0+IW363dOroQrAt+Y6K9l+byfXdn4 t5WTCFCBxCEW/BGLJQrM3DCP7vab5eLK0doKPSYGV8zcPvNu1dyTMC5+sCifBpejX0AL blq6AsVVZ/xM4Ughu/67wSj9lv2NBtpg927g08AXYT07LRkjdBGH1elGZRL0VOhT8KOx stIA== Subject: [Intel-gfx] [PATCH 3/8] drm/i915: stop using seqcount for fenc pruning X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP After waiting for a reservation object use reservation_object_test_signaled_rcu to opportunistically prune the fences on the object. This allows removal of the seqcount handling in the reservation object. Signed-off-by: Christian König --- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_wait.c b/drivers/gpu/drm/i915/gem/i915_gem_wait.c index 26ec6579b7cd..fa46a54bcbe7 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_wait.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_wait.c @@ -35,7 +35,6 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, unsigned int flags, long timeout) { - unsigned int seq = __read_seqcount_begin(&resv->seq); struct dma_fence *excl; bool prune_fences = false; @@ -83,15 +82,12 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, /* * Opportunistically prune the fences iff we know they have *all* been - * signaled and that the reservation object has not been changed (i.e. - * no new fences have been added). + * signaled. */ - if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) { - if (reservation_object_trylock(resv)) { - if (!__read_seqcount_retry(&resv->seq, seq)) - reservation_object_add_excl_fence(resv, NULL); - reservation_object_unlock(resv); - } + if (prune_fences && reservation_object_trylock(resv)) { + if (reservation_object_test_signaled_rcu(resv, true)) + reservation_object_add_excl_fence(resv, NULL); + reservation_object_unlock(resv); } return timeout;