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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 08B0FC4332F for ; Fri, 21 Oct 2022 08:53:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1BBA210E652; Fri, 21 Oct 2022 08:53:54 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 514E610E363 for ; Fri, 21 Oct 2022 08:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666342419; x=1697878419; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=cFwDiFbENQZfTrlLcQX7MPRpjoM/g/Zry1B8Xhf9LfI=; b=UYRD7JJSnC2PBu72rVtyQ6JIDgTpojWXbXT6zo3lWrjlO3BkmWc7irx+ ApSanKd4Uqh8Np5eVDuDxe9eOCCW2iEkLNQJy4y8OciGxX9aqfSZrV+br nE2xqv7kyv0xL/JxUp+mynOjFmzYyGsXgt7dBTYK2YKmJdPU/LhQtk8Cp 5yElSxIvPndzsoIv1QpMyHqPkwO0l+yzZWsCk/a7APodSwN3LYanmRYUe HTOocUpB0u0M2BCoMlN5yJXnohrDjq5Kx2qHBE8fm4YPzoLjfhmerXbl0 MBzD3HK3Iu5s4A9IMKBSohtsEq0cD+b5HdnCKsid9z4w+y+K4tR26bwgd Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="308050687" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="308050687" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 01:53:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10506"; a="608258744" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="608258744" Received: from ahajda-mobl.ger.corp.intel.com (HELO [10.213.28.118]) ([10.213.28.118]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 01:53:35 -0700 Message-ID: <0c86efd8-3ea6-e3a5-46fa-8a57f4e8f20a@intel.com> Date: Fri, 21 Oct 2022 10:53:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.3.3 Content-Language: en-US To: Matthew Auld , intel-gfx@lists.freedesktop.org References: <20221020151047.369354-1-matthew.auld@intel.com> From: Andrzej Hajda Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 In-Reply-To: <20221020151047.369354-1-matthew.auld@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH] drm/i915: use i915_sg_dma_sizes() for internal backend 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hi Matthew, On 20.10.2022 17:10, Matthew Auld wrote: > We rely on page_sizes.sg in setup_scratch_page() reporting the correct > value if the underlying sgl is not contiguous, however in > get_pages_internal() we are only looking at the layout of the created > pages when calculating the sg_page_sizes, and not the final sgl, which > could in theory be completely different. In such a situation we might > incorrectly think we have a 64K scratch page, when it is actually only > 4K or similar split over multiple non-contiguous entries, which could > lead to broken behaviour when touching the scratch space within the > padding of a 64K GTT page-table. Like we already do for other backends, > switch over to calling i915_sg_dma_sizes() after mapping the pages. > > Signed-off-by: Matthew Auld > Cc: Andrzej Hajda The patch looks OK, but it still does not solve dmar errors in hugepages test [1]. [1]: https://gitlab.freedesktop.org/drm/intel/-/issues/5278 Anyway: Reviewed-by: Andrzej Hajda Regards Andrzej > --- > drivers/gpu/drm/i915/gem/i915_gem_internal.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_internal.c b/drivers/gpu/drm/i915/gem/i915_gem_internal.c > index c698f95af15f..301cfb127c4c 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_internal.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_internal.c > @@ -36,7 +36,6 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) > struct drm_i915_private *i915 = to_i915(obj->base.dev); > struct sg_table *st; > struct scatterlist *sg; > - unsigned int sg_page_sizes; > unsigned int npages; > int max_order; > gfp_t gfp; > @@ -75,7 +74,6 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) > > sg = st->sgl; > st->nents = 0; > - sg_page_sizes = 0; > > do { > int order = min(fls(npages) - 1, max_order); > @@ -94,7 +92,6 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) > } while (1); > > sg_set_page(sg, page, PAGE_SIZE << order, 0); > - sg_page_sizes |= PAGE_SIZE << order; > st->nents++; > > npages -= 1 << order; > @@ -116,7 +113,7 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) > goto err; > } > > - __i915_gem_object_set_pages(obj, st, sg_page_sizes); > + __i915_gem_object_set_pages(obj, st, i915_sg_dma_sizes(st->sgl)); > > return 0; >