From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: Re: [PATCH] [v2] drm/i915: Paranoia - get zeroed page table pages Date: Wed, 05 Mar 2014 18:32:06 +0200 Message-ID: <1394037126.31112.30.camel@intelbox> References: <1393525802-978-1-git-send-email-benjamin.widawsky@intel.com> <1393559258-1405-1-git-send-email-benjamin.widawsky@intel.com> Reply-To: imre.deak@intel.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0307662561==" Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id A4DBCFA488 for ; Wed, 5 Mar 2014 08:33:14 -0800 (PST) In-Reply-To: <1393559258-1405-1-git-send-email-benjamin.widawsky@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Ben Widawsky Cc: Intel GFX , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org --===============0307662561== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-ErdpjHI6+NDrJB/4QLu0" --=-ErdpjHI6+NDrJB/4QLu0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2014-02-27 at 19:47 -0800, Ben Widawsky wrote: > We normally clear the page tables as one of the first things during > initialization. They are however wired up (and potentially valid) before > we clear them. I might be missing something, but afaics the page directories/tables are not in use until after ppgtt->enable()/mm_switch() is called on them, which is after the clear_range() call. I'd understand if it's about leaving uninitialized stuff _after_ clear_range() is called. But I think because of the 1G size alignment for ppgtt that's not possible either. --Imre > To prevent the GPU from doing anything we might later regret, simply get > zeroed pages, which always mean invalid on all GENs. >=20 > NOTE: that a similar paranoia could be applied to GGTT via making sure > all entries are invalid ASAP. I think the extra work required to fix > such a BIOS bug is unwarranted until proven necessary. >=20 > v2: Remove useless GFP_ZERO in the kcallocs >=20 > Signed-off-by: Ben Widawsky > --- > drivers/gpu/drm/i915/i915_gem_gtt.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i= 915_gem_gtt.c > index 0c27d8a..5e3957e 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > @@ -359,7 +359,7 @@ static struct page **__gen8_alloc_page_tables(void) > return ERR_PTR(-ENOMEM); > =20 > for (i =3D 0; i < GEN8_PDES_PER_PAGE; i++) { > - pt_pages[i] =3D alloc_page(GFP_KERNEL); > + pt_pages[i] =3D alloc_page(GFP_KERNEL | __GFP_ZERO); > if (!pt_pages[i]) > goto bail; > } > @@ -421,7 +421,8 @@ static int gen8_ppgtt_allocate_dma(struct i915_hw_ppg= tt *ppgtt) > static int gen8_ppgtt_allocate_page_directories(struct i915_hw_ppgtt *pp= gtt, > const int max_pdp) > { > - ppgtt->pd_pages =3D alloc_pages(GFP_KERNEL, get_order(max_pdp << PAGE_S= HIFT)); > + ppgtt->pd_pages =3D alloc_pages(GFP_KERNEL | __GFP_ZERO, > + get_order(max_pdp << PAGE_SHIFT)); > if (!ppgtt->pd_pages) > return -ENOMEM; > =20 > @@ -1021,7 +1022,7 @@ static int gen6_ppgtt_allocate_page_tables(struct i= 915_hw_ppgtt *ppgtt) > return -ENOMEM; > =20 > for (i =3D 0; i < ppgtt->num_pd_entries; i++) { > - ppgtt->pt_pages[i] =3D alloc_page(GFP_KERNEL); > + ppgtt->pt_pages[i] =3D alloc_page(GFP_KERNEL | __GFP_ZERO); > if (!ppgtt->pt_pages[i]) { > gen6_ppgtt_free(ppgtt); > return -ENOMEM; --=-ErdpjHI6+NDrJB/4QLu0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQEcBAABAgAGBQJTF1GGAAoJEORIIAnNuWDFQAcH/Rci1VBNDSjdthg0xt8PCr15 +s23FSA4FF3L++KdfPGZ1QuSqBAOKheh1Z26LH29BwNhP6XQNKXX0TlEeNP/GDpF Ef+J04puOv7jGbIzUveuUqHfhWgV/FL+RHBpNR65k5sAHB4Iyab2AYJ3spxaQh4q 2aHlyl8DO7Yqw/RPl3NDek0mhieFoEQs8bhBAVSTd0QqsAdA39pCkBrUjv+XdbeA xhxEuDQ+04xxjkfulY2ZGmaqc2hLG9sWnYGfFNikvXy3hI5lgEoYNXUWA0AME9BW dGyVfwYeF2MfSDNpa3sBMXGV7XN1/o4PGhofbZZtDrhp+B3Y7OPqrbTO5x3Zc64= =/zFL -----END PGP SIGNATURE----- --=-ErdpjHI6+NDrJB/4QLu0-- --===============0307662561== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============0307662561==--