Skip to contentSkip to conversation

lib/igt_fb: Add missing set_domain calls

PATCH In review Ville Syrjala 3 participants 4 messages Sep 6, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_fb: Add missing set_domain calls

From: Ville Syrjälä <[email protected]>

We're missing some set_domain calls around the ggtt mmap paths. This means we never tell the kernel that we've dirtied the object. And then at some point down the line the kernel throws the pages into /dev/null instead of hanging on to them/swapping them out because they were never marked as dirty.

Throw in the missing set_domains(GTT,GTT) calls and rip out the old bogus set_domain(CPU,CPU).

---
 lib/igt_fb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
lib/igt_fb.c +8 -4
index ae71d9673228..1085d25d33ce 100644
@@ -404,6 +404,9 @@ static int create_bo_for_fb(int fd, int width, int height,
 			bo = gem_create(fd, size);
 			gem_set_tiling(fd, bo, igt_fb_mod_to_tiling(tiling), stride);
 
+			gem_set_domain(fd, bo,
+				       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
 			/* Ensure the framebuffer is preallocated */
 			ptr = gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE);
 			igt_assert(*(uint32_t *)ptr == 0);
@@ -1342,6 +1345,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 {
 	void *ptr;
 
+	gem_set_domain(fd, fb->gem_handle,
+		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+
 	if (fb->is_dumb)
 		ptr = kmstest_dumb_map_buffer(fd, fb->gem_handle, fb->size,
 					      PROT_READ | PROT_WRITE);
@@ -1790,6 +1796,8 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
 		setup_linear_mapping(fd, fb, &blit->linear);
 	} else {
 		blit->linear.handle = 0;
+		gem_set_domain(fd, fb->gem_handle,
+			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		blit->linear.map = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 					      PROT_READ | PROT_WRITE);
 		igt_assert(blit->linear.map);
@@ -1848,10 +1856,6 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
 			create_cairo_surface__gtt(fd, fb);
 	}
 
-	if (!fb->is_dumb)
-		gem_set_domain(fd, fb->gem_handle, I915_GEM_DOMAIN_CPU,
-			       I915_GEM_DOMAIN_CPU);
-
 	igt_assert(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS);
 	return fb->cairo_surface;
 }
Signature · 6 lines
2.16.4

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/1
#1 lore raw

Quoting Ville Syrjala (2018-09-06 13:27:49)

Quoted 7 lines

From: Ville Syrjälä <[email protected]>

We're missing some set_domain calls around the ggtt mmap paths. This means we never tell the kernel that we've dirtied the object. And then at some point down the line the kernel throws the pages into /dev/null instead of hanging on to them/swapping them out because they were never marked as dirty.

They all look fine. The first write into the GTT mmap was supposed to mark the object as dirty, but that turns out to have been tempermental due to the GTT mmap not marking its pages as wrprotect and so never refaulting before a write. That userspace is meant to be doing its own domain tracking, ie calling set-domain(GTT, GTT), avoiding us having to pagefault ever again is our excuse. For the record, we changed the assumption to mark the object as dirty when we fault in a fresh PROT_WRITE object very recently in

commit aae7c06b34e4a351c8dab28f3cda6b1ba0637bf9

Author: Chris Wilson <[email protected]>
Date:   Mon Sep 3 09:33:34 2018 +0100

drm/i915: Flag any possible writes for a GTT fault

(because I noticed that copy_to_user() wasn't triggering a fresh fault ;)

Quoted 4 lines

Throw in the missing set_domains(GTT,GTT) calls and rip out the old bogus set_domain(CPU,CPU).

-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for lib/igt_fb: Add missing set_domain calls

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: lib/igt_fb: Add missing set_domain calls
URL : https://patchwork.freedesktop.org/series/49271/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4779 -> IGTPW_1802 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49271/revisions/1/mbox/

== Known issues ==

Here are the changes found in IGTPW_1802 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       PASS -> DMESG-WARN (fdo#102614)
      fi-byt-clapper:     PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362, fdo#103191)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    
    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
      fi-byt-clapper:     FAIL (fdo#107362) -> PASS

    igt@kms_psr@primary_page_flip:
      fi-kbl-r:           FAIL (fdo#107336) -> PASS

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718

== Participating hosts (54 -> 48) ==

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-glk-j4005

== Build changes ==

* IGT: IGT_4631 -> IGTPW_1802

CI_DRM_4779: 5f8b5f90051bf5470bd0ff3625ff0d4cf2c29825 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1802: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1802/
IGT_4631: 8884101aa01aedee01b2c3d0ac075473384551b7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1802/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for lib/igt_fb: Add missing set_domain calls

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: lib/igt_fb: Add missing set_domain calls
URL : https://patchwork.freedesktop.org/series/49271/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4631_full -> IGTPW_1802_full =

== Summary - WARNING ==

Minor unknown changes coming with IGTPW_1802_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_1802_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49271/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in IGTPW_1802_full:

=== IGT changes ===

    ==== Warnings ====

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          PASS -> SKIP

== Known issues ==

Here are the changes found in IGTPW_1802_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@fence-restore-tiled2untiled:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-pwrite:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    igt@kms_setmode@basic:
      shard-kbl:          PASS -> FAIL (fdo#99912)

    igt@prime_busy@wait-after-blt:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    
    ==== Possible fixes ====

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
      shard-hsw:          FAIL (fdo#105767) -> PASS

    igt@kms_frontbuffer_tracking@fbc-badstride:
      shard-glk:          FAIL (fdo#103167) -> PASS

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-snb:          FAIL (fdo#107749) -> PASS

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    igt@perf@blocking:
      shard-hsw:          FAIL (fdo#102252) -> PASS

    igt@prime_busy@wait-before-bsd:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
fdo#107749 https://bugs.freedesktop.org/show_bug.cgi?id=107749
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* IGT: IGT_4631 -> IGTPW_1802
* Linux: CI_DRM_4775 -> CI_DRM_4779

CI_DRM_4775: 1a2bb6c061217718b972b3f4a74b96b61cf19d0c @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4779: 5f8b5f90051bf5470bd0ff3625ff0d4cf2c29825 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1802: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1802/
IGT_4631: 8884101aa01aedee01b2c3d0ac075473384551b7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1802/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev