From patchwork Tue Jan 24 11:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9534903 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 0979F6042D for ; Tue, 24 Jan 2017 11:00:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F067B26CFF for ; Tue, 24 Jan 2017 11:00:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E54A926D08; Tue, 24 Jan 2017 11:00:20 +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 9C51C26CFF for ; Tue, 24 Jan 2017 11:00:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15AF46E780; Tue, 24 Jan 2017 11:00:19 +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 598766E743 for ; Tue, 24 Jan 2017 11:00:16 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id c85so33674283wmi.1 for ; Tue, 24 Jan 2017 03:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0vqf3QjDJT47GBGTgdqV0jvf46wx6wb3PBVrCtF4I1o=; b=WKkZrhebI0zZ1Ee8be1OXDMbi286qlItzHh5kGgwPPbOl1Efy/sZ7YVy18YKzLaCUn kbqTEW6nGGlbtHDWhmAWdTnlQls6DfFC+igCKsm/jSdasXtUvXjoHQWLIfWP8HNcSAg+ Gu1XQompR3se98QvEMK81i1NTdYKBCWRioRQFyGuaYfAdv61tOvSaBwgV+iJmZaLzXyQ FpYWSfoX6qAY/Z/kGn7rMBk+6iCBfbXTHfpfyP7UNLaL/dAeQsJuS6hz4n7hw58EYTIv bq7e0fOgTvJQaRTOgxjBueJAzTGZbo7ZOixo2BgvHWCZxRDGlP11l6VbaTGO7F7Q0Noc Ir5A== 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 :in-reply-to:references; bh=0vqf3QjDJT47GBGTgdqV0jvf46wx6wb3PBVrCtF4I1o=; b=dvpapGTRF8XyPCIhKE40vJd0AYaibEmF1/BIpSX9Z+amwXByTqI9EWLfIH6CvjQY9o JMMU98OE17dYyvUc+DopWKl/DpUJ9ikVEhH0wc8+uQdCXIZ73xIbMsyr2ObaukLz0rxx pIwYhClHdmvvKAPHYNnDQGsw06GA/pcaPibVuo36vNI0DI0lum45AxL6MududO/GqPRg uSjwhfn551w87Ndvqx440GySbxhd4jepxYzPtxKqKOoFwHugYnhQfbAnInNbqFEguEyE L98qoM6JGS0CYbIInvkEcPxZ878fS5NZym6/nLN2ET6pfGpOGgugRNuvYb9qJjpERMhb oJrQ== X-Gm-Message-State: AIkVDXIILVhL6gZoL+8d6kdQKVEykRQECXKVNTvBMChbemZHXGbVmXRal7IN7Kn6WjwCHA== X-Received: by 10.28.182.70 with SMTP id g67mr18061360wmf.131.1485255614986; Tue, 24 Jan 2017 03:00:14 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id x69sm11857573wma.15.2017.01.24.03.00.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 03:00:14 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Tue, 24 Jan 2017 11:00:05 +0000 Message-Id: <20170124110009.28947-4-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170124110009.28947-1-chris@chris-wilson.co.uk> References: <20170124110009.28947-1-chris@chris-wilson.co.uk> Cc: Mika Kuoppala Subject: [Intel-gfx] [PATCH v3 4/8] drm/i915: Only run execlist context-switch handler after 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 Mark when we run the execlist tasklet following the interrupt, so we don't probe a potentially uninitialised register when submitting the contexts multiple times before the hardware responds. v2: Use a shared engine->irq_posted Signed-off-by: Chris Wilson Cc: Mika Kuoppala Cc: Tvrtko Ursulin irq_tasklet); + + if (iir & (GT_CONTEXT_SWITCH_INTERRUPT << test_shift)) { + set_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted); + tasklet_hi_schedule(&engine->irq_tasklet); + } } static irqreturn_t gen8_gt_irq_ack(struct drm_i915_private *dev_priv, diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 9896027880ea..7db9c49450f9 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -564,7 +564,7 @@ static void intel_lrc_irq_handler(unsigned long data) intel_uncore_forcewake_get(dev_priv, engine->fw_domains); - if (!execlists_elsp_idle(engine)) { + while (__test_and_clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted)) { u32 __iomem *csb_mmio = dev_priv->regs + i915_mmio_reg_offset(RING_CONTEXT_STATUS_PTR(engine)); u32 __iomem *buf = @@ -1297,6 +1297,7 @@ static int gen8_init_common_ring(struct intel_engine_cs *engine) DRM_DEBUG_DRIVER("Execlists enabled for %s\n", engine->name); /* After a GPU reset, we may have requests to replay */ + __clear_bit(ENGINE_IRQ_EXECLIST, &engine->irq_posted); if (!execlists_elsp_idle(engine)) { engine->execlist_port[0].count = 0; engine->execlist_port[1].count = 0; diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index a9ea84ea3155..8e872730f8eb 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -213,6 +213,7 @@ struct intel_engine_cs { unsigned long irq_posted; #define ENGINE_IRQ_BREADCRUMB 0 +#define ENGINE_IRQ_EXECLIST 1 /* Rather than have every client wait upon all user interrupts, * with the herd waking after every interrupt and each doing the