public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 05/10] drm/i915: Fix partial GGTT faulting
Date: Mon, 15 Aug 2016 12:29:41 +0300	[thread overview]
Message-ID: <1471253381.3839.32.camel@linux.intel.com> (raw)
In-Reply-To: <1470997701-988-6-git-send-email-chris@chris-wilson.co.uk>

On pe, 2016-08-12 at 11:28 +0100, Chris Wilson wrote:
> @@ -1717,26 +1716,30 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
>  	}
>  
>  	/* Use a partial view if the object is bigger than the aperture. */

Move this comment down to where partial view is actually created.

> -	if (obj->base.size >= ggtt->mappable_end &&
> -	    !i915_gem_object_is_tiled(obj)) {
> +	/* Now pin it into the GTT if needed */
> +	vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0,
> +				       PIN_MAPPABLE | PIN_NONBLOCK);
> +	if (IS_ERR(vma)) {
> +		struct i915_ggtt_view partial;

'view' still makes more sense, less repeating of the word partial down.

> @@ -1754,26 +1757,7 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
>  	pfn = ggtt->mappable_base + i915_ggtt_offset(vma);
>  	pfn >>= PAGE_SHIFT;
>  
> -	if (unlikely(view.type == I915_GGTT_VIEW_PARTIAL)) {
> -		/* Overriding existing pages in partial view does not cause
> -		 * us any trouble as TLBs are still valid because the fault
> -		 * is due to userspace losing part of the mapping or never
> -		 * having accessed it before (at this partials' range).
> -		 */
> -		unsigned long base = area->vm_start +
> -				     (view.params.partial.offset << PAGE_SHIFT);
> -		unsigned int i;
> -
> -		for (i = 0; i < view.params.partial.size; i++) {
> -			ret = vm_insert_pfn(area,
> -					    base + i * PAGE_SIZE,
> -					    pfn + i);
> -			if (ret)
> -				break;
> -		}
> -
> -		obj->fault_mappable = true;
> -	} else {
> +	if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) {

likely() ?

>  		if (!obj->fault_mappable) {
>  			unsigned long size =
>  				min_t(unsigned long,
> @@ -1789,13 +1773,31 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
>  				if (ret)
>  					break;
>  			}
> -
> -			obj->fault_mappable = true;
>  		} else
>  			ret = vm_insert_pfn(area,
>  					    (unsigned long)vmf->virtual_address,
>  					    pfn + page_offset);
> +	} else {
> +		/* Overriding existing pages in partial view does not cause
> +		 * us any trouble as TLBs are still valid because the fault
> +		 * is due to userspace losing part of the mapping or never
> +		 * having accessed it before (at this partials' range).
> +		 */
> +		const struct i915_ggtt_view *view = &vma->ggtt_view;

I now see why you did the rename. Do not have a better idea really, so;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-08-15  9:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 10:28 Partial VMA fixes Chris Wilson
2016-08-12 10:28 ` [PATCH 01/10] drm/i915: Move map-and-fenceable tracking to the VMA Chris Wilson
2016-08-15  8:03   ` Joonas Lahtinen
2016-08-15  8:14     ` Chris Wilson
2016-08-12 10:28 ` [PATCH 02/10] drm/i915/userptr: Make gup errors stickier Chris Wilson
2016-08-15 11:16   ` Joonas Lahtinen
2016-08-15 15:08   ` Mika Kuoppala
2016-08-15 15:28     ` Chris Wilson
2016-08-16  7:40   ` Mika Kuoppala
2016-08-12 10:28 ` [PATCH 03/10] drm/i915: Move fence tracking from object to vma Chris Wilson
2016-08-15  9:18   ` Joonas Lahtinen
2016-08-15  9:25     ` Chris Wilson
2016-08-15 10:16       ` Joonas Lahtinen
2016-08-15  9:52     ` Chris Wilson
2016-08-12 10:28 ` [PATCH 04/10] drm/i915: Choose partial chunksize based on tile row size Chris Wilson
2016-08-12 10:38   ` Joonas Lahtinen
2016-08-12 10:28 ` [PATCH 05/10] drm/i915: Fix partial GGTT faulting Chris Wilson
2016-08-15  9:29   ` Joonas Lahtinen [this message]
2016-08-12 10:28 ` [PATCH 06/10] drm/i915: Choose not to evict faultable objects from the GGTT Chris Wilson
2016-08-12 10:50   ` Joonas Lahtinen
2016-08-12 11:13     ` Chris Wilson
2016-08-15 10:20       ` Joonas Lahtinen
2016-08-12 10:28 ` [PATCH 07/10] drm/i915: Fallback to using unmappable memory for scanout Chris Wilson
2016-08-15  9:33   ` Joonas Lahtinen
2016-08-12 10:28 ` [PATCH 08/10] drm/i915: Track display alignment on VMA Chris Wilson
2016-08-15  9:38   ` Joonas Lahtinen
2016-08-16  8:40     ` Chris Wilson
2016-08-12 10:28 ` [PATCH 09/10] drm/i915: Bump the inactive MRU tracking for all VMA accessed Chris Wilson
2016-08-15  9:59   ` Joonas Lahtinen
2016-08-15 10:12     ` Chris Wilson
2016-08-15 11:10       ` Joonas Lahtinen
2016-08-12 10:28 ` [PATCH 10/10] drm/i915: Stop discarding GTT cache-domain on unbind vma Chris Wilson
2016-08-15 10:03   ` Joonas Lahtinen
2016-08-12 10:33 ` ✗ Ro.CI.BAT: failure for series starting with [01/10] drm/i915: Move map-and-fenceable tracking to the VMA Patchwork

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=1471253381.3839.32.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /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