* [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex @ 2017-03-17 19:46 Chris Wilson 2017-03-17 19:46 ` [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly Chris Wilson ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Chris Wilson @ 2017-03-17 19:46 UTC (permalink / raw) To: intel-gfx Both object creation and backing storage page allocation do not require struct_mutex, so do not require the caller to take it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_gem.c | 4 +--- drivers/gpu/drm/i915/intel_uc.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index fd611b4c1a2c..3492f8d27c32 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4961,9 +4961,7 @@ i915_gem_object_create_from_data(struct drm_i915_private *dev_priv, if (IS_ERR(obj)) return obj; - ret = i915_gem_object_set_to_cpu_domain(obj, true); - if (ret) - goto fail; + GEM_BUG_ON(obj->base.write_domain != I915_GEM_DOMAIN_CPU); ret = i915_gem_object_pin_pages(obj); if (ret) diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index 21f6d822194d..86530c92337a 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -376,9 +376,7 @@ void intel_uc_prepare_fw(struct drm_i915_private *dev_priv, uc_fw->major_ver_found, uc_fw->minor_ver_found, uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted); - mutex_lock(&dev_priv->drm.struct_mutex); obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size); - mutex_unlock(&dev_priv->drm.struct_mutex); if (IS_ERR_OR_NULL(obj)) { err = obj ? PTR_ERR(obj) : -ENOMEM; goto fail; -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly 2017-03-17 19:46 [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Chris Wilson @ 2017-03-17 19:46 ` Chris Wilson 2017-03-17 22:41 ` Matthew Auld 2017-03-17 20:03 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Patchwork 2017-03-17 22:28 ` [PATCH 1/2] " Matthew Auld 2 siblings, 1 reply; 6+ messages in thread From: Chris Wilson @ 2017-03-17 19:46 UTC (permalink / raw) To: intel-gfx Use pagecache_write to avoid shmemfs clearing the pages prior to us immediately overwriting them with our data. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> --- drivers/gpu/drm/i915/i915_gem.c | 45 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 3492f8d27c32..58e1db77d70e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4953,9 +4953,9 @@ i915_gem_object_create_from_data(struct drm_i915_private *dev_priv, const void *data, size_t size) { struct drm_i915_gem_object *obj; - struct sg_table *sg; - size_t bytes; - int ret; + struct file *file; + size_t offset; + int err; obj = i915_gem_object_create(dev_priv, round_up(size, PAGE_SIZE)); if (IS_ERR(obj)) @@ -4963,26 +4963,39 @@ i915_gem_object_create_from_data(struct drm_i915_private *dev_priv, GEM_BUG_ON(obj->base.write_domain != I915_GEM_DOMAIN_CPU); - ret = i915_gem_object_pin_pages(obj); - if (ret) - goto fail; + file = obj->base.filp; + offset = 0; + do { + unsigned int len = min_t(typeof(size), size, PAGE_SIZE); + struct page *page; + void *pgdata, *vaddr; - sg = obj->mm.pages; - bytes = sg_copy_from_buffer(sg->sgl, sg->nents, (void *)data, size); - obj->mm.dirty = true; /* Backing store is now out of date */ - i915_gem_object_unpin_pages(obj); + err = pagecache_write_begin(file, file->f_mapping, + offset, len, 0, + &page, &pgdata); + if (err < 0) + goto fail; - if (WARN_ON(bytes != size)) { - DRM_ERROR("Incomplete copy, wrote %zu of %zu", bytes, size); - ret = -EFAULT; - goto fail; - } + vaddr = kmap(page); + memcpy(vaddr, data, len); + kunmap(page); + + err = pagecache_write_end(file, file->f_mapping, + offset, len, len, + page, pgdata); + if (err < 0) + goto fail; + + size -= len; + data += len; + offset += len; + } while (size); return obj; fail: i915_gem_object_put(obj); - return ERR_PTR(ret); + return ERR_PTR(err); } struct scatterlist * -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly 2017-03-17 19:46 ` [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly Chris Wilson @ 2017-03-17 22:41 ` Matthew Auld 2017-03-17 23:26 ` Chris Wilson 0 siblings, 1 reply; 6+ messages in thread From: Matthew Auld @ 2017-03-17 22:41 UTC (permalink / raw) To: Chris Wilson; +Cc: Intel Graphics Development On 17 March 2017 at 19:46, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Use pagecache_write to avoid shmemfs clearing the pages prior to us > immediately overwriting them with our data. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Interesting... Reviewed-by: Matthew Auld <matthew.auld@intel.com> _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly 2017-03-17 22:41 ` Matthew Auld @ 2017-03-17 23:26 ` Chris Wilson 0 siblings, 0 replies; 6+ messages in thread From: Chris Wilson @ 2017-03-17 23:26 UTC (permalink / raw) To: Matthew Auld; +Cc: Intel Graphics Development On Fri, Mar 17, 2017 at 10:41:42PM +0000, Matthew Auld wrote: > On 17 March 2017 at 19:46, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > Use pagecache_write to avoid shmemfs clearing the pages prior to us > > immediately overwriting them with our data. > > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Interesting... > Reviewed-by: Matthew Auld <matthew.auld@intel.com> Double checked I didn't break the guc, and pushed. Thanks, -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex 2017-03-17 19:46 [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Chris Wilson 2017-03-17 19:46 ` [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly Chris Wilson @ 2017-03-17 20:03 ` Patchwork 2017-03-17 22:28 ` [PATCH 1/2] " Matthew Auld 2 siblings, 0 replies; 6+ messages in thread From: Patchwork @ 2017-03-17 20:03 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx == Series Details == Series: series starting with [1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex URL : https://patchwork.freedesktop.org/series/21470/ State : success == Summary == Series 21470v1 Series without cover letter https://patchwork.freedesktop.org/api/1.0/series/21470/revisions/1/mbox/ Test kms_cursor_legacy: Subgroup basic-flip-before-cursor-varying-size: dmesg-warn -> PASS (fi-byt-n2820) fdo#100094 fdo#100094 https://bugs.freedesktop.org/show_bug.cgi?id=100094 fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time: 456s fi-bsw-n3050 total:278 pass:239 dwarn:0 dfail:0 fail:0 skip:39 time: 565s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time: 539s fi-bxt-t5700 total:278 pass:258 dwarn:0 dfail:0 fail:0 skip:20 time: 555s fi-byt-j1900 total:278 pass:251 dwarn:0 dfail:0 fail:0 skip:27 time: 501s fi-byt-n2820 total:278 pass:247 dwarn:0 dfail:0 fail:0 skip:31 time: 502s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 436s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time: 433s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time: 442s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 510s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 493s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time: 484s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 482s fi-skl-6700hq total:278 pass:261 dwarn:0 dfail:0 fail:0 skip:17 time: 601s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time: 486s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time: 520s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time: 548s fi-snb-2600 total:278 pass:249 dwarn:0 dfail:0 fail:0 skip:29 time: 431s ca3e896e9cf4e4c3319bbb51843daa45902927a7 drm-tip: 2017y-03m-17d-18h-26m-58s UTC integration manifest 9fb7f1a drm/i915: Initialise i915_gem_object_create_from_data() directly 1e1a1cf drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex == Logs == For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4220/ _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex 2017-03-17 19:46 [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Chris Wilson 2017-03-17 19:46 ` [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly Chris Wilson 2017-03-17 20:03 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Patchwork @ 2017-03-17 22:28 ` Matthew Auld 2 siblings, 0 replies; 6+ messages in thread From: Matthew Auld @ 2017-03-17 22:28 UTC (permalink / raw) To: Chris Wilson; +Cc: Intel Graphics Development On 17 March 2017 at 19:46, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Both object creation and backing storage page allocation do not require > struct_mutex, so do not require the caller to take it. > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-17 23:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-03-17 19:46 [PATCH 1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Chris Wilson 2017-03-17 19:46 ` [PATCH 2/2] drm/i915: Initialise i915_gem_object_create_from_data() directly Chris Wilson 2017-03-17 22:41 ` Matthew Auld 2017-03-17 23:26 ` Chris Wilson 2017-03-17 20:03 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: i915_gem_object_create_from_data() doesn't require struct_mutex Patchwork 2017-03-17 22:28 ` [PATCH 1/2] " Matthew Auld
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.