From patchwork Mon Dec 2 14:47:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 11269233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCCB7112B for ; Mon, 2 Dec 2019 14:47:12 +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 A556B2073C for ; Mon, 2 Dec 2019 14:47:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A556B2073C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk 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 723D389F35; Mon, 2 Dec 2019 14:47:11 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id D758089F35 for ; Mon, 2 Dec 2019 14:47:09 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 19429148-1500050 for multiple; Mon, 02 Dec 2019 14:47:02 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 2 Dec 2019 14:47:00 +0000 Message-Id: <20191202144702.2536644-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202144702.2536644-1-chris@chris-wilson.co.uk> References: <20191202144702.2536644-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/4] drm/i915: Manually flush barriers on eviction 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" As the caller may be keeping the engines awake, even though wait-for-idle will flush the contexts, the contexts will not be unpinned until the engine is parked. Manually flush the idle barriers to ensure that any context that can be unpinned, will be. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_evict.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index 7e62c310290f..0ff4be9b2954 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c @@ -28,7 +28,7 @@ #include -#include "gem/i915_gem_context.h" +#include "gt/intel_engine_heartbeat.h" #include "gt/intel_gt_requests.h" #include "i915_drv.h" @@ -40,6 +40,10 @@ I915_SELFTEST_DECLARE(static struct igt_evict_ctl { static int ggtt_flush(struct intel_gt *gt) { + struct intel_engine_cs *engine; + enum intel_engine_id id; + int ret; + /* * Not everything in the GGTT is tracked via vma (otherwise we * could evict as required with minimal stalling) so we are forced @@ -47,6 +51,21 @@ static int ggtt_flush(struct intel_gt *gt) * the hopes that we can then remove contexts and the like only * bound by their active reference. */ + ret = intel_gt_wait_for_idle(gt, MAX_SCHEDULE_TIMEOUT); + if (ret) + return ret; + + /* + * The engines may be kept awake by the caller and so skip the expected + * barrier flushes (needed for unpinning contexts) upon parking. + */ + for_each_engine(engine, gt, id) { + ret = intel_engine_flush_barriers(engine); + if (ret) + return ret; + } + + /* And once more for the barriers */ return intel_gt_wait_for_idle(gt, MAX_SCHEDULE_TIMEOUT); }