From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD00EC433E0 for ; Thu, 24 Dec 2020 14:50:27 +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 2FFEA22288 for ; Thu, 24 Dec 2020 14:50:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FFEA22288 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 A4C03891F8; Thu, 24 Dec 2020 14:50:26 +0000 (UTC) Received: from fireflyinternet.com (unknown [77.68.26.236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 45698891F8 for ; Thu, 24 Dec 2020 14:50:24 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 23423834-1500050 for multiple; Thu, 24 Dec 2020 14:50:20 +0000 MIME-Version: 1.0 In-Reply-To: <20201224143455.387624-1-matthew.auld@intel.com> References: <20201224143455.387624-1-matthew.auld@intel.com> From: Chris Wilson To: Matthew Auld , intel-gfx@lists.freedesktop.org Date: Thu, 24 Dec 2020 14:50:19 +0000 Message-ID: <160882141974.19405.14277501027996947719@build.alporthouse.com> User-Agent: alot/0.9 Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915: clear the shadow batch X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Quoting Matthew Auld (2020-12-24 14:34:54) > The shadow batch is an internal object, which doesn't have any page > clearing, and since the batch_len can be smaller than the object, we > should take care to clear it. > > Testcase: igt/gen9_exec_parse/shadow-peek > Fixes: 4f7af1948abc ("drm/i915: Support ro ppgtt mapped cmdparser shadow buffers") > Signed-off-by: Matthew Auld > --- > drivers/gpu/drm/i915/i915_cmd_parser.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c > index 8d88402387bd..ff3a0b8ccdd5 100644 > --- a/drivers/gpu/drm/i915/i915_cmd_parser.c > +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c > @@ -1147,6 +1147,13 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, > if (IS_ERR(dst)) > return dst; > > + if (length < dst_obj->base.size) { > + memset32(dst + length, 0, > + (dst_obj->base.size - length) / sizeof(u32)); > + __i915_gem_object_flush_map(dst_obj, length, > + dst_obj->base.size - length); > + } I feel like we might as well remove the shadow_needs_clflush() and just do a i915_gem_object_flush_map(shadow->obj) after parsing. Then for simple chronological ordering, we can place this at the end of copy_batch memset32(dst + length, 0, (dst_obj->base.size - length) / sizeof(u32)); The cost of one more function call along here? Unnoticable. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx