Skip to contentSkip to conversation

drm/i915: Skip CPU synchronisation on dmabuf attachments

PATCH In review Chris Wilson 3 participants 6 messages Nov 30, 2017 – Feb 10, 2020

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

PATCH 1/1 drm/i915: Skip CPU synchronisation on dmabuf attachments

dma-bufs are device coherent, with explicit CPU synchronisation provided via the begin/end cpu access ioctls. As the coherency of the dma-buf is explicitly defined to be under user control, flushing any caches on attach/detach of the dma-buf is additional work that doesn't aide the user in the slightest.

---
 drivers/gpu/drm/i915/i915_gem_dmabuf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_dmabuf.c +6 -2
index 864439a214c8..68c8bfd8eb7a 100644
@@ -67,7 +67,9 @@ static struct sg_table *i915_gem_map_dma_buf(struct dma_buf_attachment *attachme
 		src = sg_next(src);
 	}
 
-	if (!dma_map_sg(attachment->dev, st->sgl, st->nents, dir)) {
+	if (!dma_map_sg_attrs(attachment->dev,
+			      st->sgl, st->nents, dir,
+			      DMA_ATTR_SKIP_CPU_SYNC)) {
 		ret = -ENOMEM;
 		goto err_free_sg;
 	}
@@ -90,7 +92,9 @@ static void i915_gem_unmap_dma_buf(struct dma_buf_attachment *attachment,
 {
 	struct drm_i915_gem_object *obj = dma_buf_to_obj(attachment->dmabuf);
 
-	dma_unmap_sg(attachment->dev, sg->sgl, sg->nents, dir);
+	dma_unmap_sg_attrs(attachment->dev,
+			   sg->sgl, sg->nents, dir,
+			   DMA_ATTR_SKIP_CPU_SYNC);
 	sg_free_table(sg);
 	kfree(sg);
 
Signature · 6 lines
2.15.1

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

✓ Fi.CI.BAT: success for drm/i915: Skip CPU synchronisation on dmabuf attachments

== Series Details ==

== Series Details ==

Series: drm/i915: Skip CPU synchronisation on dmabuf attachments
URL : https://patchwork.freedesktop.org/series/34702/
State : success

== Summary ==

Series 34702v1 drm/i915: Skip CPU synchronisation on dmabuf attachments
https://patchwork.freedesktop.org/api/1.0/series/34702/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                dmesg-warn -> DMESG-FAIL (fi-elk-e7500) fdo#103989
Test gem_exec_reloc:
        Subgroup basic-cpu-active:
                dmesg-fail -> PASS       (fi-gdg-551) fdo#102582 +1
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:439s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:443s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:381s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:514s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:506s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:504s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:486s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:475s
fi-elk-e7500     total:224  pass:162  dwarn:15  dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:1   dfail:0   fail:0   skip:108 time:270s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:539s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:374s
fi-hsw-4770r     total:288  pass:224  dwarn:0   dfail:0   fail:0   skip:64  time:260s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:393s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-ivb-3770      total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:447s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:485s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:532s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:534s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:589s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:449s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:535s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:565s
fi-skl-6700k     total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:523s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:495s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:450s
fi-snb-2520m     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:550s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:419s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:607s
fi-cnl-y         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:545s
fi-glk-dsi       total:288  pass:257  dwarn:0   dfail:0   fail:1   skip:30  time:484s

07df63d96015816fbf6dd44e634474587931a294 drm-tip: 2017y-11m-30d-17h-26m-53s UTC integration manifest be6a7ad5bd19 drm/i915: Skip CPU synchronisation on dmabuf attachments

== Logs ==

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

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: Skip CPU synchronisation on dmabuf attachments

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Skip CPU synchronisation on dmabuf attachments
URL : https://patchwork.freedesktop.org/series/34702/
State : success

== Summary ==

Test kms_frontbuffer_tracking:

        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                pass       -> FAIL       (shard-snb) fdo#101623 +1
Test drv_selftest:
        Subgroup mock_sanitycheck:
                dmesg-warn -> PASS       (shard-snb) fdo#102707 +1
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb)
Test kms_cursor_crc:
        Subgroup cursor-256x256-suspend:
                dmesg-warn -> PASS       (shard-snb) fdo#102365

fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365

shard-hsw        total:2650 pass:1525 dwarn:2   dfail:0   fail:9   skip:1113 time:9214s
shard-snb        total:2663 pass:1307 dwarn:2   dfail:0   fail:12  skip:1342 time:8111s
Blacklisted hosts:
shard-apl        total:2641 pass:1668 dwarn:1   dfail:0   fail:22  skip:949 time:13431s
shard-kbl        total:2663 pass:1792 dwarn:12  dfail:0   fail:27  skip:832 time:10865s

== Logs ==

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

Acked-by on v1 1/1
#3 lore raw
In reply to Chris Wilson

It makes lots of sense to make CPU cache operation done only when needed. Similar change was already landed in drm-prime and other vendor specific drivers. We are actually seeing huge performance boost in a specific customer case where dmabuf was used between camera driver (importer) and i915 after applying this patch.

Please consider upstreaming this code change.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

The patch is here:
https://lists.freedesktop.org/archives/intel-gfx/2017-November/148988.html

Quoted 9 lines · Dongwon Kim

It makes lots of sense to make CPU cache operation done only when needed. Similar change was already landed in drm-prime and other vendor specific drivers. We are actually seeing huge performance boost in a specific customer case where dmabuf was used between camera driver (importer) and i915 after applying this patch.

Please consider upstreaming this code change.

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

Acked-by on v1 1/1
#5 lore raw
In reply to Chris Wilson

(mistakenly put a wrong message id in "In-reply-To")

It makes lots of sense to make CPU cache operation done only when needed. Similar change was already landed in drm-prime and other vendor specific drivers. We are actually seeing huge performance boost in a specific customer case where dmabuf was used between camera driver (importer) and i915 after applying this patch.

Please consider upstreaming this code change.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx