From patchwork Fri Feb 17 15:13:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9580103 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 E25676042F for ; Fri, 17 Feb 2017 15:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3DAD28687 for ; Fri, 17 Feb 2017 15:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8C30286F4; Fri, 17 Feb 2017 15:13: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 8153328687 for ; Fri, 17 Feb 2017 15:13:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C48A6ED4D; Fri, 17 Feb 2017 15:13:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 968AA6ED44 for ; Fri, 17 Feb 2017 15:13:09 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id c4so5604786wrd.1 for ; Fri, 17 Feb 2017 07:13:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=U8WK+9JDKTfvt6N+0C2nsbbG2XfB+WKsA09YCkJqYbI=; b=tmQlMKoUpTkFyuO7Ozs/DFE6dblC8bAa244nlG7Ny/ZgYmPClkAU2uuU5TR9c/YaKN qXo7xEtWyBl2xS0YSVeH5wlE1ZpIomX+vuOUX0QM76BF6i7kGYrD8JH6qHbFOmmb9vTE QeKQ+y9FJKyTBu3K4KJ2bD9xuAEEz4gH4G9zQAqyx63ow2nWinMjJt55bpsdr5muMBKh VZoZh77cFspgH/BHXVpJfZ6wJbvurP3qUQv0PQHR/Q2Uq0Z0ERragYNLZ+pU9dQ5EWQg jBdNNxfEUsHj0esf8SUfpOLASOJV/Oquf12eMXNOdmk1lgfEwAt+HjtbX/Y6o4/IPacP +knw== 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:subject:date:message-id :in-reply-to:references; bh=U8WK+9JDKTfvt6N+0C2nsbbG2XfB+WKsA09YCkJqYbI=; b=jABQZBUUEYIgMBTNVkm7wM8CXKmXtLI9WJey9H5diwf2+a/zRTPMY3hFa0EoX+uGln nnl1djAajzbNUClSmT4RmqDjxKf7WYk05yZdBfR2NEqzCI0ZeXOWYB+N+SmPLcZiD/Ue F0de08bf/pt2OFnFPAodyumJIIjvLfVNKpvWtZ3qlzP1zJNgyS/yduby20qu+7t739gV 5uh+RoDUdfudqyRtuR70snEtzPOodSWXcQhsnCMfyY30brYVPbmXFqF9EuYe6kbqRm1T OluJA+pgigNyqMKyu+AB/IAC3jD1RDI8gTsiYoaxmpTQMsX72od0hTQM+apar42sJW3E /qqg== X-Gm-Message-State: AMke39nqYPPc/Z9haz4xpJg54W8AivGJGH9S/RrUmQPAGQNVEv6F5FZKj6EfUNdpoqjuuQ== X-Received: by 10.223.134.15 with SMTP id 15mr7735660wrv.102.1487344387997; Fri, 17 Feb 2017 07:13:07 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id g40sm13379444wrg.19.2017.02.17.07.13.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 07:13:07 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Feb 2017 15:13:01 +0000 Message-Id: <20170217151304.16665-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170217151304.16665-1-chris@chris-wilson.co.uk> References: <20170217151304.16665-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [CI 3/6] drm/i915: Break i915_spin_request() if we see an interrupt 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 If an interrupt has been posted, and we were spinning on the active seqno waiting for it to advance but it did not, then we can expect that it will not see its advance in the immediate future and should call into the irq-seqno barrier. We can stop spinning at this point, and leave the difficulty of handling the coherency to the caller. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Mika Kuoppala Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_gem_request.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 2f6cfa47dc61..a5fac40d2a4f 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -963,7 +963,8 @@ static bool busywait_stop(unsigned long timeout, unsigned int cpu) bool __i915_spin_request(const struct drm_i915_gem_request *req, int state, unsigned long timeout_us) { - unsigned int cpu; + struct intel_engine_cs *engine = req->engine; + unsigned int irq, cpu; /* When waiting for high frequency requests, e.g. during synchronous * rendering split between the CPU and GPU, the finite amount of time @@ -975,11 +976,20 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req, * takes to sleep on a request, on the order of a microsecond. */ + irq = atomic_read(&engine->irq_count); timeout_us += local_clock_us(&cpu); do { if (__i915_gem_request_completed(req)) return true; + /* Seqno are meant to be ordered *before* the interrupt. If + * we see an interrupt without a corresponding seqno advance, + * assume we won't see one in the near future but require + * the engine->seqno_barrier() to fixup coherency. + */ + if (atomic_read(&engine->irq_count) != irq) + break; + if (signal_pending_state(state, current)) break;