diff mbox series

drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler

Message ID 20200921035017.6868-1-zbigniew.kempczynski@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault handler | expand

Commit Message

Zbigniew Kempczyński Sept. 21, 2020, 3:50 a.m. UTC
On !llc platforms when buffer is mapped with WB using GEM_MMAP_OFFSET
pagefault handler clears its dirty flag. This has consequences
buffer is not flushed on exec before moving to render domain.
So make sure we keep dirty flag for buffers mapped to write until
it leaves cpu domain.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Zbigniew Kempczyński Sept. 21, 2020, 7:21 a.m. UTC | #1
On Mon, Sep 21, 2020 at 06:55:36AM +0000, Patchwork wrote:
>    Patch Details
> 
>    Series:  drm/i915: Ensure bo is dirty when WB-mapped on !llc in pagefault    
>             handler (rev2)                                                      
>    URL:     https://patchwork.freedesktop.org/series/81881/                     
>    State:   failure                                                             
>    Details: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18538/index.html 
> 
>        CI Bug Log - changes from CI_DRM_9025_full -> Patchwork_18538_full
> 
> Summary
> 
>    FAILURE
> 
>    Serious unknown changes coming with Patchwork_18538_full absolutely need
>    to be
>    verified manually.
> 
>    If you think the reported changes have nothing to do with the changes
>    introduced in Patchwork_18538_full, please notify your bug team to allow
>    them
>    to document this new failure mode, which will reduce false positives in
>    CI.
> 
> Possible new issues
> 
>    Here are the unknown changes that may have been introduced in
>    Patchwork_18538_full:
> 
>   IGT changes
> 
>     Possible regressions
> 
>      * igt@kms_flip@2x-nonexisting-fb-interruptible@ac-vga1-hdmi-a1:
>           * shard-hsw: NOTRUN -> INCOMPLETE +1 similar issue

Unrelated. See below.

> 
> Known issues
> 
>    Here are the changes found in Patchwork_18538_full that come from known
>    issues:
> 
>   IGT changes
> 
>     Issues hit
> 
>      * igt@gem_ctx_persistence@engines-mixed-process@bcs0:
> 
>           * shard-skl: PASS -> FAIL (i915#2374)
>      * igt@gem_ctx_persistence@legacy-engines-mixed@vebox:
> 
>           * shard-kbl: PASS -> DMESG-WARN (i915#1982)
>      * igt@gem_exec_reloc@basic-many-active@rcs0:
> 
>           * shard-glk: PASS -> FAIL (i915#2389) +3 similar issues
>      * igt@gem_huc_copy@huc-copy:
> 
>           * shard-tglb: PASS -> SKIP (i915#2190)
>      * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
> 
>           * shard-hsw: PASS -> FAIL (i915#96)
>      * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
> 
>           * shard-skl: PASS -> DMESG-WARN (i915#1982) +5 similar issues
>      * igt@kms_cursor_legacy@pipe-b-torture-bo:
> 
>           * shard-iclb: PASS -> DMESG-WARN (i915#128)
>      * igt@kms_draw_crc@draw-method-rgb565-pwrite-untiled:
> 
>           * shard-skl: PASS -> FAIL (i915#177 / i915#52 / i915#54)
>      * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
> 
>           * shard-tglb: PASS -> DMESG-WARN (i915#1982) +2 similar issues
>      * igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-wc:
> 
>           * shard-skl: PASS -> FAIL (i915#49) +1 similar issue
>      * igt@kms_hdr@bpc-switch-suspend:
> 
>           * shard-skl: PASS -> FAIL (i915#1188) +1 similar issue
>      * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
> 
>           * shard-iclb: PASS -> INCOMPLETE (i915#1185 / i915#250)
>      * igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
> 
>           * shard-skl: PASS -> FAIL (fdo#108145 / i915#265) +1 similar issue
>      * igt@kms_psr@psr2_cursor_render:
> 
>           * shard-iclb: PASS -> SKIP (fdo#109441) +1 similar issue
> 
>     Possible fixes
> 
>      * igt@gem_eio@suspend:
> 
>           * shard-iclb: INCOMPLETE (i915#2483) -> PASS


>      * igt@gem_mmap_offset@blt-coherency:
> 
>           * shard-glk: FAIL (i915#2328) -> PASS

Change was related to fix above coherency issue. 

--
Zbigniew


>      * igt@gem_userptr_blits@sync-unmap-cycles:
> 
>           * shard-skl: TIMEOUT (i915#1958 / i915#2424) -> PASS
>      * igt@i915_selftest@mock@contexts:
> 
>           * shard-apl: INCOMPLETE (i915#1635 / i915#2278) -> PASS
>      * igt@kms_cursor_legacy@2x-cursor-vs-flip-atomic:
> 
>           * shard-hsw: INCOMPLETE (CI#80) -> PASS
>      * igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
> 
>           * shard-glk: FAIL (i915#72) -> PASS
>      * igt@kms_flip@2x-dpms-vs-vblank-race@ab-vga1-hdmi-a1:
> 
>           * shard-hsw: DMESG-WARN (i915#1982) -> PASS
>      * igt@kms_flip@2x-flip-vs-suspend-interruptible@bc-vga1-hdmi-a1:
> 
>           * shard-hsw: INCOMPLETE (i915#2055) -> PASS
>      * igt@kms_flip@flip-vs-suspend@c-dp1:
> 
>           * shard-kbl: DMESG-WARN (i915#180) -> PASS +3 similar issues
>      * igt@kms_flip@plain-flip-ts-check-interruptible@c-edp1:
> 
>           * shard-skl: FAIL (i915#2122) -> PASS +1 similar issue
>      * igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
> 
>           * shard-iclb: DMESG-WARN (i915#1982) -> PASS
>      * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-fullscreen:
> 
>           * shard-tglb: DMESG-WARN (i915#1982) -> PASS
>      * igt@kms_hdr@bpc-switch-dpms:
> 
>           * shard-skl: FAIL (i915#1188) -> PASS
>      * igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
> 
>           * shard-skl: DMESG-WARN (i915#1982) -> PASS +5 similar issues
>      * igt@kms_psr@psr2_sprite_mmap_gtt:
> 
>           * shard-iclb: SKIP (fdo#109441) -> PASS +1 similar issue
>      * igt@kms_setmode@basic:
> 
>           * shard-skl: FAIL (i915#31) -> PASS
> 
>           * shard-hsw: FAIL (i915#31) -> PASS
> 
>      * igt@kms_vblank@pipe-b-query-busy:
> 
>           * shard-apl: DMESG-WARN (i915#1635 / i915#1982) -> PASS +2 similar
>             issues
> 
>     Warnings
> 
>      * igt@kms_flip@flip-vs-suspend@a-edp1:
>           * shard-skl: INCOMPLETE (i915#198 / i915#1982) -> DMESG-WARN
>             (i915#1982)
> 
> Participating hosts (11 -> 11)
> 
>    No changes in participating hosts
> 
> Build changes
> 
>      * Linux: CI_DRM_9025 -> Patchwork_18538
> 
>    CI-20190529: 20190529
>    CI_DRM_9025: 955d04e2ed0cf4bb4679f594a852cc2eebe8266b @
>    git://anongit.freedesktop.org/gfx-ci/linux
>    IGT_5787: 0ec962017c8131de14e0cb038f7f76b1f17ed637 @
>    git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
>    Patchwork_18538: 3d2651f10f098ace6866668664fb8e5a145eadd1 @
>    git://anongit.freedesktop.org/gfx-ci/linux
>    piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @
>    git://anongit.freedesktop.org/piglit
Chris Wilson Sept. 21, 2020, 8:54 a.m. UTC | #2
Quoting Zbigniew Kempczyński (2020-09-21 04:50:17)
> On !llc platforms when buffer is mapped with WB using GEM_MMAP_OFFSET
> pagefault handler clears its dirty flag. This has consequences
> buffer is not flushed on exec before moving to render domain.
> So make sure we keep dirty flag for buffers mapped to write until
> it leaves cpu domain.

So the faulthandler is only tangentially associated with cache domains.
In that a fresh fault is likely to indicate utilisation of the cpu
domain, but it is not definitive; there may either be no fault between
domain changes or the fault does not incur any.

So we do not touch the domain during the fault, that is required to be
tracked by set-domain around the access. This ensures the fault has no
implicit domain changes, waits or locks.

In particular, the path of interest here is relatively new, using the
old mmap ioctl, we do not see the fault at all.

The bug you are looking for is in set_domain_ioctl.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index 3d69e51f3e4d..3f61a5ccbdd5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -239,6 +239,7 @@  static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 	struct i915_mmap_offset *mmo = area->vm_private_data;
 	struct drm_i915_gem_object *obj = mmo->obj;
 	resource_size_t iomap;
+	u16 prev_write_domain;
 	int err;
 
 	/* Sanity check that we allow writing into this object */
@@ -246,6 +247,8 @@  static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 		     area->vm_flags & VM_WRITE))
 		return VM_FAULT_SIGBUS;
 
+	prev_write_domain = obj->write_domain;
+
 	err = i915_gem_object_pin_pages(obj);
 	if (err)
 		goto out;
@@ -268,6 +271,10 @@  static vm_fault_t vm_fault_cpu(struct vm_fault *vmf)
 
 	i915_gem_object_unpin_pages(obj);
 
+	/* On !llc we need to flush before moving to render domain */
+	if (!obj->cache_coherent && prev_write_domain == I915_GEM_DOMAIN_CPU)
+		obj->cache_dirty = true;
+
 out:
 	return i915_error_to_vmf_fault(err);
 }