public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: matthew.auld@intel.com
Subject: Re: [PATCH v3 09/23] drm/i915: Always preallocate gen6/7 ppgtt
Date: Tue, 14 Feb 2017 18:12:13 +0200	[thread overview]
Message-ID: <87shngoioy.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170214110457.9316-10-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> The hardware does not cope very well with us changing the PD within an
> active context (the context must be idle for it to re-read the PD). As
> we only check whether the page is idle before changing the entry (and on
> through the PD tree), we cannot reliably replace PD entries on
> gen6/gen7. To fully avoid changing the tree at runtime, preallocate it
> on init.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Noticed that gen6_ppgtt_alloc is quite redundant.

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 679238c9371b..9077d0bd4e08 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2102,6 +2102,12 @@ static int gen6_ppgtt_allocate_page_directories(struct i915_hw_ppgtt *ppgtt)
>  	if (ppgtt->node.start < ggtt->mappable_end)
>  		DRM_DEBUG("Forced to use aperture for PDEs\n");
>  
> +	ppgtt->pd.base.ggtt_offset =
> +		ppgtt->node.start / PAGE_SIZE * sizeof(gen6_pte_t);
> +
> +	ppgtt->pd_addr = (gen6_pte_t __iomem *)ggtt->gsm +
> +		ppgtt->pd.base.ggtt_offset / sizeof(gen6_pte_t);
> +
>  	return 0;
>  
>  err_out:
> @@ -2144,7 +2150,6 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
>  	if (ret)
>  		return ret;
>  
> -	ppgtt->base.allocate_va_range = gen6_alloc_va_range;
>  	ppgtt->base.clear_range = gen6_ppgtt_clear_range;
>  	ppgtt->base.insert_entries = gen6_ppgtt_insert_entries;
>  	ppgtt->base.unbind_vma = ppgtt_unbind_vma;
> @@ -2154,22 +2159,21 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
>  	ppgtt->base.total = I915_PDES * GEN6_PTES * PAGE_SIZE;
>  	ppgtt->debug_dump = gen6_dump_ppgtt;
>  
> -	ppgtt->pd.base.ggtt_offset =
> -		ppgtt->node.start / PAGE_SIZE * sizeof(gen6_pte_t);
> -
> -	ppgtt->pd_addr = (gen6_pte_t __iomem *)ggtt->gsm +
> -		ppgtt->pd.base.ggtt_offset / sizeof(gen6_pte_t);
> -
>  	gen6_scratch_va_range(ppgtt, 0, ppgtt->base.total);
> -
>  	gen6_write_page_range(dev_priv, &ppgtt->pd, 0, ppgtt->base.total);
>  
> +	ret = gen6_alloc_va_range(&ppgtt->base, 0, ppgtt->base.total);
> +	if (ret) {
> +		gen6_ppgtt_cleanup(&ppgtt->base);
> +		return ret;
> +	}
> +
>  	DRM_DEBUG_DRIVER("Allocated pde space (%lldM) at GTT entry: %llx\n",
>  			 ppgtt->node.size >> 20,
>  			 ppgtt->node.start / PAGE_SIZE);
>  
> -	DRM_DEBUG("Adding PPGTT at offset %x\n",
> -		  ppgtt->pd.base.ggtt_offset << 10);
> +	DRM_DEBUG_DRIVER("Adding PPGTT at offset %x\n",
> +			 ppgtt->pd.base.ggtt_offset << 10);
>  
>  	return 0;
>  }
> -- 
> 2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-02-14 16:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 11:04 ppgtt allocation fixes and speedups Chris Wilson
2017-02-14 11:04 ` [PATCH v3 01/23] drm/i915: Micro-optimise i915_get_ggtt_vma_pages() Chris Wilson
2017-02-14 11:04 ` [PATCH v3 02/23] drm/i915: Micro-optimise gen6_ppgtt_insert_entries() Chris Wilson
2017-02-14 11:04 ` [PATCH v3 03/23] drm/i915: Micro-optimise gen8_ppgtt_insert_entries() Chris Wilson
2017-02-14 16:00   ` Mika Kuoppala
2017-02-15  8:30     ` Chris Wilson
2017-02-14 11:04 ` [PATCH v3 04/23] drm/i915: Don't special case teardown of aliasing_ppgtt Chris Wilson
2017-02-14 11:04 ` [PATCH v3 05/23] drm/i915: Split ggtt/alasing_gtt unbind_vma Chris Wilson
2017-02-14 11:04 ` [PATCH v3 06/23] drm/i915: Convert clflushed pagetables over to WC maps Chris Wilson
2017-02-14 11:04 ` [PATCH v3 07/23] drm/i915: Remove kmap/kunmap wrappers Chris Wilson
2017-02-14 11:04 ` [PATCH v3 08/23] drm/i915: Move allocate_va_range to GTT Chris Wilson
2017-02-14 11:04 ` [PATCH v3 09/23] drm/i915: Always preallocate gen6/7 ppgtt Chris Wilson
2017-02-14 16:12   ` Mika Kuoppala [this message]
2017-02-14 11:04 ` [PATCH v3 10/23] drm/i915: Remove redundant clear of appgtt Chris Wilson
2017-02-14 11:04 ` [PATCH v3 11/23] drm/i915: Tidy gen6_write_pde() Chris Wilson
2017-02-14 11:04 ` [PATCH v3 12/23] drm/i915: Remove bitmap tracking for used-ptes Chris Wilson
2017-02-14 12:30   ` Matthew Auld
2017-02-14 12:46     ` Chris Wilson
2017-02-14 11:04 ` [PATCH v3 13/23] drm/i915: Remove bitmap tracking for used-pdes Chris Wilson
2017-02-14 11:04 ` [PATCH v3 14/23] drm/i915: Remove bitmap tracking for used-pdpes Chris Wilson
2017-02-14 11:04 ` [PATCH v3 15/23] drm/i915: Remove bitmap tracking for used-pml4 Chris Wilson
2017-02-14 11:04 ` [PATCH v3 16/23] drm/i915: Remove superfluous posting reads after clear GGTT Chris Wilson
2017-02-14 11:04 ` [PATCH v3 17/23] drm/i915: Always mark the PDP as dirty when altered Chris Wilson
2017-02-14 11:04 ` [PATCH v3 18/23] drm/i915: Remove defunct GTT tracepoints Chris Wilson
2017-02-14 11:04 ` [PATCH v3 19/23] drm/i915: Remove unused ppgtt->enable() Chris Wilson
2017-02-14 11:04 ` [PATCH v3 20/23] drm/i915: Remove i915_address_space.start Chris Wilson
2017-02-14 11:04 ` [PATCH v3 21/23] drm/i915: Only preallocate the aliasing GTT to the extents of the global GTT Chris Wilson
2017-02-14 16:16   ` Mika Kuoppala
2017-02-14 11:04 ` [PATCH v3 22/23] drm/i915: Differentiate the aliasing_ppgtt with an invalid filp Chris Wilson
2017-02-14 11:04 ` [PATCH v3 23/23] drm/i915: Use preferred kernel types in i915_gem_gtt.c Chris Wilson
2017-02-14 11:14   ` Mika Kuoppala
2017-02-14 12:10     ` Chris Wilson
2017-02-14 12:22 ` ✗ Fi.CI.BAT: warning for series starting with [v3,01/23] drm/i915: Micro-optimise i915_get_ggtt_vma_pages() Patchwork
2017-02-14 12:25 ` ✓ Fi.CI.BAT: success " Patchwork
2017-02-14 12:26 ` Patchwork
2017-02-15 14:05 ` ppgtt allocation fixes and speedups Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shngoioy.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox