drm/i915/execbuf: Add support for parallel execbuf submission.
Subsystems (4)
cover drm/i915/execbuf: Add support for parallel execbuf submission.
Rework excecbuf slightly to take all locks earlier and stop dropping our lookups, which allows us to do a more effective try-loop.
We will also need to lock all gem bo's in advance, including the shadow bo for the command buffer submission. This is done before replacing struct_mutex by ww locking, for increased readability.
Chris Wilson (2):
drm/i915: Drop inspection of execbuf flags during evict drm/i915/gem: Extract transient execbuf flags from i915_vma
Maarten Lankhorst (5):
drm/i915: Add an implementation for i915_gem_ww_ctx locking, v2. drm/i915: Remove locking from i915_gem_object_prepare_read/write drm/i915: Separate lookup and pinning in execbuf. drm/i915: Parse command buffer earlier in eb_relocate(slow) drm/i915: Use per object locking instead of struct_mutex for execbuf
drivers/gpu/drm/i915/display/intel_display.c | 4 +- .../gpu/drm/i915/gem/i915_gem_client_blt.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 26 +- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 547 +++++++++--------- drivers/gpu/drm/i915/gem/i915_gem_object.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 39 +- .../gpu/drm/i915/gem/i915_gem_object_blt.c | 2 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 + drivers/gpu/drm/i915/gem/i915_gem_pm.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_tiling.c | 2 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 9 +- .../i915/gem/selftests/i915_gem_client_blt.c | 2 +- .../i915/gem/selftests/i915_gem_coherency.c | 24 +- .../drm/i915/gem/selftests/i915_gem_context.c | 16 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 4 +- .../i915/gem/selftests/i915_gem_object_blt.c | 4 +- .../drm/i915/gem/selftests/i915_gem_phys.c | 2 +- drivers/gpu/drm/i915/gt/intel_renderstate.c | 9 +- .../gpu/drm/i915/gt/selftest_workarounds.c | 2 +- drivers/gpu/drm/i915/gvt/cmd_parser.c | 11 +- drivers/gpu/drm/i915/i915_cmd_parser.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 6 - drivers/gpu/drm/i915/i915_gem.c | 62 +- drivers/gpu/drm/i915/i915_gem.h | 11 + drivers/gpu/drm/i915/i915_gem_evict.c | 15 +- drivers/gpu/drm/i915/i915_vma.h | 11 - drivers/gpu/drm/i915/selftests/i915_gem.c | 41 ++ drivers/gpu/drm/i915/selftests/i915_vma.c | 2 +- .../drm/i915/selftests/intel_memory_region.c | 4 +- 31 files changed, 505 insertions(+), 372 deletions(-)
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/7 drm/i915: Drop inspection of execbuf flags during evict
From: Chris Wilson <[email protected]>
With the goal of removing the serialisation from around execbuf, we will no longer have the privilege of there being a single execbuf in flight at any time and so will only be able to inspect the user's flags within the carefully controlled execbuf context. i915_gem_evict_for_node() is the only user outside of execbuf that currently peeks at the flag to convert an overlapping softpinned request from ENOSPC to EINVAL. Retract this nicety and only report ENOSPC if the location is in current use, either due to this execbuf or another.
--- drivers/gpu/drm/i915/i915_gem_evict.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_gem_evict.c +6 -9
@@ -292,7 +292,8 @@ int i915_gem_evict_for_node(struct i915_address_space *vm,GEM_BUG_ON (!drm_mm_node_allocated (node)); vma =container_of (node,typeof (*vma), node); -/* If we are using coloring to insert guard pages between +/* +* If we are using coloring to insert guard pages between * different cache domains within the address space, we have * to check whether the objects on either side of our range * abutt and conflict. If they are in conflict, then we evict
@@ -309,22 +310,18 @@ int i915_gem_evict_for_node(struct i915_address_space *vm, } } -if (flags &PIN_NONBLOCK && - (i915_vma_is_pinned (vma) ||i915_vma_is_active (vma))) { +if (i915_vma_is_pinned (vma)) { ret = -ENOSPC ;break ; } -/* Overlap of objects in the same batch? */ -if (i915_vma_is_pinned (vma)) { +if (flags &PIN_NONBLOCK &&i915_vma_is_active (vma)) { ret = -ENOSPC ; -if (vma->exec_flags && - *vma->exec_flags &EXEC_OBJECT_PINNED ) - ret = -EINVAL ;break ; } -/* Never show fear in the face of dragons! +/* +* Never show fear in the face of dragons! * * We cannot directly remove this node from within this * iterator and as with i915_gem_evict_something() we employ
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/7 drm/i915/gem: Extract transient execbuf flags from i915_vma
In reply to Maarten LankhorstFrom: Chris Wilson <[email protected]>
For our convenience, and to avoid frequent allocations, we placed some lists we use for execbuf inside the common i915_vma struct. As we look to parallelise execbuf, such fields guarded by the struct_mutex BKL must be pulled under local control. Instead of using the i915_vma as our primary means of tracking the user's list of objects and their virtual mappings, we use a local eb_vma with the same lists as before (just now local not global).
This should allow us to only perform the lookup of vma used for execution once during the execbuf ioctl, as currently we need to remove our secrets from inside i915_vma everytime we drop the struct_mutex as another execbuf may use the shared locations.
Once user visible consequence is that we can remove the requirement that the execobj[] be unique, and only require that they do not conflict (i.e. you cannot softpin the same object into two locations... hmm, we could allow that if truly required, but atm we only allow one vma per ppGTT per object.)
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 274 +++++++++--------- drivers/gpu/drm/i915/i915_vma.h | 11 - 2 files changed, 131 insertions(+), 154 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +131 -143
@@ -27,6 +27,19 @@#include "i915_gem_ioctls.h" #include "i915_trace.h" +struct eb_vma { +struct i915_vma *vma; +unsigned int flags; + +/** This vma's place in the execbuf reservation list */ +struct drm_i915_gem_exec_object2 *exec; +struct list_head bind_link; +struct list_head reloc_link; + +struct hlist_node node; +u32 handle; +}; +enum {FORCE_CPU_RELOC =1 ,FORCE_GTT_RELOC ,
@@ -219,15 +232,14 @@ struct i915_execbuffer {struct drm_file *file;/** per-file lookup tables and limits */ struct drm_i915_gem_execbuffer2 *args;/** ioctl parameters */ struct drm_i915_gem_exec_object2 *exec;/** ioctl execobj[] */ -struct i915_vma **vma; -unsigned int *flags; +struct eb_vma *vma;struct intel_engine_cs *engine;/** engine to queue the request to */ struct intel_context *context;/* logical state for the request */ struct i915_gem_context *gem_context;/** caller's context */ struct i915_request *request;/** our request to build */ -struct i915_vma *batch;/** identity of the batch obj/vma */ +struct eb_vma *batch;/** identity of the batch obj/vma */ /** actual size of execobj[] as we may extend it for the cmdparser */ unsigned int buffer_count;
@@ -274,8 +286,6 @@ struct i915_execbuffer {struct hlist_head *buckets;/** ht for relocation handles */ }; -#define exec_entry (EB ,VMA ) (&(EB)->exec[(VMA)->exec_flags - (EB)->flags]) -/* * Used to convert any address to canonical form. * Starting from gen8, some commands (e.g. STATE_BASE_ADDRESS,
@@ -381,9 +391,9 @@ eb_vma_misplaced(const struct drm_i915_gem_exec_object2 *entry,static inline bool eb_pin_vma (struct i915_execbuffer *eb,const struct drm_i915_gem_exec_object2 *entry, -struct i915_vma *vma) +struct eb_vma *ev) { -unsigned int exec_flags = *vma->exec_flags; +struct i915_vma *vma = ev->vma;u64 pin_flags;if (vma->node.size)
@@ -392,24 +402,24 @@ eb_pin_vma(struct i915_execbuffer *eb, pin_flags = entry->offset &PIN_OFFSET_MASK ; pin_flags |=PIN_USER |PIN_NOEVICT |PIN_OFFSET_FIXED ; -if (unlikely (exec_flags &EXEC_OBJECT_NEEDS_GTT )) +if (unlikely (ev->flags &EXEC_OBJECT_NEEDS_GTT )) pin_flags |=PIN_GLOBAL ;if (unlikely (i915_vma_pin (vma,0 ,0 , pin_flags)))return false; -if (unlikely (exec_flags &EXEC_OBJECT_NEEDS_FENCE )) { +if (unlikely (ev->flags &EXEC_OBJECT_NEEDS_FENCE )) {if (unlikely (i915_vma_pin_fence (vma))) {i915_vma_unpin (vma);return false; }if (vma->fence) - exec_flags |= __EXEC_OBJECT_HAS_FENCE; + ev->flags |= __EXEC_OBJECT_HAS_FENCE; } - *vma->exec_flags = exec_flags | __EXEC_OBJECT_HAS_PIN; -return !eb_vma_misplaced (entry, vma, exec_flags); + ev->flags |= __EXEC_OBJECT_HAS_PIN; +return !eb_vma_misplaced (entry, vma, ev->flags); }static inline void __eb_unreserve_vma (struct i915_vma *vma,unsigned int flags)
@@ -423,13 +433,13 @@ static inline void __eb_unreserve_vma(struct i915_vma *vma, unsigned int flags) }static inline void -eb_unreserve_vma (struct i915_vma *vma,unsigned int *flags) +eb_unreserve_vma (struct eb_vma *ev) { -if (!(*flags & __EXEC_OBJECT_HAS_PIN)) +if (!(ev->flags & __EXEC_OBJECT_HAS_PIN))return ; -__eb_unreserve_vma (vma, *flags); - *flags &= ~__EXEC_OBJECT_RESERVED; +__eb_unreserve_vma (ev->vma, ev->flags); + ev->flags &= ~__EXEC_OBJECT_RESERVED; } static int
@@ -459,12 +469,6 @@ eb_validate_vma(struct i915_execbuffer *eb, entry->pad_to_size =0 ; } -if (unlikely (vma->exec_flags)) { -DRM_DEBUG ("Object [handle %d, index %d] appears more than once in object list\n" , - entry->handle, (int )(entry - eb->exec)); -return -EINVAL ; - } -/* * From drm_mm perspective address space is continuous, * so from this point we're always using non-canonical
@@ -493,6 +497,7 @@ eb_add_vma(struct i915_execbuffer *eb, struct i915_vma *vma) {struct drm_i915_gem_exec_object2 *entry = &eb->exec[i]; +struct eb_vma *ev = &eb->vma[i];int err;GEM_BUG_ON (i915_vma_is_closed (vma));
@@ -503,25 +508,19 @@ eb_add_vma(struct i915_execbuffer *eb,return err; } + ev->vma = vma; + ev->exec = entry; + ev->flags = entry->flags; +if (eb->lut_size >0 ) { - vma->exec_handle = entry->handle; -hlist_add_head (&vma->exec_node, + ev->handle = entry->handle; +hlist_add_head (&ev->node, &eb->buckets[hash_32 (entry->handle, eb->lut_size)]); }if (entry->relocation_count) -list_add_tail (&vma->reloc_link, &eb->relocs); - -/* -* Stash a pointer from the vma to execobj, so we can query its flags, -* size, alignment etc as provided by the user. Also we stash a pointer -* to the vma inside the execobj so that we can use a direct lookup -* to find the right target VMA when doing relocations. -*/ - eb->vma[i] = vma; - eb->flags[i] = entry->flags; - vma->exec_flags = &eb->flags[i]; +list_add_tail (&ev->reloc_link, &eb->relocs);/* * SNA is doing fancy tricks with compressing batch buffers, which leads
@@ -534,28 +533,26 @@ eb_add_vma(struct i915_execbuffer *eb,*/ if (i == batch_idx) {if (entry->relocation_count && - !(eb->flags[i] &EXEC_OBJECT_PINNED )) - eb->flags[i] |= __EXEC_OBJECT_NEEDS_BIAS; + !(ev->flags &EXEC_OBJECT_PINNED )) + ev->flags |= __EXEC_OBJECT_NEEDS_BIAS;if (eb->reloc_cache.has_fence) - eb->flags[i] |=EXEC_OBJECT_NEEDS_FENCE ; + ev->flags |=EXEC_OBJECT_NEEDS_FENCE ; - eb->batch = vma; + eb->batch = ev; } err =0 ; -if (eb_pin_vma (eb, entry, vma)) { +if (eb_pin_vma (eb, entry, ev)) {if (entry->offset != vma->node.start) { entry->offset = vma->node.start |UPDATE ; eb->args->flags |= __EXEC_HAS_RELOC; } }else { -eb_unreserve_vma (vma, vma->exec_flags); +eb_unreserve_vma (ev); -list_add_tail (&vma->exec_link, &eb->unbound); +list_add_tail (&ev->bind_link, &eb->unbound);if (drm_mm_node_allocated (&vma->node)) err =i915_vma_unbind (vma); -if (unlikely (err)) - vma->exec_flags =NULL ; }return err; }
@@ -577,11 +574,11 @@ static inline int use_cpu_reloc(const struct reloc_cache *cache, obj->cache_level != I915_CACHE_NONE); } -static int eb_reserve_vma (const struct i915_execbuffer *eb, -struct i915_vma *vma) +static int eb_reserve_vma (const struct i915_execbuffer *eb,struct eb_vma *ev) { -struct drm_i915_gem_exec_object2 *entry =exec_entry (eb, vma); -unsigned int exec_flags = *vma->exec_flags; +struct drm_i915_gem_exec_object2 *entry = ev->exec; +unsigned int exec_flags = ev->flags; +struct i915_vma *vma = ev->vma;u64 pin_flags;int err;
@@ -628,8 +625,8 @@ static int eb_reserve_vma(const struct i915_execbuffer *eb, exec_flags |= __EXEC_OBJECT_HAS_FENCE; } - *vma->exec_flags = exec_flags | __EXEC_OBJECT_HAS_PIN; -GEM_BUG_ON (eb_vma_misplaced (entry, vma, exec_flags)); + ev->flags = exec_flags | __EXEC_OBJECT_HAS_PIN; +GEM_BUG_ON (eb_vma_misplaced (entry, vma, ev->flags));return 0 ; }
@@ -638,7 +635,7 @@ static int eb_reserve(struct i915_execbuffer *eb) {const unsigned int count = eb->buffer_count;struct list_head last; -struct i915_vma *vma; +struct eb_vma *ev;unsigned int i, pass;int err;
@@ -659,8 +656,8 @@ static int eb_reserve(struct i915_execbuffer *eb) pass =0 ; err =0 ; do { - list_for_each_entry(vma, &eb->unbound, exec_link) { - err = eb_reserve_vma(eb, vma); + list_for_each_entry(ev, &eb->unbound, bind_link) { + err = eb_reserve_vma(eb, ev); if (err) break; }
@@ -671,26 +668,26 @@ static int eb_reserve(struct i915_execbuffer *eb)INIT_LIST_HEAD (&eb->unbound);INIT_LIST_HEAD (&last);for (i =0 ; i < count; i++) { -unsigned int flags = eb->flags[i]; -struct i915_vma *vma = eb->vma[i]; +struct eb_vma *ev = &eb->vma[i]; +unsigned int flags = ev->flags;if (flags &EXEC_OBJECT_PINNED && flags & __EXEC_OBJECT_HAS_PIN)continue ; -eb_unreserve_vma (vma, &eb->flags[i]); +eb_unreserve_vma (ev);if (flags &EXEC_OBJECT_PINNED )/* Pinned must have their slot */ -list_add (&vma->exec_link, &eb->unbound); +list_add (&ev->bind_link, &eb->unbound);else if (flags & __EXEC_OBJECT_NEEDS_MAP)/* Map require the lowest 256MiB (aperture) */ -list_add_tail (&vma->exec_link, &eb->unbound); +list_add_tail (&ev->bind_link, &eb->unbound);else if (!(flags &EXEC_OBJECT_SUPPORTS_48B_ADDRESS ))/* Prioritise 4GiB region for restricted bo */ -list_add (&vma->exec_link, &last); +list_add (&ev->bind_link, &last);else -list_add_tail (&vma->exec_link, &last); +list_add_tail (&ev->bind_link, &last); }list_splice_tail (&last, &eb->unbound);
@@ -809,10 +806,8 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)if (unlikely (err)) goto err_vma; -GEM_BUG_ON (vma != eb->vma[i]); -GEM_BUG_ON (vma->exec_flags != &eb->flags[i]);GEM_BUG_ON (drm_mm_node_allocated (&vma->node) && -eb_vma_misplaced (&eb->exec[i], vma, eb->flags[i])); +eb_vma_misplaced (&eb->exec[i], vma, eb->vma[i].flags)); }mutex_unlock (&eb->gem_context->mutex);
@@ -823,27 +818,27 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb) err_obj:i915_gem_object_put (obj); err_vma: - eb->vma[i] =NULL ; + eb->vma[i].vma =NULL ; err_ctx:mutex_unlock (&eb->gem_context->mutex);return err; } -static struct i915_vma * +static struct eb_vma *eb_get_vma (const struct i915_execbuffer *eb,unsigned long handle) {if (eb->lut_size <0 ) {if (handle >= -eb->lut_size)return NULL ; -return eb->vma[handle]; +return &eb->vma[handle]; }else {struct hlist_head *head; -struct i915_vma *vma; +struct eb_vma *ev; head = &eb->buckets[hash_32 (handle, eb->lut_size)]; -hlist_for_each_entry (vma, head, exec_node) { -if (vma->exec_handle == handle) -return vma; +hlist_for_each_entry (ev, head, node) { +if (ev->handle == handle) +return ev; }return NULL ; }
@@ -855,20 +850,18 @@ static void eb_release_vmas(const struct i915_execbuffer *eb)unsigned int i;for (i =0 ; i < count; i++) { -struct i915_vma *vma = eb->vma[i]; -unsigned int flags = eb->flags[i]; +struct eb_vma *ev = &eb->vma[i]; +struct i915_vma *vma = ev->vma;if (!vma)break ; -GEM_BUG_ON (vma->exec_flags != &eb->flags[i]); - vma->exec_flags =NULL ; - eb->vma[i] =NULL ; + eb->vma[i].vma =NULL ; -if (flags & __EXEC_OBJECT_HAS_PIN) -__eb_unreserve_vma (vma, flags); +if (ev->flags & __EXEC_OBJECT_HAS_PIN) +__eb_unreserve_vma (vma, ev->flags); -if (flags & __EXEC_OBJECT_HAS_REF) +if (ev->flags & __EXEC_OBJECT_HAS_REF)i915_vma_put (vma); } }
@@ -1351,10 +1344,10 @@ relocate_entry(struct i915_vma *vma,static u64 eb_relocate_entry (struct i915_execbuffer *eb, -struct i915_vma *vma, +struct eb_vma *ev,const struct drm_i915_gem_relocation_entry *reloc) { -struct i915_vma *target; +struct eb_vma *target;int err;/* we've already hold a reference to all valid objects */
@@ -1386,7 +1379,7 @@ eb_relocate_entry(struct i915_execbuffer *eb, }if (reloc->write_domain) { - *target->exec_flags |=EXEC_OBJECT_WRITE ; + target->flags |=EXEC_OBJECT_WRITE ;/* * Sandybridge PPGTT errata: We need a global gtt mapping
@@ -1396,7 +1389,8 @@ eb_relocate_entry(struct i915_execbuffer *eb,*/ if (reloc->write_domain ==I915_GEM_DOMAIN_INSTRUCTION &&IS_GEN (eb->i915,6 )) { - err =i915_vma_bind (target, target->obj->cache_level, + err =i915_vma_bind (target->vma, + target->vma->obj->cache_level,PIN_GLOBAL ,NULL );if (WARN_ONCE (err,"Unexpected failure to bind target VMA!" ))
@@ -1409,17 +1403,17 @@ eb_relocate_entry(struct i915_execbuffer *eb,* more work needs to be done. */ if (!DBG_FORCE_RELOC && -gen8_canonical_addr (target->node.start) == reloc->presumed_offset) +gen8_canonical_addr (target->vma->node.start) == reloc->presumed_offset)return 0 ;/* Check that the relocation address is valid... */ if (unlikely (reloc->offset > - vma->size - (eb->reloc_cache.use_64bit_reloc ?8 :4 ))) { + ev->vma->size - (eb->reloc_cache.use_64bit_reloc ?8 :4 ))) {DRM_DEBUG ("Relocation beyond object bounds: " "target %d offset %d size %d.\n" , reloc->target_handle, (int )reloc->offset, - (int )vma->size); + (int )ev->vma->size);return -EINVAL ; }if (unlikely (reloc->offset &3 )) {
@@ -1438,18 +1432,18 @@ eb_relocate_entry(struct i915_execbuffer *eb,* do relocations we are already stalling, disable the user's opt * out of our synchronisation. */ - *vma->exec_flags &= ~EXEC_OBJECT_ASYNC ; + ev->flags &= ~EXEC_OBJECT_ASYNC ;/* and update the user's relocation entry */ -return relocate_entry (vma, reloc, eb, target); +return relocate_entry (ev->vma, reloc, eb, target->vma); } -static int eb_relocate_vma (struct i915_execbuffer *eb,struct i915_vma *vma) +static int eb_relocate_vma (struct i915_execbuffer *eb,struct eb_vma *ev) {#define N_RELOC (x) ((x) / sizeof(struct drm_i915_gem_relocation_entry))struct drm_i915_gem_relocation_entry stack[N_RELOC (512 )];struct drm_i915_gem_relocation_entry __user *urelocs; -const struct drm_i915_gem_exec_object2 *entry =exec_entry (eb, vma); +const struct drm_i915_gem_exec_object2 *entry = ev->exec;unsigned int remain; urelocs =u64_to_user_ptr (entry->relocs_ptr);
@@ -1489,7 +1483,7 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct i915_vma *vma) remain -= count; do { - u64 offset = eb_relocate_entry(eb, vma, r); + u64 offset = eb_relocate_entry(eb, ev, r); if (likely(offset == 0)) { } else if ((s64)offset < 0) {
@@ -1532,16 +1526,16 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct i915_vma *vma) }static int -eb_relocate_vma_slow (struct i915_execbuffer *eb,struct i915_vma *vma) +eb_relocate_vma_slow (struct i915_execbuffer *eb,struct eb_vma *ev) { -const struct drm_i915_gem_exec_object2 *entry =exec_entry (eb, vma); +const struct drm_i915_gem_exec_object2 *entry = ev->exec;struct drm_i915_gem_relocation_entry *relocs =u64_to_ptr (typeof (*relocs), entry->relocs_ptr);unsigned int i;int err;for (i =0 ; i < entry->relocation_count; i++) { -u64 offset =eb_relocate_entry (eb, vma, &relocs[i]); +u64 offset =eb_relocate_entry (eb, ev, &relocs[i]);if ((s64 )offset <0 ) { err = (int )offset;
@@ -1685,7 +1679,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) {struct drm_device *dev = &eb->i915->drm;bool have_copy = false; -struct i915_vma *vma; +struct eb_vma *ev;int err =0 ; repeat:
@@ -1741,15 +1735,15 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)GEM_BUG_ON (!eb->batch); -list_for_each_entry (vma, &eb->relocs, reloc_link) { +list_for_each_entry (ev, &eb->relocs, reloc_link) {if (!have_copy) {pagefault_disable (); - err =eb_relocate_vma (eb, vma); + err =eb_relocate_vma (eb, ev);pagefault_enable ();if (err) goto repeat; }else { - err =eb_relocate_vma_slow (eb, vma); + err =eb_relocate_vma_slow (eb, ev);if (err) goto err; }
@@ -1794,10 +1788,10 @@ static int eb_relocate(struct i915_execbuffer *eb)/* The objects are in their final locations, apply the relocations. */ if (eb->args->flags & __EXEC_HAS_RELOC) { -struct i915_vma *vma; +struct eb_vma *ev; -list_for_each_entry (vma, &eb->relocs, reloc_link) { -if (eb_relocate_vma (eb, vma)) +list_for_each_entry (ev, &eb->relocs, reloc_link) { +if (eb_relocate_vma (eb, ev)) goto slow; } }
@@ -1818,39 +1812,34 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)ww_acquire_init (&acquire, &reservation_ww_class);for (i =0 ; i < count; i++) { -struct i915_vma *vma = eb->vma[i]; +struct eb_vma *ev = &eb->vma[i]; +struct i915_vma *vma = ev->vma; err =ww_mutex_lock_interruptible (&vma->resv->lock, &acquire); -if (!err) -continue ; - -GEM_BUG_ON (err == -EALREADY );/* No duplicate vma */ -if (err == -EDEADLK ) {GEM_BUG_ON (i ==0 );do {int j = i -1 ; -ww_mutex_unlock (&eb->vma[j]->resv->lock); +ww_mutex_unlock (&eb->vma[j].vma->resv->lock); -swap (eb->flags[i], eb->flags[j]);swap (eb->vma[i], eb->vma[j]); - eb->vma[i]->exec_flags = &eb->flags[i]; }while (--i); -GEM_BUG_ON (vma != eb->vma[0 ]); - vma->exec_flags = &eb->flags[0 ]; err =ww_mutex_lock_slow_interruptible (&vma->resv->lock, &acquire); } +if (err == -EALREADY ) + err =0 ;if (err)break ; }ww_acquire_done (&acquire);while (i--) { -unsigned int flags = eb->flags[i]; -struct i915_vma *vma = eb->vma[i]; +struct eb_vma *ev = &eb->vma[i]; +struct i915_vma *vma = ev->vma; +unsigned int flags = ev->flags;struct drm_i915_gem_object *obj = vma->obj;assert_vma_held (vma);
@@ -1894,10 +1883,10 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)i915_vma_unlock (vma);__eb_unreserve_vma (vma, flags); - vma->exec_flags =NULL ; -if (unlikely (flags & __EXEC_OBJECT_HAS_REF))i915_vma_put (vma); + + ev->vma =NULL ; }ww_acquire_fini (&acquire);
@@ -2017,13 +2006,13 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)if (IS_ERR (vma)) goto err; - batch_start =gen8_canonical_addr (eb->batch->node.start) + + batch_start =gen8_canonical_addr (eb->batch->vma->node.start) + eb->batch_start_offset; shadow_batch_start =gen8_canonical_addr (vma->node.start); err = intel_engine_cmd_parser(eb->engine, - eb->batch->obj, + eb->batch->vma->obj, batch_start, eb->batch_start_offset, eb->batch_len,
@@ -2047,14 +2036,12 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb) goto err; } - eb->vma[eb->buffer_count] =i915_vma_get (vma); - eb->flags[eb->buffer_count] = + eb->vma[eb->buffer_count].vma =i915_vma_get (vma); + eb->vma[eb->buffer_count].flags = __EXEC_OBJECT_HAS_PIN | __EXEC_OBJECT_HAS_REF; - vma->exec_flags = &eb->flags[eb->buffer_count]; - eb->buffer_count++; + eb->batch = &eb->vma[eb->buffer_count++]; eb->batch_start_offset =0 ; - eb->batch = vma;if (i915_vma_is_ggtt (vma)) eb->batch_flags |=I915_DISPATCH_SECURE ;
@@ -2081,7 +2068,7 @@ add_to_client(struct i915_request *rq, struct drm_file *file)spin_unlock (&file_priv->mm.lock); } -static int eb_submit (struct i915_execbuffer *eb) +static int eb_submit (struct i915_execbuffer *eb,struct i915_vma *batch) {int err;
@@ -2108,7 +2095,7 @@ static int eb_submit(struct i915_execbuffer *eb) } err = eb->engine->emit_bb_start (eb->request, - eb->batch->node.start + + batch->node.start + eb->batch_start_offset, eb->batch_len, eb->batch_flags);
@@ -2472,6 +2459,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,struct dma_fence *in_fence =NULL ;struct dma_fence *exec_fence =NULL ;struct sync_file *out_fence =NULL ; +struct i915_vma *batch;int out_fence_fd =-1 ;int err;
@@ -2486,9 +2474,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, args->flags |= __EXEC_HAS_RELOC; eb.exec = exec; - eb.vma = (struct i915_vma **)(exec + args->buffer_count +1 ); - eb.vma[0 ] =NULL ; - eb.flags = (unsigned int *)(eb.vma + args->buffer_count +1 ); + eb.vma = (struct eb_vma *)(exec + args->buffer_count +1 ); + eb.vma[0 ].vma =NULL ; eb.invalid_flags = __EXEC_OBJECT_UNKNOWN_FLAGS;reloc_cache_init (&eb.reloc_cache, eb.i915);
@@ -2572,20 +2559,23 @@ i915_gem_do_execbuffer(struct drm_device *dev, goto err_vma; } -if (unlikely (*eb.batch->exec_flags &EXEC_OBJECT_WRITE )) { +if (unlikely (eb.batch->flags &EXEC_OBJECT_WRITE )) {DRM_DEBUG ("Attempting to use self-modifying batch buffer\n" ); err = -EINVAL ; goto err_vma; } -if (eb.batch_start_offset > eb.batch->size || - eb.batch_len > eb.batch->size - eb.batch_start_offset) { + + batch = eb.batch->vma; +if (range_overflows_t (u64, + eb.batch_start_offset, eb.batch_len, + batch->size)) {DRM_DEBUG ("Attempting to use out-of-bounds batch\n" ); err = -EINVAL ; goto err_vma; }if (eb.batch_len ==0 ) - eb.batch_len = eb.batch->size - eb.batch_start_offset; + eb.batch_len = eb.batch->vma->size - eb.batch_start_offset;if (eb_use_cmdparser (&eb)) {struct i915_vma *vma;
@@ -2614,13 +2604,13 @@ i915_gem_do_execbuffer(struct drm_device *dev,* fitting due to fragmentation. * So this is actually safe. */ - vma =i915_gem_object_ggtt_pin (eb.batch->obj,NULL ,0 ,0 ,0 ); + vma =i915_gem_object_ggtt_pin (batch->obj,NULL ,0 ,0 ,0 );if (IS_ERR (vma)) { err =PTR_ERR (vma); goto err_vma; } - eb.batch = vma; + batch = vma; }/* All GPU relocation batches must be submitted prior to the user rq */
@@ -2667,12 +2657,12 @@ i915_gem_do_execbuffer(struct drm_device *dev,* inactive_list and lose its active reference. Hence we do not need * to explicitly hold another reference here. */ - eb.request->batch = eb.batch; -if (eb.batch->private) -intel_engine_pool_mark_active (eb.batch->private, eb.request); + eb.request->batch = batch; +if (batch->private) +intel_engine_pool_mark_active (batch->private, eb.request);trace_i915_request_queue (eb.request, eb.batch_flags); - err =eb_submit (&eb); + err =eb_submit (&eb, batch); err_request:add_to_client (eb.request, file);i915_request_add (eb.request);
@@ -2693,9 +2683,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_batch_unpin:if (eb.batch_flags &I915_DISPATCH_SECURE ) -i915_vma_unpin (eb.batch); -if (eb.batch->private) -intel_engine_pool_put (eb.batch->private); +i915_vma_unpin (batch); +if (batch->private) +intel_engine_pool_put (batch->private); err_vma:if (eb.exec)eb_release_vmas (&eb);
@@ -2718,9 +2708,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,static size_t eb_element_size (void ) { -return (sizeof (struct drm_i915_gem_exec_object2 ) + -sizeof (struct i915_vma *) + -sizeof (unsigned int )); +return sizeof (struct drm_i915_gem_exec_object2 ) +sizeof (struct eb_vma ); }static bool check_buffer_count (size_t count)
drivers/gpu/drm/i915/i915_vma.h +0 -11
@@ -150,21 +150,10 @@ struct i915_vma {struct rb_node obj_node;struct hlist_node obj_hash; -/** This vma's place in the execbuf reservation list */ -struct list_head exec_link; -struct list_head reloc_link; -/** This vma's place in the eviction list */ struct list_head evict_link;struct list_head closed_link; - -/** -* Used for performing relocations during execbuffer insertion. -*/ -unsigned int *exec_flags; -struct hlist_node exec_node; -u32 exec_handle; }; struct i915_vma *
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/7 drm/i915: Add an implementation for i915_gem_ww_ctx locking, v2.
In reply to Maarten Lankhorsti915_gem_ww_ctx is used to lock all gem bo's for pinning and memory eviction. We don't use it yet, but lets start adding the definition first.
To use it, we have to pass a non-NULL ww to gem_object_lock, and don't unlock directly. It is done in i915_gem_ww_ctx_fini.
Changes since v1:
- Change ww_ctx and obj order in locking functions (Jonas Lahtinen)
--- drivers/gpu/drm/i915/display/intel_display.c | 4 +- .../gpu/drm/i915/gem/i915_gem_client_blt.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 10 ++-- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 4 +- drivers/gpu/drm/i915/gem/i915_gem_object.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_object.h | 38 ++++++++++--- .../gpu/drm/i915/gem/i915_gem_object_blt.c | 2 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 ++++ drivers/gpu/drm/i915/gem/i915_gem_pm.c | 2 +- drivers/gpu/drm/i915/gem/i915_gem_tiling.c | 2 +- .../gpu/drm/i915/gem/selftests/huge_pages.c | 4 +- .../i915/gem/selftests/i915_gem_client_blt.c | 2 +- .../i915/gem/selftests/i915_gem_coherency.c | 10 ++-- .../drm/i915/gem/selftests/i915_gem_context.c | 4 +- .../drm/i915/gem/selftests/i915_gem_mman.c | 4 +- .../i915/gem/selftests/i915_gem_object_blt.c | 4 +- .../drm/i915/gem/selftests/i915_gem_phys.c | 2 +- .../gpu/drm/i915/gt/selftest_workarounds.c | 2 +- drivers/gpu/drm/i915/gvt/cmd_parser.c | 2 +- drivers/gpu/drm/i915/i915_gem.c | 54 +++++++++++++++++-- drivers/gpu/drm/i915/i915_gem.h | 11 ++++ drivers/gpu/drm/i915/selftests/i915_gem.c | 41 ++++++++++++++ drivers/gpu/drm/i915/selftests/i915_vma.c | 2 +- .../drm/i915/selftests/intel_memory_region.c | 4 +- 26 files changed, 179 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +2 -2
@@ -2206,7 +2206,7 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,void intel_unpin_fb_vma (struct i915_vma *vma,unsigned long flags) { -i915_gem_object_lock (vma->obj); +i915_gem_object_lock (vma->obj,NULL );if (flags &PLANE_HAS_FENCE )i915_vma_unpin_fence (vma);i915_gem_object_unpin_from_display_plane (vma);
@@ -16307,7 +16307,7 @@ static int intel_framebuffer_init(struct intel_framebuffer *intel_fb,if (!intel_fb->frontbuffer)return -ENOMEM ; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); tiling =i915_gem_object_get_tiling (obj); stride =i915_gem_object_get_stride (obj);i915_gem_object_unlock (obj);
drivers/gpu/drm/i915/gem/i915_gem_client_blt.c +1 -1
@@ -287,7 +287,7 @@ int i915_gem_schedule_fill_pages_blt(struct drm_i915_gem_object *obj,dma_fence_init (&work->dma, &clear_pages_work_ops, &fence_lock,0 ,0 );i915_sw_fence_init (&work->wait, clear_pages_work_notify); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err = i915_sw_fence_await_reservation(&work->wait, obj->base.resv, NULL, true, I915_FENCE_TIMEOUT,
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
@@ -114,7 +114,7 @@ static void lut_close(struct i915_gem_context *ctx)continue ;rcu_read_unlock (); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );list_for_each_entry (lut, &obj->lut_list, obj_link) {if (lut->ctx != ctx)continue ;
drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c +2 -2
@@ -124,7 +124,7 @@ static int i915_gem_begin_cpu_access(struct dma_buf *dma_buf, enum dma_data_direif (err)return err; - err =i915_gem_object_lock_interruptible (obj); + err =i915_gem_object_lock_interruptible (obj,NULL );if (err) goto out;
@@ -145,7 +145,7 @@ static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum dma_data_directif (err)return err; - err =i915_gem_object_lock_interruptible (obj); + err =i915_gem_object_lock_interruptible (obj,NULL );if (err) goto out;
drivers/gpu/drm/i915/gem/i915_gem_domain.c +5 -5
@@ -32,7 +32,7 @@ void i915_gem_object_flush_if_display(struct drm_i915_gem_object *obj)if (!i915_gem_object_is_framebuffer (obj))return ; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );__i915_gem_object_flush_for_display (obj);i915_gem_object_unlock (obj); }
@@ -190,7 +190,7 @@ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,if (obj->cache_level == cache_level)return 0 ; - ret =i915_gem_object_lock_interruptible (obj); + ret =i915_gem_object_lock_interruptible (obj,NULL );if (ret)return ret;
@@ -534,7 +534,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,if (err) goto out; - err =i915_gem_object_lock_interruptible (obj); + err =i915_gem_object_lock_interruptible (obj,NULL );if (err) goto out_unpin;
@@ -574,7 +574,7 @@ int i915_gem_object_prepare_read(struct drm_i915_gem_object *obj,if (!i915_gem_object_has_struct_page (obj))return -ENODEV ; - ret =i915_gem_object_lock_interruptible (obj); + ret =i915_gem_object_lock_interruptible (obj,NULL );if (ret)return ret;
@@ -628,7 +628,7 @@ int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj,if (!i915_gem_object_has_struct_page (obj))return -ENODEV ; - ret =i915_gem_object_lock_interruptible (obj); + ret =i915_gem_object_lock_interruptible (obj,NULL );if (ret)return ret;
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +2 -2
@@ -797,7 +797,7 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb) lut->handle = handle; lut->ctx = eb->gem_context; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );list_add (&lut->obj_link, &obj->lut_list);i915_gem_object_unlock (obj);
@@ -1030,7 +1030,7 @@ static void *reloc_iomap(struct drm_i915_gem_object *obj,if (use_cpu_reloc (cache, obj))return NULL ; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, true);i915_gem_object_unlock (obj);if (err)
drivers/gpu/drm/i915/gem/i915_gem_object.c +1 -1
@@ -104,7 +104,7 @@ void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file)struct i915_mmap_offset *mmo;LIST_HEAD (close); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );list_for_each_entry_safe (lut, ln, &obj->lut_list, obj_link) {struct i915_gem_context *ctx = lut->ctx;
drivers/gpu/drm/i915/gem/i915_gem_object.h +31 -7
@@ -103,20 +103,44 @@ i915_gem_object_put(struct drm_i915_gem_object *obj)#define assert_object_held (obj) dma_resv_assert_held((obj)->base.resv) -static inline void i915_gem_object_lock (struct drm_i915_gem_object *obj) +static inline int __i915_gem_object_lock (struct drm_i915_gem_object *obj, +struct i915_gem_ww_ctx *ww, +bool intr) { -dma_resv_lock (obj->base.resv,NULL ); +int ret; + +if (intr) + ret =dma_resv_lock_interruptible (obj->base.resv, ww ? &ww->ctx :NULL ); +else + ret =dma_resv_lock (obj->base.resv, ww ? &ww->ctx :NULL ); + +if (!ret && ww) +list_add_tail (&obj->obj_link, &ww->obj_list); +if (ret == -EALREADY ) + ret =0 ; + +if (ret == -EDEADLK ) + ww->contended = obj; + +return ret; } -static inline bool i915_gem_object_trylock (struct drm_i915_gem_object *obj) +static inline int i915_gem_object_lock (struct drm_i915_gem_object *obj, +struct i915_gem_ww_ctx *ww) { -return dma_resv_trylock (obj->base.resv); +return __i915_gem_object_lock (obj, ww, ww && ww->intr); } -static inline int -i915_gem_object_lock_interruptible (struct drm_i915_gem_object *obj) +static inline int i915_gem_object_lock_interruptible (struct drm_i915_gem_object *obj, +struct i915_gem_ww_ctx *ww) { -return dma_resv_lock_interruptible (obj->base.resv,NULL ); +WARN_ON (ww && !ww->intr); +return __i915_gem_object_lock (obj, ww, true); +} + +static inline bool i915_gem_object_trylock (struct drm_i915_gem_object *obj) +{ +return dma_resv_trylock (obj->base.resv); }static inline void i915_gem_object_unlock (struct drm_i915_gem_object *obj)
drivers/gpu/drm/i915/gem/i915_gem_object_blt.c +1 -1
@@ -142,7 +142,7 @@ int i915_gem_object_fill_blt(struct drm_i915_gem_object *obj,return err;if (obj->cache_dirty & ~obj->cache_coherent) { -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );i915_gem_clflush_object (obj,0 );i915_gem_object_unlock (obj); }
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +9 -0
@@ -122,6 +122,15 @@ struct drm_i915_gem_object {*/ struct list_head lut_list; +/** +* @obj_link: Link into @i915_gem_ww_ctx.obj_list +* +* When we lock this object through i915_gem_object_lock() with a +* context, we add it to the list to ensure we can unlock everything +* when i915_gem_ww_ctx_backoff() or i915_gem_ww_ctx_fini() are called. +*/ +struct list_head obj_link; +/** Stolen memory for this object, instead of being backed by shmem. */ struct drm_mm_node *stolen;union {
drivers/gpu/drm/i915/gem/i915_gem_pm.c +1 -1
@@ -84,7 +84,7 @@ void i915_gem_suspend_late(struct drm_i915_private *i915)spin_unlock_irqrestore (&i915->mm.obj_lock, flags); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );WARN_ON (i915_gem_object_set_to_gtt_domain (obj, false));i915_gem_object_unlock (obj);i915_gem_object_put (obj);
drivers/gpu/drm/i915/gem/i915_gem_tiling.c +1 -1
@@ -236,7 +236,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,* whilst executing a fenced command for an untiled object. */ -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL );if (i915_gem_object_is_framebuffer (obj)) {i915_gem_object_unlock (obj);return -EBUSY ;
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +2 -2
@@ -974,7 +974,7 @@ static int gpu_write(struct intel_context *ce, {int err; -i915_gem_object_lock (vma->obj); +i915_gem_object_lock (vma->obj,NULL ); err =i915_gem_object_set_to_gtt_domain (vma->obj, true);i915_gem_object_unlock (vma->obj);if (err)
@@ -1022,7 +1022,7 @@ static int __cpu_check_lmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)unsigned long n;int err; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_wc_domain (obj, false);i915_gem_object_unlock (obj);if (err)
drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c +1 -1
@@ -72,7 +72,7 @@ static int __igt_client_fill(struct intel_engine_cs *engine)if (err) goto err_unpin; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_cpu_domain (obj, false);i915_gem_object_unlock (obj);if (err)
drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c +5 -5
@@ -82,7 +82,7 @@ static int gtt_set(struct context *ctx, unsigned long offset, u32 v)u32 __iomem *map;int err =0 ; -i915_gem_object_lock (ctx->obj); +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_set_to_gtt_domain (ctx->obj, true);i915_gem_object_unlock (ctx->obj);if (err)
@@ -115,7 +115,7 @@ static int gtt_get(struct context *ctx, unsigned long offset, u32 *v)u32 __iomem *map;int err =0 ; -i915_gem_object_lock (ctx->obj); +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_set_to_gtt_domain (ctx->obj, false);i915_gem_object_unlock (ctx->obj);if (err)
@@ -147,7 +147,7 @@ static int wc_set(struct context *ctx, unsigned long offset, u32 v)u32 *map;int err; -i915_gem_object_lock (ctx->obj); +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_set_to_wc_domain (ctx->obj, true);i915_gem_object_unlock (ctx->obj);if (err)
@@ -168,7 +168,7 @@ static int wc_get(struct context *ctx, unsigned long offset, u32 *v)u32 *map;int err; -i915_gem_object_lock (ctx->obj); +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_set_to_wc_domain (ctx->obj, false);i915_gem_object_unlock (ctx->obj);if (err)
@@ -191,7 +191,7 @@ static int gpu_set(struct context *ctx, unsigned long offset, u32 v)u32 *cs;int err; -i915_gem_object_lock (ctx->obj); +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_set_to_gtt_domain (ctx->obj, true);i915_gem_object_unlock (ctx->obj);if (err)
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +2 -2
@@ -950,7 +950,7 @@ emit_rpcs_query(struct drm_i915_gem_object *obj,if (IS_ERR (vma))return PTR_ERR (vma); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, false);i915_gem_object_unlock (obj);if (err)
@@ -1658,7 +1658,7 @@ static int read_from_scratch(struct i915_gem_context *ctx,i915_request_add (rq); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_cpu_domain (obj, false);i915_gem_object_unlock (obj);if (err)
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +2 -2
@@ -102,7 +102,7 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj,GEM_BUG_ON (i915_gem_object_get_tiling (obj) != tile->tiling);GEM_BUG_ON (i915_gem_object_get_stride (obj) != tile->stride); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, true);i915_gem_object_unlock (obj);if (err) {
@@ -187,7 +187,7 @@ static int check_partial_mappings(struct drm_i915_gem_object *obj,GEM_BUG_ON (i915_gem_object_get_tiling (obj) != tile->tiling);GEM_BUG_ON (i915_gem_object_get_stride (obj) != tile->stride); -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, true);i915_gem_object_unlock (obj);if (err) {
drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c +2 -2
@@ -276,7 +276,7 @@ static int igt_fill_blt_thread(void *arg)if (err) goto err_unpin; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_cpu_domain (obj, false);i915_gem_object_unlock (obj);if (err)
@@ -397,7 +397,7 @@ static int igt_copy_blt_thread(void *arg)if (err) goto err_unpin; -i915_gem_object_lock (dst); +i915_gem_object_lock (dst,NULL ); err =i915_gem_object_set_to_cpu_domain (dst, false);i915_gem_object_unlock (dst);if (err)
drivers/gpu/drm/i915/gem/selftests/i915_gem_phys.c +1 -1
@@ -44,7 +44,7 @@ static int mock_phys_object(void *arg) }/* Make the object dirty so that put_pages must do copy back the data */ -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, true);i915_gem_object_unlock (obj);if (err) {
drivers/gpu/drm/i915/gt/selftest_workarounds.c +1 -1
@@ -214,7 +214,7 @@ static int check_whitelist(struct i915_gem_context *ctx,return PTR_ERR (results); err =0 ; -i915_gem_object_lock (results); +i915_gem_object_lock (results,NULL );intel_wedge_on_timeout (&wedge, engine->gt,HZ /5 )/* safety net! */ err = i915_gem_object_set_to_cpu_domain(results, false);i915_gem_object_unlock (results);
drivers/gpu/drm/i915/gvt/cmd_parser.c +1 -1
@@ -2954,7 +2954,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) goto put_obj; } -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); ret =i915_gem_object_set_to_cpu_domain (obj, false);i915_gem_object_unlock (obj);if (ret) {
drivers/gpu/drm/i915/i915_gem.c +50 -4
84 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gem.h +11 -0
@@ -116,4 +116,15 @@ static inline bool __tasklet_is_scheduled(struct tasklet_struct *t) return test_bit(TASKLET_STATE_SCHED, &t->state); } +struct i915_gem_ww_ctx { +struct ww_acquire_ctx ctx; +struct list_head obj_list; +bool intr; +struct drm_i915_gem_object *contended; +}; + +void i915_gem_ww_ctx_init (struct i915_gem_ww_ctx *ctx,bool intr); +void i915_gem_ww_ctx_fini (struct i915_gem_ww_ctx *ctx); +int __must_check i915_gem_ww_ctx_backoff (struct i915_gem_ww_ctx *ctx); +#endif /* __I915_GEM_H__ */
drivers/gpu/drm/i915/selftests/i915_gem.c +41 -0
52 lines not on this page · raw message
drivers/gpu/drm/i915/selftests/i915_vma.c +1 -1
@@ -892,7 +892,7 @@ static int igt_vma_remapped_gtt(void *arg)unsigned int x, y;int err; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_gtt_domain (obj, true);i915_gem_object_unlock (obj);if (err)
drivers/gpu/drm/i915/selftests/intel_memory_region.c +2 -2
@@ -273,7 +273,7 @@ static int igt_cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)unsigned long n;int err; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_wc_domain (obj, false);i915_gem_object_unlock (obj);if (err)
@@ -512,7 +512,7 @@ static int igt_lmem_write_cpu(void *arg)if (err) goto out_unpin; -i915_gem_object_lock (obj); +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_set_to_wc_domain (obj, true);i915_gem_object_unlock (obj);if (err)
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/7 drm/i915: Remove locking from i915_gem_object_prepare_read/write
In reply to Maarten LankhorstExecbuffer submission will perform its own WW locking, and we cannot rely on the implicit lock there.
This also makes it clear that the GVT code will get a lockdep splat when multiple batchbuffer shadows need to be performed in the same instance, fix that up.
--- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 20 ++++++------------- drivers/gpu/drm/i915/gem/i915_gem_object.h | 1 - .../gpu/drm/i915/gem/selftests/huge_pages.c | 5 ++++- .../i915/gem/selftests/i915_gem_coherency.c | 14 +++++++++---- .../drm/i915/gem/selftests/i915_gem_context.c | 12 ++++++++--- drivers/gpu/drm/i915/gt/intel_renderstate.c | 9 +++++++-- drivers/gpu/drm/i915/gvt/cmd_parser.c | 9 ++++++++- drivers/gpu/drm/i915/i915_cmd_parser.c | 16 ++++++++++++++- drivers/gpu/drm/i915/i915_gem.c | 8 +++++++- 9 files changed, 66 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_domain.c +6 -14
@@ -574,19 +574,17 @@ int i915_gem_object_prepare_read(struct drm_i915_gem_object *obj,if (!i915_gem_object_has_struct_page (obj))return -ENODEV ; - ret =i915_gem_object_lock_interruptible (obj,NULL ); -if (ret) -return ret; +assert_object_held (obj); ret =i915_gem_object_wait (obj,I915_WAIT_INTERRUPTIBLE ,MAX_SCHEDULE_TIMEOUT );if (ret) - goto err_unlock; +return ret; ret =i915_gem_object_pin_pages (obj);if (ret) - goto err_unlock; +return ret;if (obj->cache_coherent &I915_BO_CACHE_COHERENT_FOR_READ || !static_cpu_has (X86_FEATURE_CLFLUSH )) {
@@ -614,8 +612,6 @@ int i915_gem_object_prepare_read(struct drm_i915_gem_object *obj, err_unpin:i915_gem_object_unpin_pages (obj); -err_unlock: -i915_gem_object_unlock (obj);return ret; }
@@ -628,20 +624,18 @@ int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj,if (!i915_gem_object_has_struct_page (obj))return -ENODEV ; - ret =i915_gem_object_lock_interruptible (obj,NULL ); -if (ret) -return ret; +assert_object_held (obj); ret =i915_gem_object_wait (obj,I915_WAIT_INTERRUPTIBLE |I915_WAIT_ALL ,MAX_SCHEDULE_TIMEOUT );if (ret) - goto err_unlock; +return ret; ret =i915_gem_object_pin_pages (obj);if (ret) - goto err_unlock; +return ret;if (obj->cache_coherent &I915_BO_CACHE_COHERENT_FOR_WRITE || !static_cpu_has (X86_FEATURE_CLFLUSH )) {
@@ -678,7 +672,5 @@ int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj, err_unpin:i915_gem_object_unpin_pages (obj); -err_unlock: -i915_gem_object_unlock (obj);return ret; }
drivers/gpu/drm/i915/gem/i915_gem_object.h +0 -1
@@ -427,7 +427,6 @@ static inline void i915_gem_object_finish_access(struct drm_i915_gem_object *obj) {i915_gem_object_unpin_pages (obj); -i915_gem_object_unlock (obj); } static inline struct intel_engine_cs *
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +4 -1
@@ -991,9 +991,10 @@ __cpu_check_shmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)unsigned long n;int err; +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_prepare_read (obj, &needs_flush);if (err) -return err; + goto err_unlock;for (n =0 ; n < obj->base.size >>PAGE_SHIFT ; ++n) {u32 *ptr =kmap_atomic (i915_gem_object_get_page (obj, n));
@@ -1013,6 +1014,8 @@ __cpu_check_shmem(struct drm_i915_gem_object *obj, u32 dword, u32 val) }i915_gem_object_finish_access (obj); +err_unlock: +i915_gem_object_unlock (obj);return err; }
drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c +10 -4
@@ -27,9 +27,10 @@ static int cpu_set(struct context *ctx, unsigned long offset, u32 v)u32 *cpu;int err; +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_prepare_write (ctx->obj, &needs_clflush);if (err) -return err; + goto out; page =i915_gem_object_get_page (ctx->obj, offset >>PAGE_SHIFT ); map =kmap_atomic (page);
@@ -46,7 +47,9 @@ static int cpu_set(struct context *ctx, unsigned long offset, u32 v)kunmap_atomic (map);i915_gem_object_finish_access (ctx->obj); -return 0 ; +out: +i915_gem_object_unlock (ctx->obj); +return err; }static int cpu_get (struct context *ctx,unsigned long offset,u32 *v)
@@ -57,9 +60,10 @@ static int cpu_get(struct context *ctx, unsigned long offset, u32 *v)u32 *cpu;int err; +i915_gem_object_lock (ctx->obj,NULL ); err =i915_gem_object_prepare_read (ctx->obj, &needs_clflush);if (err) -return err; + goto out; page =i915_gem_object_get_page (ctx->obj, offset >>PAGE_SHIFT ); map =kmap_atomic (page);
@@ -73,7 +77,9 @@ static int cpu_get(struct context *ctx, unsigned long offset, u32 *v)kunmap_atomic (map);i915_gem_object_finish_access (ctx->obj); -return 0 ; +out: +i915_gem_object_unlock (ctx->obj); +return err; }static int gtt_set (struct context *ctx,unsigned long offset,u32 v)
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c +9 -3
@@ -461,9 +461,10 @@ static int cpu_fill(struct drm_i915_gem_object *obj, u32 value)unsigned int n, m, need_flush;int err; +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_prepare_write (obj, &need_flush);if (err) -return err; + goto out;for (n =0 ; n <real_page_count (obj); n++) {u32 *map;
@@ -479,7 +480,9 @@ static int cpu_fill(struct drm_i915_gem_object *obj, u32 value)i915_gem_object_finish_access (obj); obj->read_domains =I915_GEM_DOMAIN_GTT |I915_GEM_DOMAIN_CPU ; obj->write_domain =0 ; -return 0 ; +out: +i915_gem_object_unlock (obj); +return err; } static noinline int cpu_check(struct drm_i915_gem_object *obj,
@@ -488,9 +491,10 @@ static noinline int cpu_check(struct drm_i915_gem_object *obj,unsigned int n, m, needs_flush;int err; +i915_gem_object_lock (obj,NULL ); err =i915_gem_object_prepare_read (obj, &needs_flush);if (err) -return err; + goto out_unlock;for (n =0 ; n <real_page_count (obj); n++) {u32 *map;
@@ -527,6 +531,8 @@ static noinline int cpu_check(struct drm_i915_gem_object *obj, }i915_gem_object_finish_access (obj); +out_unlock: +i915_gem_object_unlock (obj);return err; }
drivers/gpu/drm/i915/gt/intel_renderstate.c +7 -2
@@ -196,6 +196,8 @@ int intel_renderstate_init(struct intel_renderstate *so,if (err) goto err_vma; +i915_gem_object_lock (so->vma->obj,NULL ); + err =render_state_setup (so, engine->i915);if (err) goto err_unpin;
@@ -203,6 +205,7 @@ int intel_renderstate_init(struct intel_renderstate *so,return 0 ; err_unpin: +i915_gem_object_unlock (so->vma->obj);i915_vma_unpin (so->vma); err_vma:i915_vma_close (so->vma);
@@ -235,16 +238,18 @@ int intel_renderstate_emit(struct intel_renderstate *so,return err; } -i915_vma_lock (so->vma); err =i915_request_await_object (rq, so->vma->obj, false);if (err ==0 ) err =i915_vma_move_to_active (so->vma, rq,0 ); -i915_vma_unlock (so->vma);return err; }void intel_renderstate_fini (struct intel_renderstate *so) { +if (!so->vma) +return ; + +i915_gem_object_unlock (so->vma->obj);i915_vma_unpin_and_release (&so->vma,0 ); }
drivers/gpu/drm/i915/gvt/cmd_parser.c +8 -1
@@ -1865,10 +1865,14 @@ static int perform_bb_shadow(struct parser_exec_state *s) goto err_free_bb; } - ret =i915_gem_object_prepare_write (bb->obj, &bb->clflush); + ret =i915_gem_object_lock_interruptible (bb->obj,NULL );if (ret) goto err_free_obj; + ret =i915_gem_object_prepare_write (bb->obj, &bb->clflush); +if (ret) + goto err_unlock; + bb->va =i915_gem_object_pin_map (bb->obj,I915_MAP_WB );if (IS_ERR (bb->va)) { ret =PTR_ERR (bb->va);
@@ -1893,6 +1897,7 @@ static int perform_bb_shadow(struct parser_exec_state *s)if (ret) goto err_unmap; +i915_gem_object_unlock (bb->obj);INIT_LIST_HEAD (&bb->list);list_add (&bb->list, &s->workload->shadow_bb);
@@ -1919,6 +1924,8 @@ static int perform_bb_shadow(struct parser_exec_state *s)i915_gem_object_unpin_map (bb->obj); err_finish_shmem_access:i915_gem_object_finish_access (bb->obj); +err_unlock: +i915_gem_object_unlock (bb->obj); err_free_obj:i915_gem_object_put (bb->obj); err_free_bb:
drivers/gpu/drm/i915/i915_cmd_parser.c +15 -1
@@ -1136,18 +1136,31 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,void *dst, *src;int ret; - ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush); + ret =i915_gem_object_lock_interruptible (dst_obj,NULL );if (ret)return ERR_PTR (ret); + ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush); +if (ret) { +i915_gem_object_unlock (dst_obj); +return ERR_PTR (ret); + } + dst =i915_gem_object_pin_map (dst_obj,I915_MAP_FORCE_WB );i915_gem_object_finish_access (dst_obj); +i915_gem_object_unlock (dst_obj); +if (IS_ERR (dst))return dst; + ret =i915_gem_object_lock_interruptible (src_obj,NULL ); +if (ret) +return ERR_PTR (ret); + ret =i915_gem_object_prepare_read (src_obj, &src_needs_clflush);if (ret) {i915_gem_object_unpin_map (dst_obj); +i915_gem_object_unlock (src_obj);return ERR_PTR (ret); }
@@ -1196,6 +1209,7 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, }i915_gem_object_finish_access (src_obj); +i915_gem_object_unlock (src_obj);/* dst_obj is returned with vmap pinned */ *needs_clflush_after = dst_needs_clflush &CLFLUSH_AFTER ;
drivers/gpu/drm/i915/i915_gem.c +7 -1
@@ -517,15 +517,21 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,if (ret) goto out; - ret =i915_gem_object_pin_pages (obj); + ret =i915_gem_object_lock_interruptible (obj,NULL );if (ret) goto out; + ret =i915_gem_object_pin_pages (obj); +if (ret) + goto out_unlock; + ret =i915_gem_shmem_pread (obj, args);if (ret == -EFAULT || ret == -ENODEV ) ret =i915_gem_gtt_pread (obj, args);i915_gem_object_unpin_pages (obj); +out_unlock: +i915_gem_object_unlock (obj); out:i915_gem_object_put (obj);return ret;
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/7 drm/i915: Separate lookup and pinning in execbuf.
In reply to Maarten LankhorstWe want to get rid of struct mutex, but vma reservation was entangled with vma lookup. Make vma lookup and validation a preparation step, and vma pinning a repeatable step. This allows us to keep all the looked up information when dropping all locks, which saves an extra lookup during relocation slowpath.
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 98 ++++++++++--------- drivers/gpu/drm/i915/i915_drv.h | 6 -- 2 files changed, 54 insertions(+), 50 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +54 -44
@@ -56,8 +56,7 @@ enum {#define __EXEC_OBJECT_RESERVED (__EXEC_OBJECT_HAS_PIN | __EXEC_OBJECT_HAS_FENCE)#define __EXEC_HAS_RELOC BIT(31) -#define __EXEC_VALIDATED BIT(30) -#define __EXEC_INTERNAL_FLAGS (~0u << 30) +#define __EXEC_INTERNAL_FLAGS (~0u << 31)#define UPDATE PIN_OFFSET_FIXED#define BATCH_OFFSET_BIAS (256*1024)
@@ -502,11 +501,9 @@ eb_add_vma(struct i915_execbuffer *eb,GEM_BUG_ON (i915_vma_is_closed (vma)); -if (!(eb->args->flags & __EXEC_VALIDATED)) { - err =eb_validate_vma (eb, entry, vma); -if (unlikely (err)) -return err; - } + err =eb_validate_vma (eb, entry, vma); +if (unlikely (err)) +return err; ev->vma = vma; ev->exec = entry;
@@ -541,20 +538,7 @@ eb_add_vma(struct i915_execbuffer *eb, eb->batch = ev; } - err =0 ; -if (eb_pin_vma (eb, entry, ev)) { -if (entry->offset != vma->node.start) { - entry->offset = vma->node.start |UPDATE ; - eb->args->flags |= __EXEC_HAS_RELOC; - } - }else { -eb_unreserve_vma (ev); - -list_add_tail (&ev->bind_link, &eb->unbound); -if (drm_mm_node_allocated (&vma->node)) - err =i915_vma_unbind (vma); - } -return err; +return 0 ; } static inline int use_cpu_reloc(const struct reloc_cache *cache,
@@ -748,7 +732,6 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)return -EIO ;INIT_LIST_HEAD (&eb->relocs); -INIT_LIST_HEAD (&eb->unbound); batch =eb_batch_index (eb);
@@ -805,15 +788,11 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb) err =eb_add_vma (eb, i, batch, vma);if (unlikely (err)) goto err_vma; - -GEM_BUG_ON (drm_mm_node_allocated (&vma->node) && -eb_vma_misplaced (&eb->exec[i], vma, eb->vma[i].flags)); }mutex_unlock (&eb->gem_context->mutex); - eb->args->flags |= __EXEC_VALIDATED; -return eb_reserve (eb); +return 0 ; err_obj:i915_gem_object_put (obj);
@@ -824,6 +803,41 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)return err; } +static int eb_validate_vmas (struct i915_execbuffer *eb) +{ +unsigned int i; +int err; + +INIT_LIST_HEAD (&eb->unbound); + +for (i =0 ; i < eb->buffer_count; i++) { +struct drm_i915_gem_exec_object2 *entry = &eb->exec[i]; +struct eb_vma *ev = &eb->vma[i]; +struct i915_vma *vma = ev->vma; + +if (eb_pin_vma (eb, entry, ev)) { +if (entry->offset != vma->node.start) { + entry->offset = vma->node.start |UPDATE ; + eb->args->flags |= __EXEC_HAS_RELOC; + } + }else { +eb_unreserve_vma (ev); + +list_add_tail (&ev->bind_link, &eb->unbound); +if (drm_mm_node_allocated (&vma->node)) { + err =i915_vma_unbind (vma); +if (err) +return err; + } + } + +GEM_BUG_ON (drm_mm_node_allocated (&vma->node) && +eb_vma_misplaced (&eb->exec[i], vma, ev->flags)); + } + +return eb_reserve (eb); +} +static struct eb_vma *eb_get_vma (const struct i915_execbuffer *eb,unsigned long handle) {
@@ -856,22 +870,12 @@ static void eb_release_vmas(const struct i915_execbuffer *eb)if (!vma)break ; - eb->vma[i].vma =NULL ; - -if (ev->flags & __EXEC_OBJECT_HAS_PIN) -__eb_unreserve_vma (vma, ev->flags); +eb_unreserve_vma (ev);if (ev->flags & __EXEC_OBJECT_HAS_REF)i915_vma_put (vma); - } -} -static void eb_reset_vmas (const struct i915_execbuffer *eb) -{ -eb_release_vmas (eb); -if (eb->lut_size >0 ) -memset (eb->buckets,0 , -sizeof (struct hlist_head ) << eb->lut_size); + } }static void eb_destroy (const struct i915_execbuffer *eb)
@@ -1689,7 +1693,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) }/* We may process another execbuffer during the unlock... */ -eb_reset_vmas (eb); +eb_release_vmas (eb);mutex_unlock (&dev->struct_mutex);/*
@@ -1722,14 +1726,14 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)/* A frequent cause for EAGAIN are currently unavailable client pages */ flush_workqueue (eb->i915->mm.userptr_wq); - err =i915_mutex_lock_interruptible (dev); + err =mutex_lock_interruptible (&dev->struct_mutex);if (err) {mutex_lock (&dev->struct_mutex); goto out; }/* reacquire the objects */ - err =eb_lookup_vmas (eb); + err =eb_validate_vmas (eb);if (err) goto err;
@@ -1783,7 +1787,13 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)static int eb_relocate (struct i915_execbuffer *eb) { -if (eb_lookup_vmas (eb)) +int err; + + err =eb_lookup_vmas (eb); +if (err) +return err; + +if (eb_validate_vmas (eb)) goto slow;/* The objects are in their final locations, apply the relocations. */
@@ -2542,7 +2552,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,if (unlikely (err)) goto err_context; - err =i915_mutex_lock_interruptible (dev); + err =mutex_lock_interruptible (&dev->struct_mutex);if (err) goto err_engine;
drivers/gpu/drm/i915/i915_drv.h +0 -6
@@ -1846,12 +1846,6 @@ int i915_gem_object_unbind(struct drm_i915_gem_object *obj,void i915_gem_runtime_suspend (struct drm_i915_private *dev_priv); -static inline int __must_check -i915_mutex_lock_interruptible (struct drm_device *dev) -{ -return mutex_lock_interruptible (&dev->struct_mutex); -} -int i915_gem_dumb_create (struct drm_file *file_priv,struct drm_device *dev,struct drm_mode_create_dumb *args);
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/7 drm/i915: Parse command buffer earlier in eb_relocate(slow)
In reply to Maarten LankhorstWe want to introduce backoff logic, but we need to lock the pool object as well for command parsing. Because of this, we will need backoff logic for the engine pool obj, move the batch validation up slightly to eb_lookup_vmas, and the actual command parsing in a separate function which can get called from execbuf relocation fast and slowpath.
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 120 +++++++++--------- 1 file changed, 61 insertions(+), 59 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +61 -59
@@ -285,6 +285,9 @@ struct i915_execbuffer {struct hlist_head *buckets;/** ht for relocation handles */ }; +static int eb_parse (struct i915_execbuffer *eb, +struct intel_engine_pool_node *pool); +/* * Used to convert any address to canonical form. * Starting from gen8, some commands (e.g. STATE_BASE_ADDRESS,
@@ -792,6 +795,21 @@ static int eb_lookup_vmas(struct i915_execbuffer *eb)mutex_unlock (&eb->gem_context->mutex); +if (unlikely (eb->batch->flags &EXEC_OBJECT_WRITE )) { +DRM_DEBUG ("Attempting to use self-modifying batch buffer\n" ); +return -EINVAL ; + } + +if (range_overflows_t (u64, + eb->batch_start_offset, eb->batch_len, + eb->batch->vma->size)) { +DRM_DEBUG ("Attempting to use out-of-bounds batch\n" ); +return -EINVAL ; + } + +if (eb->batch_len ==0 ) + eb->batch_len = eb->batch->vma->size - eb->batch_start_offset; +return 0 ; err_obj:
@@ -1679,6 +1697,25 @@ static int eb_prefault_relocations(const struct i915_execbuffer *eb)return 0 ; } +static int eb_lock_and_parse_cmdbuffer (struct i915_execbuffer *eb) +{ +struct intel_engine_pool_node *pool; +int err; + +if (!eb_use_cmdparser (eb)) +return 0 ; + + pool =intel_engine_get_pool (eb->engine, eb->batch_len); +if (IS_ERR (pool)) +return PTR_ERR (pool); + + err =eb_parse (eb, pool); +if (err) +intel_engine_pool_put (pool); + +return err; +} + static noinline int eb_relocate_slow(struct i915_execbuffer *eb) {struct drm_device *dev = &eb->i915->drm;
@@ -1753,6 +1790,10 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) } } + err =eb_lock_and_parse_cmdbuffer (eb); +if (err) + goto err; +/* * Leave the user relocations as are, this is the painfully slow path, * and we want to avoid the complication of dropping the lock whilst
@@ -1785,7 +1826,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)return err; } -static int eb_relocate (struct i915_execbuffer *eb) +static int eb_relocate_and_parse_cmdbuf (struct i915_execbuffer *eb) {int err;
@@ -1793,7 +1834,10 @@ static int eb_relocate(struct i915_execbuffer *eb)if (err)return err; -if (eb_validate_vmas (eb)) + err =eb_validate_vmas (eb); +if (!err) + err =eb_lock_and_parse_cmdbuffer (eb); +if (err) goto slow;/* The objects are in their final locations, apply the relocations. */
@@ -2000,21 +2044,17 @@ shadow_batch_pin(struct i915_execbuffer *eb, struct drm_i915_gem_object *obj)return vma; } -static struct i915_vma *eb_parse (struct i915_execbuffer *eb) +static int eb_parse (struct i915_execbuffer *eb, +struct intel_engine_pool_node *pool) { -struct intel_engine_pool_node *pool;struct i915_vma *vma;u64 batch_start;u64 shadow_batch_start;int err; - pool =intel_engine_get_pool (eb->engine, eb->batch_len); -if (IS_ERR (pool)) -return ERR_CAST (pool); - vma =shadow_batch_pin (eb, pool->obj);if (IS_ERR (vma)) - goto err; +return PTR_ERR (vma); batch_start =gen8_canonical_addr (eb->batch->vma->node.start) + eb->batch_start_offset;
@@ -2038,12 +2078,13 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)* For PPGTT backing however, we have no choice but to forcibly * reject unsafe buffers */ -if (i915_vma_is_ggtt (vma) && err == -EACCES ) +if (i915_vma_is_ggtt (vma) && err == -EACCES ) {/* Execute original buffer non-secure */ - vma =NULL ; -else - vma =ERR_PTR (err); - goto err; +intel_engine_pool_put (pool); +return 0 ; + } + +return err; } eb->vma[eb->buffer_count].vma =i915_vma_get (vma);
@@ -2059,11 +2100,7 @@ static struct i915_vma *eb_parse(struct i915_execbuffer *eb)/* eb->batch_len unchanged */ vma->private = pool; -return vma; - -err: -intel_engine_pool_put (pool); -return vma; +return 0 ; } static void
@@ -2556,51 +2593,15 @@ i915_gem_do_execbuffer(struct drm_device *dev,if (err) goto err_engine; - err =eb_relocate (&eb); -if (err) { -/* -* If the user expects the execobject.offset and -* reloc.presumed_offset to be an exact match, -* as for using NO_RELOC, then we cannot update -* the execobject.offset until we have completed -* relocation. -*/ - args->flags &= ~__EXEC_HAS_RELOC; - goto err_vma; - } - -if (unlikely (eb.batch->flags &EXEC_OBJECT_WRITE )) { -DRM_DEBUG ("Attempting to use self-modifying batch buffer\n" ); - err = -EINVAL ; - goto err_vma; - } - - batch = eb.batch->vma; -if (range_overflows_t (u64, - eb.batch_start_offset, eb.batch_len, - batch->size)) { -DRM_DEBUG ("Attempting to use out-of-bounds batch\n" ); - err = -EINVAL ; + err =eb_relocate_and_parse_cmdbuf (&eb); +if (err) goto err_vma; - } - -if (eb.batch_len ==0 ) - eb.batch_len = eb.batch->vma->size - eb.batch_start_offset; - -if (eb_use_cmdparser (&eb)) { -struct i915_vma *vma; - - vma =eb_parse (&eb); -if (IS_ERR (vma)) { - err =PTR_ERR (vma); - goto err_vma; - } - }/* * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure * batch" bit. Hence we need to pin secure batches into the global gtt. * hsw should have this fixed, but bdw mucks it up again. */ + batch = eb.batch->vma;if (eb.batch_flags &I915_DISPATCH_SECURE ) {struct i915_vma *vma;
@@ -2617,7 +2618,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, vma =i915_gem_object_ggtt_pin (batch->obj,NULL ,0 ,0 ,0 );if (IS_ERR (vma)) { err =PTR_ERR (vma); - goto err_vma; + goto err_pool; } batch = vma;
@@ -2694,6 +2695,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_batch_unpin:if (eb.batch_flags &I915_DISPATCH_SECURE )i915_vma_unpin (batch); +err_pool:if (batch->private)intel_engine_pool_put (batch->private); err_vma:
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/7 drm/i915: Use per object locking instead of struct_mutex for execbuf
In reply to Maarten LankhorstNow that we changed execbuf submission slightly to allow us to do all pinning in one place, we can now simply replace the struct_mutex lock with ww versions. All we have to do is a separate path for -EDEADLK handling, which needs to unpin all gem bo's before dropping the lock, then starting over.
This finally allows us to do parallel submission.
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 103 +++++++++--------- drivers/gpu/drm/i915/i915_cmd_parser.c | 15 +-- 2 files changed, 51 insertions(+), 67 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +50 -53
@@ -249,6 +249,8 @@ struct i915_execbuffer {/** list of vma that have execobj.relocation_count */ struct list_head relocs; +struct i915_gem_ww_ctx ww; +/** * Track the most recently used object for relocations, as we * frequently have to perform multiple relocations within the same
@@ -833,6 +835,10 @@ static int eb_validate_vmas(struct i915_execbuffer *eb)struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma; + err =i915_gem_object_lock (vma->obj, &eb->ww); +if (err) +return err; +if (eb_pin_vma (eb, entry, ev)) {if (entry->offset != vma->node.start) { entry->offset = vma->node.start |UPDATE ;
@@ -1143,7 +1149,7 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)struct drm_i915_gem_object *obj = vma->obj;int err; -i915_vma_lock (vma); +assert_vma_held (vma);if (obj->cache_dirty & ~obj->cache_coherent)i915_gem_clflush_object (obj,0 );
@@ -1153,8 +1159,6 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)if (err ==0 ) err =i915_vma_move_to_active (vma, rq,EXEC_OBJECT_WRITE ); -i915_vma_unlock (vma); -return err; }
@@ -1212,11 +1216,10 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,if (err) goto skip_request; -i915_vma_lock (batch); +assert_vma_held (batch); err =i915_request_await_object (rq, batch->obj, false);if (err ==0 ) err =i915_vma_move_to_active (batch, rq,0 ); -i915_vma_unlock (batch);if (err) goto skip_request;
@@ -1709,7 +1712,10 @@ static int eb_lock_and_parse_cmdbuffer(struct i915_execbuffer *eb)if (IS_ERR (pool))return PTR_ERR (pool); - err =eb_parse (eb, pool); + err =i915_gem_object_lock (pool->obj, &eb->ww); +if (!err) + err =eb_parse (eb, pool); +if (err)intel_engine_pool_put (pool);
@@ -1718,7 +1724,6 @@ static int eb_lock_and_parse_cmdbuffer(struct i915_execbuffer *eb) static noinline int eb_relocate_slow(struct i915_execbuffer *eb) { -struct drm_device *dev = &eb->i915->drm;bool have_copy = false;struct eb_vma *ev;int err =0 ;
@@ -1731,7 +1736,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)/* We may process another execbuffer during the unlock... */ eb_release_vmas (eb); -mutex_unlock (&dev->struct_mutex); +i915_gem_ww_ctx_fini (&eb->ww);/* * We take 3 passes through the slowpatch.
@@ -1756,20 +1761,17 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) err =0 ; }if (err) { -mutex_lock (&dev->struct_mutex); +i915_gem_ww_ctx_init (&eb->ww, true); goto out; }/* A frequent cause for EAGAIN are currently unavailable client pages */ flush_workqueue (eb->i915->mm.userptr_wq); - err =mutex_lock_interruptible (&dev->struct_mutex); -if (err) { -mutex_lock (&dev->struct_mutex); - goto out; - } +i915_gem_ww_ctx_init (&eb->ww, true);/* reacquire the objects */ +repeat_validate: err =eb_validate_vmas (eb);if (err) goto err;
@@ -1802,6 +1804,13 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)*/ err: +if (err == -EDEADLK ) { +eb_release_vmas (eb); + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (!err) + goto repeat_validate; + } +if (err == -EAGAIN ) goto repeat;
@@ -1834,10 +1843,19 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)if (err)return err; +retry: err =eb_validate_vmas (eb);if (!err) err =eb_lock_and_parse_cmdbuffer (eb); -if (err) + +if (err == -EDEADLK ) { + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (err) +return err; + + goto retry; + } +else if (err) goto slow;/* The objects are in their final locations, apply the relocations. */
@@ -1853,43 +1871,26 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)return 0 ; slow: -return eb_relocate_slow (eb); + err =eb_relocate_slow (eb); +if (err) +/* +* If the user expects the execobject.offset and +* reloc.presumed_offset to be an exact match, +* as for using NO_RELOC, then we cannot update +* the execobject.offset until we have completed +* relocation. +*/ + eb->args->flags &= ~__EXEC_HAS_RELOC; + +return err; }static int eb_move_to_gpu (struct i915_execbuffer *eb) {const unsigned int count = eb->buffer_count; -struct ww_acquire_ctx acquire; -unsigned int i; +unsigned int i = count;int err =0 ; -ww_acquire_init (&acquire, &reservation_ww_class); - -for (i =0 ; i < count; i++) { -struct eb_vma *ev = &eb->vma[i]; -struct i915_vma *vma = ev->vma; - - err =ww_mutex_lock_interruptible (&vma->resv->lock, &acquire); -if (err == -EDEADLK ) { -GEM_BUG_ON (i ==0 ); -do { -int j = i -1 ; - -ww_mutex_unlock (&eb->vma[j].vma->resv->lock); - -swap (eb->vma[i], eb->vma[j]); - }while (--i); - - err =ww_mutex_lock_slow_interruptible (&vma->resv->lock, - &acquire); - } -if (err == -EALREADY ) - err =0 ; -if (err) -break ; - } -ww_acquire_done (&acquire); -while (i--) {struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma;
@@ -1934,15 +1935,12 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)if (err ==0 ) err =i915_vma_move_to_active (vma, eb->request, flags); -i915_vma_unlock (vma); -__eb_unreserve_vma (vma, flags);if (unlikely (flags & __EXEC_OBJECT_HAS_REF))i915_vma_put (vma); ev->vma =NULL ; } -ww_acquire_fini (&acquire);if (unlikely (err)) goto err_skip;
@@ -2589,14 +2587,14 @@ i915_gem_do_execbuffer(struct drm_device *dev,if (unlikely (err)) goto err_context; - err =mutex_lock_interruptible (&dev->struct_mutex); -if (err) - goto err_engine; +i915_gem_ww_ctx_init (&eb.ww, true); err =eb_relocate_and_parse_cmdbuf (&eb);if (err) goto err_vma; +ww_acquire_done (&eb.ww.ctx); +/* * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure * batch" bit. Hence we need to pin secure batches into the global gtt.
@@ -2701,8 +2699,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_vma:if (eb.exec)eb_release_vmas (&eb); -mutex_unlock (&dev->struct_mutex); -err_engine: +i915_gem_ww_ctx_fini (&eb.ww);eb_unpin_engine (&eb); err_context:i915_gem_context_put (eb.gem_context);
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -14
@@ -1136,31 +1136,19 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,void *dst, *src;int ret; - ret =i915_gem_object_lock_interruptible (dst_obj,NULL ); + ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush);if (ret)return ERR_PTR (ret); - ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush); -if (ret) { -i915_gem_object_unlock (dst_obj); -return ERR_PTR (ret); - } - dst =i915_gem_object_pin_map (dst_obj,I915_MAP_FORCE_WB );i915_gem_object_finish_access (dst_obj); -i915_gem_object_unlock (dst_obj);if (IS_ERR (dst))return dst; - ret =i915_gem_object_lock_interruptible (src_obj,NULL ); -if (ret) -return ERR_PTR (ret); - ret =i915_gem_object_prepare_read (src_obj, &src_needs_clflush);if (ret) {i915_gem_object_unpin_map (dst_obj); -i915_gem_object_unlock (src_obj);return ERR_PTR (ret); }
@@ -1209,7 +1197,6 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, }i915_gem_object_finish_access (src_obj); -i915_gem_object_unlock (src_obj);/* dst_obj is returned with vmap pinned */ *needs_clflush_after = dst_needs_clflush &CLFLUSH_AFTER ;
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Use per object locking in execbuf on top of struct_mutex, v2.
Now that we changed execbuf submission slightly to allow us to do all pinning in one place, we can now simply add ww versions on top of struct_mutex. All we have to do is a separate path for -EDEADLK handling, which needs to unpin all gem bo's before dropping the lock, then starting over.
This finally allows us to do parallel submission, but because vma pinning does not use the ww ctx yet, we cannot drop struct_mutex yet.
Changes since v1:
- Keep struct_mutex for now. :(
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 94 ++++++++++--------- drivers/gpu/drm/i915/i915_cmd_parser.c | 15 +-- 2 files changed, 53 insertions(+), 56 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +52 -42
@@ -249,6 +249,8 @@ struct i915_execbuffer {/** list of vma that have execobj.relocation_count */ struct list_head relocs; +struct i915_gem_ww_ctx ww; +/** * Track the most recently used object for relocations, as we * frequently have to perform multiple relocations within the same
@@ -833,6 +835,10 @@ static int eb_validate_vmas(struct i915_execbuffer *eb)struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma; + err =i915_gem_object_lock (vma->obj, &eb->ww); +if (err) +return err; +if (eb_pin_vma (eb, entry, ev)) {if (entry->offset != vma->node.start) { entry->offset = vma->node.start |UPDATE ;
@@ -1143,7 +1149,7 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)struct drm_i915_gem_object *obj = vma->obj;int err; -i915_vma_lock (vma); +assert_vma_held (vma);if (obj->cache_dirty & ~obj->cache_coherent)i915_gem_clflush_object (obj,0 );
@@ -1153,8 +1159,6 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)if (err ==0 ) err =i915_vma_move_to_active (vma, rq,EXEC_OBJECT_WRITE ); -i915_vma_unlock (vma); -return err; }
@@ -1212,11 +1216,10 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,if (err) goto skip_request; -i915_vma_lock (batch); +assert_vma_held (batch); err =i915_request_await_object (rq, batch->obj, false);if (err ==0 ) err =i915_vma_move_to_active (batch, rq,0 ); -i915_vma_unlock (batch);if (err) goto skip_request;
@@ -1709,7 +1712,10 @@ static int eb_lock_and_parse_cmdbuffer(struct i915_execbuffer *eb)if (IS_ERR (pool))return PTR_ERR (pool); - err =eb_parse (eb, pool); + err =i915_gem_object_lock (pool->obj, &eb->ww); +if (!err) + err =eb_parse (eb, pool); +if (err)intel_engine_pool_put (pool);
@@ -1731,6 +1737,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)/* We may process another execbuffer during the unlock... */ eb_release_vmas (eb); +i915_gem_ww_ctx_fini (&eb->ww);mutex_unlock (&dev->struct_mutex);/*
@@ -1757,6 +1764,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) }if (err) {mutex_lock (&dev->struct_mutex); +i915_gem_ww_ctx_init (&eb->ww, true); goto out; }
@@ -1768,8 +1776,10 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)mutex_lock (&dev->struct_mutex); goto out; } +i915_gem_ww_ctx_init (&eb->ww, true);/* reacquire the objects */ +repeat_validate: err =eb_validate_vmas (eb);if (err) goto err;
@@ -1802,6 +1812,13 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)*/ err: +if (err == -EDEADLK ) { +eb_release_vmas (eb); + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (!err) + goto repeat_validate; + } +if (err == -EAGAIN ) goto repeat;
@@ -1834,10 +1851,19 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)if (err)return err; +retry: err =eb_validate_vmas (eb);if (!err) err =eb_lock_and_parse_cmdbuffer (eb); -if (err) + +if (err == -EDEADLK ) { + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (err) +return err; + + goto retry; + } +else if (err) goto slow;/* The objects are in their final locations, apply the relocations. */
@@ -1853,43 +1879,26 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)return 0 ; slow: -return eb_relocate_slow (eb); + err =eb_relocate_slow (eb); +if (err) +/* +* If the user expects the execobject.offset and +* reloc.presumed_offset to be an exact match, +* as for using NO_RELOC, then we cannot update +* the execobject.offset until we have completed +* relocation. +*/ + eb->args->flags &= ~__EXEC_HAS_RELOC; + +return err; }static int eb_move_to_gpu (struct i915_execbuffer *eb) {const unsigned int count = eb->buffer_count; -struct ww_acquire_ctx acquire; -unsigned int i; +unsigned int i = count;int err =0 ; -ww_acquire_init (&acquire, &reservation_ww_class); - -for (i =0 ; i < count; i++) { -struct eb_vma *ev = &eb->vma[i]; -struct i915_vma *vma = ev->vma; - - err =ww_mutex_lock_interruptible (&vma->resv->lock, &acquire); -if (err == -EDEADLK ) { -GEM_BUG_ON (i ==0 ); -do { -int j = i -1 ; - -ww_mutex_unlock (&eb->vma[j].vma->resv->lock); - -swap (eb->vma[i], eb->vma[j]); - }while (--i); - - err =ww_mutex_lock_slow_interruptible (&vma->resv->lock, - &acquire); - } -if (err == -EALREADY ) - err =0 ; -if (err) -break ; - } -ww_acquire_done (&acquire); -while (i--) {struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma;
@@ -1934,15 +1943,12 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)if (err ==0 ) err =i915_vma_move_to_active (vma, eb->request, flags); -i915_vma_unlock (vma); -__eb_unreserve_vma (vma, flags);if (unlikely (flags & __EXEC_OBJECT_HAS_REF))i915_vma_put (vma); ev->vma =NULL ; } -ww_acquire_fini (&acquire);if (unlikely (err)) goto err_skip;
@@ -2592,11 +2598,14 @@ i915_gem_do_execbuffer(struct drm_device *dev, err =mutex_lock_interruptible (&dev->struct_mutex);if (err) goto err_engine; +i915_gem_ww_ctx_init (&eb.ww, true); err =eb_relocate_and_parse_cmdbuf (&eb);if (err) goto err_vma; +ww_acquire_done (&eb.ww.ctx); +/* * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure * batch" bit. Hence we need to pin secure batches into the global gtt.
@@ -2701,10 +2710,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_vma:if (eb.exec)eb_release_vmas (&eb); +i915_gem_ww_ctx_fini (&eb.ww);mutex_unlock (&dev->struct_mutex); -err_engine: +err_unpin:eb_unpin_engine (&eb); -err_context: +err_engine:i915_gem_context_put (eb.gem_context); err_destroy:eb_destroy (&eb);
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -14
@@ -1136,31 +1136,19 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,void *dst, *src;int ret; - ret =i915_gem_object_lock_interruptible (dst_obj,NULL ); + ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush);if (ret)return ERR_PTR (ret); - ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush); -if (ret) { -i915_gem_object_unlock (dst_obj); -return ERR_PTR (ret); - } - dst =i915_gem_object_pin_map (dst_obj,I915_MAP_FORCE_WB );i915_gem_object_finish_access (dst_obj); -i915_gem_object_unlock (dst_obj);if (IS_ERR (dst))return dst; - ret =i915_gem_object_lock_interruptible (src_obj,NULL ); -if (ret) -return ERR_PTR (ret); - ret =i915_gem_object_prepare_read (src_obj, &src_needs_clflush);if (ret) {i915_gem_object_unpin_map (dst_obj); -i915_gem_object_unlock (src_obj);return ERR_PTR (ret); }
@@ -1209,7 +1197,6 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, }i915_gem_object_finish_access (src_obj); -i915_gem_object_unlock (src_obj);/* dst_obj is returned with vmap pinned */ *needs_clflush_after = dst_needs_clflush &CLFLUSH_AFTER ;
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Use per object locking in execbuf on top of struct_mutex, v2.
Now that we changed execbuf submission slightly to allow us to do all pinning in one place, we can now simply add ww versions on top of struct_mutex. All we have to do is a separate path for -EDEADLK handling, which needs to unpin all gem bo's before dropping the lock, then starting over.
This finally allows us to do parallel submission, but because vma pinning does not use the ww ctx yet, we cannot drop struct_mutex yet.
Changes since v1:
- Keep struct_mutex for now. :(
--- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 90 ++++++++++--------- drivers/gpu/drm/i915/i915_cmd_parser.c | 15 +--- 2 files changed, 51 insertions(+), 54 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +50 -40
@@ -249,6 +249,8 @@ struct i915_execbuffer {/** list of vma that have execobj.relocation_count */ struct list_head relocs; +struct i915_gem_ww_ctx ww; +/** * Track the most recently used object for relocations, as we * frequently have to perform multiple relocations within the same
@@ -833,6 +835,10 @@ static int eb_validate_vmas(struct i915_execbuffer *eb)struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma; + err =i915_gem_object_lock (vma->obj, &eb->ww); +if (err) +return err; +if (eb_pin_vma (eb, entry, ev)) {if (entry->offset != vma->node.start) { entry->offset = vma->node.start |UPDATE ;
@@ -1143,7 +1149,7 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)struct drm_i915_gem_object *obj = vma->obj;int err; -i915_vma_lock (vma); +assert_vma_held (vma);if (obj->cache_dirty & ~obj->cache_coherent)i915_gem_clflush_object (obj,0 );
@@ -1153,8 +1159,6 @@ static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma)if (err ==0 ) err =i915_vma_move_to_active (vma, rq,EXEC_OBJECT_WRITE ); -i915_vma_unlock (vma); -return err; }
@@ -1212,11 +1216,10 @@ static int __reloc_gpu_alloc(struct i915_execbuffer *eb,if (err) goto skip_request; -i915_vma_lock (batch); +assert_vma_held (batch); err =i915_request_await_object (rq, batch->obj, false);if (err ==0 ) err =i915_vma_move_to_active (batch, rq,0 ); -i915_vma_unlock (batch);if (err) goto skip_request;
@@ -1709,7 +1712,10 @@ static int eb_lock_and_parse_cmdbuffer(struct i915_execbuffer *eb)if (IS_ERR (pool))return PTR_ERR (pool); - err =eb_parse (eb, pool); + err =i915_gem_object_lock (pool->obj, &eb->ww); +if (!err) + err =eb_parse (eb, pool); +if (err)intel_engine_pool_put (pool);
@@ -1731,6 +1737,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)/* We may process another execbuffer during the unlock... */ eb_release_vmas (eb); +i915_gem_ww_ctx_fini (&eb->ww);mutex_unlock (&dev->struct_mutex);/*
@@ -1757,6 +1764,7 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb) }if (err) {mutex_lock (&dev->struct_mutex); +i915_gem_ww_ctx_init (&eb->ww, true); goto out; }
@@ -1768,8 +1776,10 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)mutex_lock (&dev->struct_mutex); goto out; } +i915_gem_ww_ctx_init (&eb->ww, true);/* reacquire the objects */ +repeat_validate: err =eb_validate_vmas (eb);if (err) goto err;
@@ -1802,6 +1812,13 @@ static noinline int eb_relocate_slow(struct i915_execbuffer *eb)*/ err: +if (err == -EDEADLK ) { +eb_release_vmas (eb); + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (!err) + goto repeat_validate; + } +if (err == -EAGAIN ) goto repeat;
@@ -1834,10 +1851,19 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)if (err)return err; +retry: err =eb_validate_vmas (eb);if (!err) err =eb_lock_and_parse_cmdbuffer (eb); -if (err) + +if (err == -EDEADLK ) { + err =i915_gem_ww_ctx_backoff (&eb->ww); +if (err) +return err; + + goto retry; + } +else if (err) goto slow;/* The objects are in their final locations, apply the relocations. */
@@ -1853,43 +1879,26 @@ static int eb_relocate_and_parse_cmdbuf(struct i915_execbuffer *eb)return 0 ; slow: -return eb_relocate_slow (eb); + err =eb_relocate_slow (eb); +if (err) +/* +* If the user expects the execobject.offset and +* reloc.presumed_offset to be an exact match, +* as for using NO_RELOC, then we cannot update +* the execobject.offset until we have completed +* relocation. +*/ + eb->args->flags &= ~__EXEC_HAS_RELOC; + +return err; }static int eb_move_to_gpu (struct i915_execbuffer *eb) {const unsigned int count = eb->buffer_count; -struct ww_acquire_ctx acquire; -unsigned int i; +unsigned int i = count;int err =0 ; -ww_acquire_init (&acquire, &reservation_ww_class); - -for (i =0 ; i < count; i++) { -struct eb_vma *ev = &eb->vma[i]; -struct i915_vma *vma = ev->vma; - - err =ww_mutex_lock_interruptible (&vma->resv->lock, &acquire); -if (err == -EDEADLK ) { -GEM_BUG_ON (i ==0 ); -do { -int j = i -1 ; - -ww_mutex_unlock (&eb->vma[j].vma->resv->lock); - -swap (eb->vma[i], eb->vma[j]); - }while (--i); - - err =ww_mutex_lock_slow_interruptible (&vma->resv->lock, - &acquire); - } -if (err == -EALREADY ) - err =0 ; -if (err) -break ; - } -ww_acquire_done (&acquire); -while (i--) {struct eb_vma *ev = &eb->vma[i];struct i915_vma *vma = ev->vma;
@@ -1934,15 +1943,12 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)if (err ==0 ) err =i915_vma_move_to_active (vma, eb->request, flags); -i915_vma_unlock (vma); -__eb_unreserve_vma (vma, flags);if (unlikely (flags & __EXEC_OBJECT_HAS_REF))i915_vma_put (vma); ev->vma =NULL ; } -ww_acquire_fini (&acquire);if (unlikely (err)) goto err_skip;
@@ -2592,11 +2598,14 @@ i915_gem_do_execbuffer(struct drm_device *dev, err =mutex_lock_interruptible (&dev->struct_mutex);if (err) goto err_engine; +i915_gem_ww_ctx_init (&eb.ww, true); err =eb_relocate_and_parse_cmdbuf (&eb);if (err) goto err_vma; +ww_acquire_done (&eb.ww.ctx); +/* * snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure * batch" bit. Hence we need to pin secure batches into the global gtt.
@@ -2701,6 +2710,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, err_vma:if (eb.exec)eb_release_vmas (&eb); +i915_gem_ww_ctx_fini (&eb.ww);mutex_unlock (&dev->struct_mutex); err_engine:eb_unpin_engine (&eb);
drivers/gpu/drm/i915/i915_cmd_parser.c +1 -14
@@ -1136,31 +1136,19 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,void *dst, *src;int ret; - ret =i915_gem_object_lock_interruptible (dst_obj,NULL ); + ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush);if (ret)return ERR_PTR (ret); - ret =i915_gem_object_prepare_write (dst_obj, &dst_needs_clflush); -if (ret) { -i915_gem_object_unlock (dst_obj); -return ERR_PTR (ret); - } - dst =i915_gem_object_pin_map (dst_obj,I915_MAP_FORCE_WB );i915_gem_object_finish_access (dst_obj); -i915_gem_object_unlock (dst_obj);if (IS_ERR (dst))return dst; - ret =i915_gem_object_lock_interruptible (src_obj,NULL ); -if (ret) -return ERR_PTR (ret); - ret =i915_gem_object_prepare_read (src_obj, &src_needs_clflush);if (ret) {i915_gem_object_unpin_map (dst_obj); -i915_gem_object_unlock (src_obj);return ERR_PTR (ret); }
@@ -1209,7 +1197,6 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj, }i915_gem_object_finish_access (src_obj); -i915_gem_object_unlock (src_obj);/* dst_obj is returned with vmap pinned */ *needs_clflush_after = dst_needs_clflush &CLFLUSH_AFTER ;
Signature · 6 lines
2.24.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/execbuf: Add support for parallel execbuf submission. (rev2)
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915/execbuf: Add support for parallel execbuf submission. (rev2)
URL : https://patchwork.freedesktop.org/series/70680/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h AR drivers/gpu/drm/i915/built-in.a CC [M] drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c: In function ‘i915_gem_do_execbuffer’:drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:2715:1: error: label ‘err_unpin’ defined but not used [-Werror=unused-label]
err_unpin:
^~~~~~~~~drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c:2596:3: error: label ‘err_context’ used but not defined
goto err_context;
^~~~
cc1: all warnings being treated as errorsscripts/Makefile.build:265: recipe for target 'drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o' failed make[4]: *** [drivers/gpu/drm/i915/gem/i915_gem_execbuffer.o] Error 1scripts/Makefile.build:503: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:503: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:503: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1692: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/execbuf: Add support for parallel execbuf submission. (rev3)
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: drm/i915/execbuf: Add support for parallel execbuf submission. (rev3)
URL : https://patchwork.freedesktop.org/series/70680/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7540 -> Patchwork_15687
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_15687 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_15687, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_15687:
### IGT changes ###
#### Possible regressions ####
* igt@gem_busy@busy-all:
- fi-bsw-kefka: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bsw-kefka/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bsw-kefka/igt@[email protected]
- fi-bsw-n3050: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bsw-n3050/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bsw-n3050/igt@[email protected]
- fi-ilk-650: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-ilk-650/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-ilk-650/igt@[email protected]
- fi-bsw-nick: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bsw-nick/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bsw-nick/igt@[email protected]
- fi-blb-e6850: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-blb-e6850/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-blb-e6850/igt@[email protected]
* igt@gem_close_race@basic-process:
- fi-bwr-2160: [PASS][11] -> [TIMEOUT][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bwr-2160/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bwr-2160/igt@[email protected]
* igt@gem_exec_gttfill@basic:
- fi-kbl-x1275: [PASS][13] -> [DMESG-FAIL][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-x1275/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-x1275/igt@[email protected]
- fi-icl-u3: [PASS][15] -> [DMESG-WARN][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-icl-u3/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-icl-u3/igt@[email protected]
- fi-tgl-y: NOTRUN -> [DMESG-WARN][17]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-tgl-y/igt@[email protected]
- fi-kbl-8809g: [PASS][18] -> [DMESG-FAIL][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-8809g/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-8809g/igt@[email protected]
- fi-icl-y: [PASS][20] -> [DMESG-WARN][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-icl-y/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-icl-y/igt@[email protected]
- fi-hsw-4770: [PASS][22] -> [DMESG-WARN][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-4770/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-4770/igt@[email protected]
- fi-kbl-7500u: [PASS][24] -> [FAIL][25] +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-7500u/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-7500u/igt@[email protected]
- fi-kbl-guc: [PASS][26] -> [DMESG-FAIL][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-guc/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-guc/igt@[email protected]
- fi-cml-u2: [PASS][28] -> [DMESG-FAIL][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-cml-u2/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cml-u2/igt@[email protected]
- fi-skl-6600u: [PASS][30] -> [DMESG-FAIL][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-skl-6600u/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-skl-6600u/igt@[email protected]
- fi-ivb-3770: [PASS][32] -> [DMESG-WARN][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-ivb-3770/igt@[email protected]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-ivb-3770/igt@[email protected]
- fi-skl-lmem: [PASS][34] -> [DMESG-FAIL][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-skl-lmem/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-skl-lmem/igt@[email protected]
- fi-cml-s: [PASS][36] -> [DMESG-FAIL][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-cml-s/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cml-s/igt@[email protected]
- fi-skl-6770hq: [PASS][38] -> [DMESG-FAIL][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-skl-6770hq/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-skl-6770hq/igt@[email protected]
- fi-skl-6700k2: [PASS][40] -> [DMESG-FAIL][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-skl-6700k2/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-skl-6700k2/igt@[email protected]
- fi-snb-2600: [PASS][42] -> [DMESG-WARN][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-snb-2600/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-snb-2600/igt@[email protected]
- fi-hsw-4770r: [PASS][44] -> [DMESG-WARN][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-4770r/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-4770r/igt@[email protected]
- fi-kbl-r: [PASS][46] -> [DMESG-FAIL][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-r/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-r/igt@[email protected]
- fi-bdw-5557u: [PASS][48] -> [DMESG-WARN][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bdw-5557u/igt@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bdw-5557u/igt@[email protected]
- fi-skl-guc: [PASS][50] -> [DMESG-FAIL][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-skl-guc/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-skl-guc/igt@[email protected]
- fi-cfl-8700k: [PASS][52] -> [DMESG-FAIL][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-cfl-8700k/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cfl-8700k/igt@[email protected]
- fi-whl-u: [PASS][54] -> [DMESG-FAIL][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-whl-u/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-whl-u/igt@[email protected]
- fi-icl-u2: [PASS][56] -> [DMESG-WARN][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-icl-u2/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-icl-u2/igt@[email protected]
- fi-snb-2520m: [PASS][58] -> [DMESG-WARN][59]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-snb-2520m/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-snb-2520m/igt@[email protected]
- fi-cfl-guc: [PASS][60] -> [DMESG-FAIL][61]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-cfl-guc/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cfl-guc/igt@[email protected]
- fi-icl-guc: [PASS][62] -> [DMESG-WARN][63]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-icl-guc/igt@[email protected]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-icl-guc/igt@[email protected]
* igt@gem_exec_parallel@basic:
- fi-kbl-soraka: [PASS][64] -> [FAIL][65]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-soraka/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-soraka/igt@[email protected]
* igt@gem_exec_parse@basic-allowed:
- fi-hsw-peppy: [PASS][66] -> [DMESG-WARN][67]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-peppy/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-peppy/igt@[email protected]
* igt@gem_exec_store@basic-all:
- fi-kbl-soraka: [PASS][68] -> [DMESG-WARN][69]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-soraka/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-soraka/igt@[email protected]
- fi-kbl-7500u: [PASS][70] -> [DMESG-WARN][71]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-kbl-7500u/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-7500u/igt@[email protected]
* igt@gem_render_linear_blits@basic:
- fi-hsw-peppy: [PASS][72] -> [FAIL][73] +3 similar issues
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-peppy/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-peppy/igt@[email protected]
* igt@i915_selftest@live_gem:
- fi-hsw-peppy: [PASS][74] -> [INCOMPLETE][75]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-peppy/igt@i915_selftest@live_gem.html
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-peppy/igt@i915_selftest@live_gem.html
* igt@prime_vgem@basic-read:
- fi-hsw-peppy: [PASS][76] -> [TIMEOUT][77] +1 similar issue
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-hsw-peppy/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-peppy/igt@[email protected]
* igt@runner@aborted:
- fi-snb-2520m: NOTRUN -> [FAIL][78]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-snb-2520m/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [FAIL][79]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-soraka/igt@[email protected]
- fi-hsw-4770: NOTRUN -> [FAIL][80]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-4770/igt@[email protected]
- fi-kbl-7500u: NOTRUN -> [FAIL][81]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-7500u/igt@[email protected]
- fi-whl-u: NOTRUN -> [FAIL][82]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-whl-u/igt@[email protected]
- fi-ivb-3770: NOTRUN -> [FAIL][83]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-ivb-3770/igt@[email protected]
- fi-cfl-guc: NOTRUN -> [FAIL][84]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cfl-guc/igt@[email protected]
- fi-kbl-x1275: NOTRUN -> [FAIL][85]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-x1275/igt@[email protected]
- fi-cfl-8700k: NOTRUN -> [FAIL][86]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cfl-8700k/igt@[email protected]
- fi-hsw-4770r: NOTRUN -> [FAIL][87]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-hsw-4770r/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [FAIL][88]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-8809g/igt@[email protected]
- fi-kbl-r: NOTRUN -> [FAIL][89]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-r/igt@[email protected]
- fi-kbl-guc: NOTRUN -> [FAIL][90]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-kbl-guc/igt@[email protected]
- fi-snb-2600: NOTRUN -> [FAIL][91]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-snb-2600/igt@[email protected]
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.
* igt@gem_exec_gttfill@basic:
- {fi-tgl-guc}: [PASS][92] -> [DMESG-WARN][93]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-tgl-guc/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-tgl-guc/igt@[email protected]
- {fi-tgl-u}: [PASS][94] -> [DMESG-WARN][95]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-tgl-u/igt@[email protected]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-tgl-u/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_15687 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_busy@busy-all:
- fi-glk-dsi: [PASS][96] -> [INCOMPLETE][97] ([i915#58] / [k.org#198133])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-glk-dsi/igt@[email protected]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-glk-dsi/igt@[email protected]
- fi-bxt-dsi: [PASS][98] -> [INCOMPLETE][99] ([fdo#103927])
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-bxt-dsi/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-bxt-dsi/igt@[email protected]
- fi-byt-n2820: [PASS][100] -> [INCOMPLETE][101] ([i915#45])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-byt-n2820/igt@[email protected]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-byt-n2820/igt@[email protected]
- fi-pnv-d510: [PASS][102] -> [INCOMPLETE][103] ([i915#299])
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-pnv-d510/igt@[email protected]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-pnv-d510/igt@[email protected]
- fi-apl-guc: [PASS][104] -> [INCOMPLETE][105] ([fdo#103927])
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-apl-guc/igt@[email protected]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-apl-guc/igt@[email protected]
- fi-elk-e7500: [PASS][106] -> [INCOMPLETE][107] ([i915#66])
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-elk-e7500/igt@[email protected]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-elk-e7500/igt@[email protected]
- fi-byt-j1900: [PASS][108] -> [INCOMPLETE][109] ([i915#45])
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-byt-j1900/igt@[email protected]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-byt-j1900/igt@[email protected]
* igt@gem_close_race@basic-process:
- fi-gdg-551: [PASS][110] -> [INCOMPLETE][111] ([i915#172])
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-gdg-551/igt@[email protected]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-gdg-551/igt@[email protected]
#### Warnings ####
* igt@runner@aborted:
- fi-icl-guc: [FAIL][112] ([fdo#110943] / [fdo#111093]) -> [FAIL][113] ([fdo#111093])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-icl-guc/igt@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-icl-guc/igt@[email protected]
- fi-cml-s: [FAIL][114] ([fdo#111764] / [i915#577]) -> [FAIL][115] ([i915#577])
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7540/fi-cml-s/igt@[email protected]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/fi-cml-s/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#110943]: https://bugs.freedesktop.org/show_bug.cgi?id=110943
[fdo#111093]: https://bugs.freedesktop.org/show_bug.cgi?id=111093
[fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764
[i915#172]: https://gitlab.freedesktop.org/drm/intel/issues/172
[i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299
[i915#45]: https://gitlab.freedesktop.org/drm/intel/issues/45
[i915#577]: https://gitlab.freedesktop.org/drm/intel/issues/577
[i915#58]: https://gitlab.freedesktop.org/drm/intel/issues/58
[i915#66]: https://gitlab.freedesktop.org/drm/intel/issues/66
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133
Participating hosts (53 -> 47)
------------------------------
Additional (1): fi-tgl-y
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7540 -> Patchwork_15687
CI-20190529: 20190529
CI_DRM_7540: f7af732973915f9e52e939c0a8046f2eb8c6db63 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5343: e3664f8ce1f9152712b32e9bfa1e4ec93ffa5349 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15687: 634cda0e5b2f94cd6add0e09ba56df034c8f0078 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
634cda0e5b2f drm/i915: Use per object locking in execbuf on top of struct_mutex, v2. e4af2a8a5e01 drm/i915: Parse command buffer earlier in eb_relocate(slow) 3b3becae13ec drm/i915: Separate lookup and pinning in execbuf. 092396daf708 drm/i915: Remove locking from i915_gem_object_prepare_read/write 6ad08d5f7b69 drm/i915: Add an implementation for i915_gem_ww_ctx locking, v2. ebc0f514e06f drm/i915/gem: Extract transient execbuf flags from i915_vma 286cec44d90b drm/i915: Drop inspection of execbuf flags during evict
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15687/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx