From patchwork Fri Feb 17 15:13:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9580101 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 53F1C6042F for ; Fri, 17 Feb 2017 15:13:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 450DB28687 for ; Fri, 17 Feb 2017 15:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F1B286F4; Fri, 17 Feb 2017 15:13:16 +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 E65B428687 for ; Fri, 17 Feb 2017 15:13:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0120A6ED4A; 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-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DD406ED3E for ; Fri, 17 Feb 2017 15:13:11 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id v77so3068966wmv.0 for ; Fri, 17 Feb 2017 07:13:11 -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=NG5Z1CQYLDxIlZR/tuALn2AqePOKNDO5Z3sNDn0qrQM=; b=Crb9vLGK0Zz7192HdHPFr8Ebjpeb/2PY7qWEqrwpIWmVr3J6F600RzdFFzCgAHwf24 ym1Ue+NZbWD9otyPoeU9fQvvFZ4ng0r3tVwy52xDXbKYr8Us3nY0J9e6LlERlEVdnQsK 0+/JvTEWDei79N84VzkYYfPEIKAX7vbZteZIu3tWw31U7rFrd7onCUj+BD9ILl3UAVSp iM0Xk7wmdmqivHSbLjMxbq4wc2c+FWWJ1cqAyfJ54NF9dQEfE/3zv6/CFyrx3xwOQoPu Lt9cqvdAPkPbVfLqu5N37p/a88eYrP61SU3YdaHNnMFDungcOSyXQFwKAzCjja58tWdb iQ2w== 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=NG5Z1CQYLDxIlZR/tuALn2AqePOKNDO5Z3sNDn0qrQM=; b=qtaEjkAr9yMx9rp1oXkjDw27Q+ZuWdCg/2QV4njPd9QFK23S8L8l19QoPghmiQVOgc pCnUZ+PZ9eWmlZuH6zHu1z7C4Jl8hDzvshzK6TNSYimv1JDJHJDat/NBogYcHsKZKBri nnzhY6yUs0rKdxtQ8Z7rFQEMtaQJyBFI0raJmLZCmkqTEfP0HFMCZ4Ju6rOR5Akz4Kzd aYBS3HPbPfD6DD97ZsVB5FMirY9NjXNiGaftfW1YpbwaLkPdn2wE/rXqpRLZ0IwmqSBk sbwy8VDfcLKqby7BQpeOIweFN4l56uEtFVDwpX/nQqwztQJ2aUEOOg/Lp/u6ZsIbG7OM t6Nw== X-Gm-Message-State: AMke39lzAdfrHEQiTdgPC5a9z1fj3AnhP+lfx651SL2H+4S7qSJKmz50wb27LD7yA12T9Q== X-Received: by 10.28.144.135 with SMTP id s129mr2384070wmd.18.1487344389822; Fri, 17 Feb 2017 07:13:09 -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.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 07:13:09 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Feb 2017 15:13:03 +0000 Message-Id: <20170217151304.16665-5-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 5/6] drm/i915: Only start with the fake-irq timer if interrupts are dead 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 As a backup to waiting on a user-interrupt from the GPU, we use a heavy and frequent timer to wake up the waiting process should we detect an inconsistency whilst waiting. After seeing a "missed interrupt", the next time we wait, we restart the heavy timer. This patch is more reluctant to restart the timer and will only do so if we have not see any interrupts since when we started the fake irq timer. If we are seeing interrupts, then the waiters are being woken normally and we had an incoherency that caused to miss last time - that is unlikely to reoccur and so taking the risk of stalling again seems pragmatic. Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Mika Kuoppala Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/intel_breadcrumbs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c index 83a8b67d6427..1719f9da13b8 100644 --- a/drivers/gpu/drm/i915/intel_breadcrumbs.c +++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c @@ -107,6 +107,23 @@ static void irq_disable(struct intel_engine_cs *engine) spin_unlock(&engine->i915->irq_lock); } +static bool use_fake_irq(const struct intel_breadcrumbs *b) +{ + const struct intel_engine_cs *engine = + container_of(b, struct intel_engine_cs, breadcrumbs); + + if (!test_bit(engine->id, &engine->i915->gpu_error.missed_irq_rings)) + return false; + + /* Only start with the heavy weight fake irq timer if we have not + * seen any interrupts since enabling it the first time. If the + * interrupts are still arriving, it means we made a mistake in our + * engine->seqno_barrier(), a timing error that should be transient + * and unlikely to reoccur. + */ + return atomic_read(&engine->irq_count) == b->hangcheck_interrupts; +} + static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b) { struct intel_engine_cs *engine = @@ -145,8 +162,7 @@ static void __intel_breadcrumbs_enable_irq(struct intel_breadcrumbs *b) b->irq_enabled = true; } - if (!b->irq_enabled || - test_bit(engine->id, &i915->gpu_error.missed_irq_rings)) { + if (!b->irq_enabled || use_fake_irq(b)) { mod_timer(&b->fake_irq, jiffies + 1); i915_queue_hangcheck(i915); } else {