Skip to contentSkip to conversation

drm/i915: unify partial/normal page insertion loops

PATCH In review Matthew Auld 3 participants 3 messages Mar 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: unify partial/normal page insertion loops

Cc Joonas Lahtinen <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem.c | 40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +16 -24
index b854af2..13ce2bf 100644
@@ -1798,6 +1798,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	unsigned long pfn;
 	int ret = 0;
 	bool write = !!(vmf->flags & FAULT_FLAG_WRITE);
+	unsigned long base, size;
 
 	intel_runtime_pm_get(dev_priv);
 
@@ -1859,17 +1860,25 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 		i915_gem_obj_ggtt_offset_view(obj, &view);
 	pfn >>= PAGE_SHIFT;
 
+	base = vma->vm_start;
+
 	if (unlikely(view.type == I915_GGTT_VIEW_PARTIAL)) {
+		base += view.params.partial.offset << PAGE_SHIFT;
+		size = view.params.partial.size;
+	} else {
+		size = min_t(unsigned long, vma->vm_end - vma->vm_start,
+			     obj->base.size) >> PAGE_SHIFT;
+	}
+
+	if (!obj->fault_mappable || view.type == I915_GGTT_VIEW_PARTIAL) {
+		unsigned long i;
+
 		/* 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 = vma->vm_start +
-				     (view.params.partial.offset << PAGE_SHIFT);
-		unsigned int i;
-
-		for (i = 0; i < view.params.partial.size; i++) {
+		for (i = 0; i < size; i++) {
 			ret = vm_insert_pfn(vma, base + i * PAGE_SIZE, pfn + i);
 			if (ret)
 				break;
@@ -1877,25 +1886,8 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
 		obj->fault_mappable = true;
 	} else {
-		if (!obj->fault_mappable) {
-			unsigned long size = min_t(unsigned long,
-						   vma->vm_end - vma->vm_start,
-						   obj->base.size);
-			int i;
-
-			for (i = 0; i < size >> PAGE_SHIFT; i++) {
-				ret = vm_insert_pfn(vma,
-						    (unsigned long)vma->vm_start + i * PAGE_SIZE,
-						    pfn + i);
-				if (ret)
-					break;
-			}
-
-			obj->fault_mappable = true;
-		} else
-			ret = vm_insert_pfn(vma,
-					    (unsigned long)vmf->virtual_address,
-					    pfn + page_offset);
+		ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address,
+				    pfn + page_offset);
 	}
 unpin:
 	i915_gem_object_ggtt_unpin_view(obj, &view);
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: unify partial/normal page insertion loops

== Series Details ==

== Series Details ==

Series: drm/i915: unify partial/normal page insertion loops
URL : https://patchwork.freedesktop.org/series/4476/
State : failure

== Summary ==

Series 4476v1 drm/i915: unify partial/normal page insertion loops
http://patchwork.freedesktop.org/api/1.0/series/4476/revisions/1/mbox/

Test kms_flip:

        Subgroup basic-flip-vs-dpms:
                pass       -> DMESG-WARN (hsw-brixbox)
        Subgroup basic-flip-vs-wf_vblank:
                dmesg-warn -> PASS       (hsw-brixbox)
Test kms_pipe_crc_basic:
        Subgroup read-crc-pipe-c:
                fail       -> PASS       (hsw-brixbox)
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (skl-nuci5)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (bsw-nuc-2)
bdw-ultra        total:194  pass:173  dwarn:0   dfail:0   fail:0   skip:21 
bsw-nuc-2        total:194  pass:156  dwarn:1   dfail:0   fail:0   skip:37 
hsw-brixbox      total:194  pass:171  dwarn:1   dfail:0   fail:0   skip:22 
hsw-gt2          total:194  pass:177  dwarn:0   dfail:0   fail:0   skip:17 
ivb-t430s        total:194  pass:169  dwarn:0   dfail:0   fail:0   skip:25 
skl-i5k-2        total:194  pass:171  dwarn:0   dfail:0   fail:0   skip:23 
skl-i7k-2        total:194  pass:171  dwarn:0   dfail:0   fail:0   skip:23 
skl-nuci5        total:194  pass:183  dwarn:0   dfail:0   fail:0   skip:11 
snb-dellxps      total:194  pass:159  dwarn:1   dfail:0   fail:0   skip:34 

Results at /archive/results/CI_IGT_test/Patchwork_1605/

fc881ebd9c3c26919c7d1113f8bf7014e1a05563 drm-intel-nightly: 2016y-03m-15d-13h-10m-41s UTC integration manifest ec4aa8c47920d5aacf5b35e9237de07d092d3ef5 drm/i915: unify partial/normal page insertion loops

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Matthew Auld
Quoted 2 lines · Matthew Auld
Cc Joonas Lahtinen <[email protected]>

I know I sent patches to make this even simpler than what you present here, and that *fix* *actual* *bugs* in the partial VMA code. -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx