From patchwork Fri Mar 10 09:42:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9615673 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 A82FD60414 for ; Fri, 10 Mar 2017 09:42:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91B3528518 for ; Fri, 10 Mar 2017 09:42:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86C3F285B6; Fri, 10 Mar 2017 09:42:19 +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 3301628518 for ; Fri, 10 Mar 2017 09:42:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E9CD6EDE9; Fri, 10 Mar 2017 09:42:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 700EB6EDE9 for ; Fri, 10 Mar 2017 09:42:16 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id v190so1342837wme.3 for ; Fri, 10 Mar 2017 01:42: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; bh=4jUpOjoiqh/sX3KeZQhslRblWZQ4iSBxw5R6DsdyHf4=; b=OLTYs8UfqAOvEAcZ4waFDHwJOL8PcI0lTqIDeQQlFRbembWdCLJH7PEO80o5Q1vghd SYPSs55TsBo8X8PsIMZszhC564sDHECtOiqcBGAjIjmyLgTsxEprz2Tc0kaOFWdvtooD X7nGhCBr9gB37b1tyybXCljba9Xhr6fGex1VFzSegmDVpjwr5uzGo469e2KJnYVkfZ9E GRREdA7mRNc240xBhjUbyB2X2EVr9qmfj9eeLVtDGMSNk6ayA8UMJBYW/cy0raMQC9J6 49FcYEMUZscQTnyCVp/nyyG2Uf8n9/qRpCoMzDuD5MuGobqerf8hF/66IKa+I+u5tfHa FOIw== 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; bh=4jUpOjoiqh/sX3KeZQhslRblWZQ4iSBxw5R6DsdyHf4=; b=SYznDdIhdjGmTYSf/adxxw8u9vfYBofKdO/bqkuNYXJqFyBDmja4YhUHL+c5+KzXDX ZSUs9ygHk6kQqi+n9HPxK20/XdbxYlnCDiiQSpOFiJLK5cq+PWMH42HYQ1ONa47XGLth k92A3rGbUTQvSR2C/ZBRfTygnVBtGP01UlOVDojiH0SHPnZxC3FetuXWaQP689bhSS6b MWwndeVriV9OIO0th0cOLXOQT8aQcZw70ILrEAqrao3Kaq60vIVHZQ8YeOnHKHkPW2nI 5e7XgKu17RC855AFjrgm5AZ8gqISXakh8GlPK+25dsD+8+lDXqLQNtZn2mBGg5+xym4P wUIw== X-Gm-Message-State: AFeK/H07bcUaRr5V1bcoXBuAfUJtxkoro38FINIVXTmAYq/rg67reIbjt0B2k08OQ4iV1g== X-Received: by 10.28.15.202 with SMTP id 193mr1438316wmp.99.1489138934960; Fri, 10 Mar 2017 01:42:14 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id j34sm11950158wre.7.2017.03.10.01.42.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Mar 2017 01:42:14 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 10 Mar 2017 09:42:12 +0000 Message-Id: <20170310094212.3496-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 Subject: [Intel-gfx] [PATCH] drm/i915/cmdparser: Limit clflush to active cachelines 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 We only need to clflush those cachelines that we have validated to be read by the GPU. Userspace typically fills the batch length in correctly, the exceptions tend to be explicit tests within igt. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_cmd_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index 21b1cd917d81..b9ce9a6881ea 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -1331,7 +1331,8 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine, } if (ret == 0 && needs_clflush_after) - drm_clflush_virt_range(shadow_batch_obj->mm.mapping, batch_len); + drm_clflush_virt_range(shadow_batch_obj->mm.mapping, + (void *)cmd - shadow_batch_obj->mm.mapping); i915_gem_object_unpin_map(shadow_batch_obj); return ret;