public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs
@ 2017-10-16 20:27 Chris Wilson
  2017-10-16 20:52 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-16 20:27 UTC (permalink / raw)
  To: intel-gfx

When pwriting into shmemfs, the fast path pagecache_write does not
notice when it is writing to beyond the end of the truncated shmemfs
inode. Report -EFAULT directly when we try to use pwrite into the
!I915_MADV_WILLNEED object.

Fixes: 7c55e2c5772d ("drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl")
Testcase: igt/gem_madvise/dontneed-before-pwrite
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ee2a30422020..d699ea3ab80b 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2730,6 +2730,9 @@ i915_gem_object_pwrite_gtt(struct drm_i915_gem_object *obj,
 	if (i915_gem_object_has_pages(obj))
 		return -ENODEV;
 
+	if (obj->mm.madv != I915_MADV_WILLNEED)
+		return -EFAULT;
+
 	/* Before the pages are instantiated the object is treated as being
 	 * in the CPU domain. The pages will be clflushed as required before
 	 * use, and we can freely write into the pages directly. If userspace
-- 
2.15.0.rc0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Report -EFAULT before pwrite fast path into shmemfs
  2017-10-16 20:27 [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs Chris Wilson
@ 2017-10-16 20:52 ` Patchwork
  2017-10-17  7:03 ` [PATCH] " Joonas Lahtinen
  2017-10-17 12:47 ` ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-16 20:52 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Report -EFAULT before pwrite fast path into shmemfs
URL   : https://patchwork.freedesktop.org/series/32066/
State : success

== Summary ==

Series 32066v1 drm/i915: Report -EFAULT before pwrite fast path into shmemfs
https://patchwork.freedesktop.org/api/1.0/series/32066/revisions/1/mbox/

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:453s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:371s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:523s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:263s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:497s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:504s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:497s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:490s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:422s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:249s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:573s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:425s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:437s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:480s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:457s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:487s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:572s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:478s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:586s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:543s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:642s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:497s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:459s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:560s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:420s

0673a9da7359e1575ac4581254110a0b4bc06c96 drm-tip: 2017y-10m-16d-20h-13m-40s UTC integration manifest
2c93efd59a72 drm/i915: Report -EFAULT before pwrite fast path into shmemfs

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6058/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs
  2017-10-16 20:27 [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs Chris Wilson
  2017-10-16 20:52 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-17  7:03 ` Joonas Lahtinen
  2017-10-17 13:08   ` Chris Wilson
  2017-10-17 12:47 ` ✓ Fi.CI.IGT: success for " Patchwork
  2 siblings, 1 reply; 5+ messages in thread
From: Joonas Lahtinen @ 2017-10-17  7:03 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Mon, 2017-10-16 at 21:27 +0100, Chris Wilson wrote:
> When pwriting into shmemfs, the fast path pagecache_write does not
> notice when it is writing to beyond the end of the truncated shmemfs
> inode. Report -EFAULT directly when we try to use pwrite into the
> !I915_MADV_WILLNEED object.
> 
> Fixes: 7c55e2c5772d ("drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl")
> Testcase: igt/gem_madvise/dontneed-before-pwrite
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915: Report -EFAULT before pwrite fast path into shmemfs
  2017-10-16 20:27 [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs Chris Wilson
  2017-10-16 20:52 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-10-17  7:03 ` [PATCH] " Joonas Lahtinen
@ 2017-10-17 12:47 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-17 12:47 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Report -EFAULT before pwrite fast path into shmemfs
URL   : https://patchwork.freedesktop.org/series/32066/
State : success

== Summary ==

Test perf:
        Subgroup oa-exponents:
                fail       -> PASS       (shard-hsw) fdo#102254
Test gem_sync:
        Subgroup basic-many-each:
                fail       -> PASS       (shard-hsw) fdo#100007
Test prime_self_import:
        Subgroup export-vs-gem_close-race:
                pass       -> FAIL       (shard-hsw) fdo#102655
Test gem_madvise:
        Subgroup dontneed-before-pwrite:
                fail       -> PASS       (shard-hsw) fdo#103310

fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#102655 https://bugs.freedesktop.org/show_bug.cgi?id=102655
fdo#103310 https://bugs.freedesktop.org/show_bug.cgi?id=103310

shard-hsw        total:2553 pass:1440 dwarn:0   dfail:0   fail:10  skip:1103 time:9333s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6058/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs
  2017-10-17  7:03 ` [PATCH] " Joonas Lahtinen
@ 2017-10-17 13:08   ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-17 13:08 UTC (permalink / raw)
  To: Joonas Lahtinen, intel-gfx

Quoting Joonas Lahtinen (2017-10-17 08:03:57)
> On Mon, 2017-10-16 at 21:27 +0100, Chris Wilson wrote:
> > When pwriting into shmemfs, the fast path pagecache_write does not
> > notice when it is writing to beyond the end of the truncated shmemfs
> > inode. Report -EFAULT directly when we try to use pwrite into the
> > !I915_MADV_WILLNEED object.
> > 
> > Fixes: 7c55e2c5772d ("drm/i915: Use pagecache write to prepopulate shmemfs from pwrite-ioctl")
> > Testcase: igt/gem_madvise/dontneed-before-pwrite
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.william.auld@gmail.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Ta, pushed.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-17 13:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 20:27 [PATCH] drm/i915: Report -EFAULT before pwrite fast path into shmemfs Chris Wilson
2017-10-16 20:52 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-17  7:03 ` [PATCH] " Joonas Lahtinen
2017-10-17 13:08   ` Chris Wilson
2017-10-17 12:47 ` ✓ Fi.CI.IGT: success for " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox