drm/i915: WARN_ON failed map_and_fenceable
Subsystems (3)
PATCH 1/5 drm/i915: WARN_ON failed map_and_fenceable
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
--- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +2 -0
@@ -3186,6 +3186,8 @@ search_free:if (i915_is_ggtt (vm)) obj->map_and_fenceable = mappable && fenceable; +WARN_ON (map_and_fenceable & !obj->map_and_fenceable); +trace_i915_vma_bind (vma, map_and_fenceable);i915_gem_verify_gtt (dev);return 0 ;
Signature · 1 line
1.8.3.4
PATCH 2/5 drm/i915: bind m&f cleanup
Cleanup the map and fenceable setting during bind to make more sense, and not check i915_is_ggtt() 2 unnecessary times
--- drivers/gpu/drm/i915/i915_gem.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +7 -9
@@ -3173,18 +3173,16 @@ search_free:list_move_tail (&obj->global_list, &dev_priv->mm.bound_list);list_add_tail (&vma->mm_list, &vm->inactive_list); - fenceable = -i915_is_ggtt (vm) && -i915_gem_obj_ggtt_size (obj) == fence_size && - (i915_gem_obj_ggtt_offset (obj) & (fence_alignment -1 )) ==0 ; +if (i915_is_ggtt (vm)) { + fenceable = +i915_gem_obj_ggtt_size (obj) == fence_size && + (i915_gem_obj_ggtt_offset (obj) & (fence_alignment -1 )) ==0 ; - mappable = -i915_is_ggtt (vm) && - vma->node.start + obj->base.size <= dev_priv->gtt.mappable_end; + mappable = + vma->node.start + obj->base.size <= dev_priv->gtt.mappable_end; -/* Map and fenceable only changes if the VM is the global GGTT */ -if (i915_is_ggtt (vm)) obj->map_and_fenceable = mappable && fenceable; + }WARN_ON (map_and_fenceable & !obj->map_and_fenceable);
Signature · 1 line
1.8.3.4
Re: [PATCH 2/5] drm/i915: bind m&f cleanup
Quoted 5 lines · Ben Widawsky
Cleanup the map and fenceable setting during bind to make more sense, and not check
i915_is_ggtt()2 unnecessary timesRecommended-by Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
There were a couple of bools that only exist to make this computation more readable that could be moved to this block.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 2/5] drm/i915: bind m&f cleanup
Quoted 11 lines · Chris Wilson
Quoted 5 lines · Ben Widawsky
Cleanup the map and fenceable setting during bind to make more sense, and not check
i915_is_ggtt()2 unnecessary timesRecommended-by Chris Wilson <[email protected]>Signed-off-by Ben Widawsky <[email protected]>There were a couple of bools that only exist to make this computation more readable that could be moved to this block.
-Chris
I saw these. The cleanup is somewhat involved, so I punted on it. I'll implement it now, but I expect you to review it.
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
PATCH 3/5 drm/i915: Remove node only when allocated
In reply to Ben WidawskyIn upcoming code, it will be possible for a vma to have been created, but no space reserved for it in the address space. The drm_mm semantics are such that trying to remove an unallocated node is not allowed.
--- drivers/gpu/drm/i915/i915_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +2 -1
@@ -2629,7 +2629,8 @@ int i915_vma_unbind(struct i915_vma *vma)if (i915_is_ggtt (vma->vm)) obj->map_and_fenceable = true; -drm_mm_remove_node (&vma->node); +if (drm_mm_node_allocated (&vma->node)) +drm_mm_remove_node (&vma->node);i915_gem_vma_destroy (vma);/* Since the unbound list is global, only move to that list if
Signature · 1 line
1.8.3.4
Re: [PATCH 3/5] drm/i915: Remove node only when allocated
Quoted 3 lines · Ben Widawsky
In upcoming code, it will be possible for a vma to have been created, but no space reserved for it in the address space. The
drm_mmsemantics are such that trying to remove an unallocated node is not allowed.
But not allocated during unbind, i.e. calling unbind() before bind()? That seems scary enough.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 3/5] drm/i915: Remove node only when allocated
Quoted 9 lines · Chris Wilson
Quoted 3 lines · Ben Widawsky
In upcoming code, it will be possible for a vma to have been created, but no space reserved for it in the address space. The
drm_mmsemantics are such that trying to remove an unallocated node is not allowed.But not allocated during unbind, i.e. calling
unbind()beforebind()? That seems scary enough.
-Chris
The condition can occur if we create a vma, fail to bind it, and then free up the object (which tries to unbind). As I alluded to, this cannot happen until we do the execbufer vma creation.
The example for which is can happen is if we have some object created, with a vma
AFAICT, this condition cannot occur until we actually are using multiple VMs, but once we are the following can occur:
object X created for context Y
VMA-Y created for object X
VMA-Z created for object X, but fails before or during bind
VMA-Z persists
object X destroyed
free calls unbind on all VMAs. VMA-Z has no node allocated for it.
One way to may this better is to not call unbind() if it isn't allocated, and simply call vma_destroy(). I don't really care. You tell me what you want.
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
PATCH 4/5 drm: WARN when removing unallocated node
In reply to Ben WidawskyThe conditional is usually a recoverable driver bug, and so WARNing, and preventing the drm_mm code from doing potential damage (BUG) is desirable.
This issue was hit and fixed twice while developing the i915 multiple address space code. The first fix is the patch just before this, and is hit on an not frequently occuring error path. Another was fixed during patch iteration, so it's hard to see from the patch:
commit c6cfb325677ea6305fb19acf3a4d14ea267f923e
Author: Ben Widawsky <[email protected]> Date: Fri Jul 5 14:41:06 2013 -0700
drm/i915: Embed drm_mm_node in i915 gem obj
Quoted 1 line
From the intel-gfx mailing list, we discussed this:
References: <[email protected]>
--- drivers/gpu/drm/drm_mm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_mm.c +3 -0
@@ -254,6 +254,9 @@ void drm_mm_remove_node(struct drm_mm_node *node)struct drm_mm *mm = node->mm;struct drm_mm_node *prev_node; +if (WARN_ON (!node->allocated)) +return ; +BUG_ON (node->scanned_block || node->scanned_prev_free || node->scanned_next_free);
Signature · 1 line
1.8.3.4
Re: [PATCH 4/5] drm: WARN when removing unallocated node
Quoted 13 lines · Ben Widawsky
The conditional is usually a recoverable driver bug, and so WARNing, and preventing the
drm_mmcode from doing potential damage (BUG) is desirable.This issue was hit and fixed twice while developing the i915 multiple address space code. The first fix is the patch just before this, and is hit on an not frequently occuring error path. Another was fixed during patch iteration, so it's hard to see from the patch:
commit
c6cfb325677ea6305fb19acf3a4d14ea267f923eAuthor: Ben Widawsky <[email protected]> Date: Fri Jul 5 14:41:06 2013 -0700
Quoted 8 lines
drm/i915: Embed
drm_mm_nodein i915 gem objFrom the intel-gfx mailing list, we discussed this:
References: <[email protected]>Cc Dave Airlie <[email protected]>CC <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
On the other hand, if we end up with a proliferation of
if (drm_mm_node_allocated(node))
drm_mm_remove_node(node)
in the drivers, putting the guard into remove_node is preferrable. At the moment we only have the one error path in i915.ko where we need to double check so it is not much of a concern.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 5/5 drm/i915: Convert execbuf code to use vmas
In reply to Ben WidawskyFrom: Ben Widawsky <[email protected]>
In order to transition more of our code over to using a VMA instead of an <OBJ, VM> pair - we must have the vma accessible at execbuf time. Up until now, we've only had a VMA when actually binding an object.
The previous patch helped handle the distinction on bound vs. unbound. This patch will help us catch leaks, and other issues before we actually shuffle a bunch of stuff around.
This attempts to convert all the execbuf code to speak in vmas. Since the execbuf code is very self contained it was a nice isolated conversion.
The meat of the code is about turning eb_objects into eb_vma, and then wiring up the rest of the code to use vmas instead of obj, vm pairs.
Unfortunately, to do this, we must move the exec_list link from the obj structure. This list is reused in the eviction code, so we must also modify the eviction code to make this work.
v2: Release table lock early, and two a 2 phase vma lookup to avoid having to use a GFP_ATOMIC. (Chris)
v3: s/obj_exec_list/obj_exec_link/
Updates to address
commit 6d2b888569d366beb4be72cacfde41adee2c25e1
Author: Chris Wilson <[email protected]> Date: Wed Aug 7 18:30:54 2013 +0100
drm/i915: List objects allocated from stolen memory in debugfs
--- drivers/gpu/drm/i915/i915_debugfs.c | 12 +- drivers/gpu/drm/i915/i915_drv.h | 25 ++- drivers/gpu/drm/i915/i915_gem.c | 28 ++- drivers/gpu/drm/i915/i915_gem_evict.c | 31 ++- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 328 ++++++++++++++++------------- 5 files changed, 235 insertions(+), 189 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +6 -6
@@ -193,9 +193,9 @@ static int obj_rank_by_stolen(void *priv, struct list_head *A, struct list_head *B) { struct drm_i915_gem_object *a = - container_of(A, struct drm_i915_gem_object, exec_list); + container_of(A, struct drm_i915_gem_object, obj_exec_link);struct drm_i915_gem_object *b = - container_of(B, struct drm_i915_gem_object, exec_list); + container_of(B, struct drm_i915_gem_object, obj_exec_link);return a->stolen->start - b->stolen->start; }
@@ -219,7 +219,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)if (obj->stolen ==NULL )continue ; -list_add (&obj->exec_list, &stolen); +list_add (&obj->obj_exec_link, &stolen); total_obj_size += obj->base.size; total_gtt_size +=i915_gem_obj_ggtt_size (obj);
@@ -229,7 +229,7 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)if (obj->stolen ==NULL )continue ; -list_add (&obj->exec_list, &stolen); +list_add (&obj->obj_exec_link, &stolen); total_obj_size += obj->base.size; count++;
@@ -237,11 +237,11 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data)list_sort (NULL , &stolen, obj_rank_by_stolen);seq_puts (m,"Stolen:\n" );while (!list_empty (&stolen)) { - obj =list_first_entry (&stolen,typeof (*obj), exec_list); + obj =list_first_entry (&stolen,typeof (*obj), obj_exec_link);seq_puts (m," " );describe_obj (m, obj);seq_putc (m,'\n' ); -list_del_init (&obj->exec_list); +list_del_init (&obj->obj_exec_link); }mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/i915/i915_drv.h +16 -9
@@ -562,6 +562,17 @@ struct i915_vma {struct list_head mm_list;struct list_head vma_link;/* Link in the object's VMA list */ + +/** This vma's place in the batchbuffer or on the eviction list */ +struct list_head exec_list; + +/** +* Used for performing relocations during execbuffer insertion. +*/ +struct hlist_node exec_node; +unsigned long exec_handle; +struct drm_i915_gem_exec_object2 *exec_entry; + };struct i915_ctx_hang_stats {
@@ -1311,8 +1322,8 @@ struct drm_i915_gem_object {struct list_head global_list;struct list_head ring_list; -/** This object's place in the batchbuffer or on the eviction list */ -struct list_head exec_list; +/** Used in execbuf to temporarily hold a ref */ +struct list_head obj_exec_link;/** * This is set if the object is on the active lists (has pending
@@ -1397,13 +1408,6 @@ struct drm_i915_gem_object {void *dma_buf_vmapping;int vmapping_count; -/** -* Used for performing relocations during execbuffer insertion. -*/ -struct hlist_node exec_node; -unsigned long exec_handle; -struct drm_i915_gem_exec_object2 *exec_entry; -struct intel_ring_buffer *ring;/** Breadcrumb of last rendering to the buffer. */
@@ -1901,6 +1905,9 @@ unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o, struct i915_address_space *vm);struct i915_vma *i915_gem_obj_to_vma (struct drm_i915_gem_object *obj,struct i915_address_space *vm); +struct i915_vma * +i915_gem_obj_lookup_or_create_vma (struct drm_i915_gem_object *obj, +struct i915_address_space *vm);/* Some GGTT VM helpers */ #define obj_to_ggtt (obj) \ (&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
drivers/gpu/drm/i915/i915_gem.c +20 -8
@@ -3095,8 +3095,7 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,struct i915_vma *vma;int ret; -if (WARN_ON (!list_empty (&obj->vma_list))) -return -EBUSY ; +BUG_ON (!i915_is_ggtt (vm)); fence_size = i915_gem_get_gtt_size(dev, obj->base.size,
@@ -3136,16 +3135,15 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj,i915_gem_object_pin_pages (obj); -/* FIXME: For now we only ever use 1 VMA per object */ -BUG_ON (!i915_is_ggtt (vm)); -WARN_ON (!list_empty (&obj->vma_list)); - - vma =i915_gem_vma_create (obj, vm); + vma =i915_gem_obj_lookup_or_create_vma (obj, vm);if (IS_ERR (vma)) { ret =PTR_ERR (vma); goto err_unpin; } +/* For now we only ever use 1 vma per object */ +WARN_ON (!list_is_singular (&obj->vma_list)); + search_free: ret = drm_mm_insert_node_in_range_generic(&vm->mm, &vma->node, size, alignment,
@@ -3913,7 +3911,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj, {INIT_LIST_HEAD (&obj->global_list);INIT_LIST_HEAD (&obj->ring_list); -INIT_LIST_HEAD (&obj->exec_list); +INIT_LIST_HEAD (&obj->obj_exec_link);INIT_LIST_HEAD (&obj->vma_list); obj->ops = ops;
@@ -4053,6 +4051,7 @@ struct i915_vma *i915_gem_vma_create(struct drm_i915_gem_object *obj,INIT_LIST_HEAD (&vma->vma_link);INIT_LIST_HEAD (&vma->mm_list); +INIT_LIST_HEAD (&vma->exec_list); vma->vm = vm; vma->obj = obj;
@@ -4802,3 +4801,16 @@ struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj,return NULL ; } + +struct i915_vma * +i915_gem_obj_lookup_or_create_vma (struct drm_i915_gem_object *obj, +struct i915_address_space *vm) +{ +struct i915_vma *vma; + + vma =i915_gem_obj_to_vma (obj, vm); +if (!vma) + vma =i915_gem_vma_create (obj, vm); + +return vma; +}
drivers/gpu/drm/i915/i915_gem_evict.c +14 -17
@@ -37,7 +37,7 @@ mark_free(struct i915_vma *vma, struct list_head *unwind)if (vma->obj->pin_count)return false; -list_add (&vma->obj->exec_list, unwind); +list_add (&vma->exec_list, unwind);return drm_mm_scan_add_block (&vma->node); }
@@ -49,7 +49,6 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,drm_i915_private_t *dev_priv = dev->dev_private;struct list_head eviction_list, unwind_list;struct i915_vma *vma; -struct drm_i915_gem_object *obj;int ret =0 ;trace_i915_gem_evict (dev, min_size, alignment, mappable);
@@ -104,14 +103,13 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, none:/* Nothing found, clean up and bail out! */ while (!list_empty (&unwind_list)) { - obj =list_first_entry (&unwind_list, - struct drm_i915_gem_object, + vma =list_first_entry (&unwind_list, + struct i915_vma, exec_list); - vma =i915_gem_obj_to_vma (obj, vm); ret =drm_mm_scan_remove_block (&vma->node);BUG_ON (ret); -list_del_init (&obj->exec_list); +list_del_init (&vma->exec_list); }/* We expect the caller to unpin, evict all and try again, or give up.
@@ -125,28 +123,27 @@ found:* temporary list. */ INIT_LIST_HEAD (&eviction_list);while (!list_empty (&unwind_list)) { - obj =list_first_entry (&unwind_list, - struct drm_i915_gem_object, + vma =list_first_entry (&unwind_list, + struct i915_vma, exec_list); - vma =i915_gem_obj_to_vma (obj, vm);if (drm_mm_scan_remove_block (&vma->node)) { -list_move (&obj->exec_list, &eviction_list); -drm_gem_object_reference (&obj->base); +list_move (&vma->exec_list, &eviction_list); +drm_gem_object_reference (&vma->obj->base);continue ; } -list_del_init (&obj->exec_list); +list_del_init (&vma->exec_list); }/* Unbinding will emit any required flushes */ while (!list_empty (&eviction_list)) { - obj =list_first_entry (&eviction_list, - struct drm_i915_gem_object, + vma =list_first_entry (&eviction_list, + struct i915_vma, exec_list);if (ret ==0 ) - ret =i915_vma_unbind (i915_gem_obj_to_vma (obj, vm)); + ret =i915_vma_unbind (vma); -list_del_init (&obj->exec_list); -drm_gem_object_unreference (&obj->base); +list_del_init (&vma->exec_list); +drm_gem_object_unreference (&vma->obj->base); }return ret;
drivers/gpu/drm/i915/i915_gem_execbuffer.c +179 -149
665 lines not on this page · raw message
Signature · 1 line
1.8.3.4
Re: [PATCH 5/5] drm/i915: Convert execbuf code to use vmas
drivers/gpu/drm/i915/i915_gem_execbuffer.c i915_gem_execbuffer_relocate(struct eb_objects *eb, · line 430
Quoted 9 lines · Ben Widawsky
static int
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3
-3-need_reloc_mappable(struct drm_i915_gem_object *obj) +need_reloc_mappable(struct i915_vma *vma) { -struct drm_i915_gem_exec_object2 *entry = obj->exec_entry; -return entry->relocation_count && !use_cpu_reloc (obj); +struct drm_i915_gem_exec_object2 *entry = vma->exec_entry; +return entry->relocation_count && !use_cpu_reloc (vma->obj); }
need_reloc_mappable() should return false if ppgtt. If we need to use a GTT reloc that will setup a separate ggtt entry i.e. it doesn't influence the decision during reservation.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 5/5] drm/i915: Convert execbuf code to use vmas
In reply to Ben WidawskyQuoted 27 lines · Ben Widawsky
From: Ben Widawsky <[email protected]>
In order to transition more of our code over to using a VMA instead of an <OBJ, VM> pair - we must have the vma accessible at execbuf time. Up until now, we've only had a VMA when actually binding an object.
The previous patch helped handle the distinction on bound vs. unbound. This patch will help us catch leaks, and other issues before we actually shuffle a bunch of stuff around.
This attempts to convert all the execbuf code to speak in vmas. Since the execbuf code is very self contained it was a nice isolated conversion.
The meat of the code is about turning
eb_objectsintoeb_vma, and then wiring up the rest of the code to use vmas instead of obj, vm pairs.Unfortunately, to do this, we must move the
exec_listlink from the obj structure. This list is reused in the eviction code, so we must also modify the eviction code to make this work.v2: Release table lock early, and two a 2 phase vma lookup to avoid having to use a
GFP_ATOMIC. (Chris)v3: s/obj_exec_list/obj_exec_link/
Updates to address
commit6d2b888569d366beb4be72cacfde41adee2c25e1
Quoted 6 lines
Author: Chris Wilson <[email protected]> Date: Wed Aug 7 18:30:54 2013 +0100drm/i915: List objects allocated from stolen memory in debugfs
Signed-off-by Ben Widawsky <[email protected]>
One thing to check&confirm is that any differences in gem_exec_lut_handle are within the noise.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 5/5] drm/i915: Convert execbuf code to use vmas
In reply to Ben WidawskyQuoted 14 lines · Ben Widawsky
static int
i915_gem_execbuffer_move_to_gpu(structintel_ring_buffer*ring,drivers/gpu/drm/i915/i915_gem_execbuffer.c +4
-4- struct list_head *objects) + struct list_head *vmas) { -struct drm_i915_gem_object *obj; +struct i915_vma *vma;uint32_t flush_domains =0 ;int ret; -list_for_each_entry (obj, objects, exec_list) { - ret =i915_gem_object_sync (obj, ring); +list_for_each_entry (vma, vmas, exec_list) { + ret =i915_gem_object_sync (vma->obj, ring);
drivers/gpu/drm/i915/i915_gem_execbuffer.c err: · line 753
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +3
-3if (ret)return ret; -if (obj->base.write_domain &I915_GEM_DOMAIN_CPU ) -i915_gem_clflush_object (obj); +if (vma->obj->base.write_domain &I915_GEM_DOMAIN_CPU ) +i915_gem_clflush_object (vma->obj); - flush_domains |= obj->base.write_domain; + flush_domains |= vma->obj->base.write_domain;
This, and a few more places, will be neater with a local struct drm_i915_gem_object *obj = vma->obj; -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 5/5] drm/i915: Convert execbuf code to use vmas
Quoted 23 lines · Chris Wilson
Quoted 22 lines · Ben Widawsky
static int
i915_gem_execbuffer_move_to_gpu(structintel_ring_buffer*ring,drivers/gpu/drm/i915/i915_gem_execbuffer.c +6
-6- struct list_head *objects) + struct list_head *vmas) { -struct drm_i915_gem_object *obj; +struct i915_vma *vma;uint32_t flush_domains =0 ;int ret; -list_for_each_entry (obj, objects, exec_list) { - ret =i915_gem_object_sync (obj, ring); +list_for_each_entry (vma, vmas, exec_list) { + ret =i915_gem_object_sync (vma->obj, ring);if (ret)return ret; -if (obj->base.write_domain &I915_GEM_DOMAIN_CPU ) -i915_gem_clflush_object (obj); +if (vma->obj->base.write_domain &I915_GEM_DOMAIN_CPU ) +i915_gem_clflush_object (vma->obj);
Quoted 7 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c err: · line 753
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1
-1- flush_domains |= obj->base.write_domain; + flush_domains |= vma->obj->base.write_domain;This, and a few more places, will be neater with a local struct
drm_i915_gem_object*obj =vma->obj; -Chris
I got this and the other fixed you requested for needs_reloc_mappable. I only found one other place that had more than one instance of vma->obj though.
i915_gem_execbuffer_unreserve_vmai915_gem_execbuffer_move_to_gpu
Please let me know if I missed one.
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Quoted 5 lines · Ben Widawsky
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
Signed-off-by Ben Widawsky <[email protected]>
This is BUG() class. A WARN by itself here isn't going to prevent calamity, so cleanup and let userspace die gracefully. The alternative is random hw borkage (hopefully triggering an OOPS before it gets too far).
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 11 lines · Chris Wilson
Quoted 5 lines · Ben Widawsky
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
Signed-off-by Ben Widawsky <[email protected]>This is
BUG()class. A WARN by itself here isn't going to prevent calamity, so cleanup and let userspace die gracefully. The alternative is random hw borkage (hopefully triggering an OOPS before it gets too far).
I think WARN is ok, there should be enough time for it to hit the logs before the evenutal machine death. Generally if a WARN requires us to add more cleanup code it's imo not worth it.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 14 lines · Ben Widawsky
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/i915/i915_gem.c +0
-0
drivers/gpu/drm/i915/i915_gem.c search_free: · line 3189
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -3186,6 +3186,8 @@ search_free:if (i915_is_ggtt (vm)) obj->map_and_fenceable = mappable && fenceable; +WARN_ON (map_and_fenceable & !obj->map_and_fenceable);
s/&/&&/ I think, although since both are bools it doesn't matter correctness-wise.
-Daniel
Quoted 11 lines
drivers/gpu/drm/i915/i915_gem.c +1
-0+trace_i915_vma_bind (vma, map_and_fenceable);i915_gem_verify_gtt (dev);return 0 ;Signature · 6 lines
1.8.3.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Ben Widawsky
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -3186,6 +3186,8 @@ search_free:if (i915_is_ggtt (vm)) obj->map_and_fenceable = mappable && fenceable;
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c search_free: · line 3189
Quoted 1 line
drivers/gpu/drm/i915/i915_gem.c +1
-0+WARN_ON (map_and_fenceable & !obj->map_and_fenceable);s/&/&&/ I think, although since both are bools it doesn't matter correctness-wise.
-Daniel
You're absolutely right. It was a typo. Do you want resubmit, or can you fix while apply?
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Quoted 26 lines · Ben Widawsky
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Ben Widawsky
I just noticed in our code we don't really check the assertion, and given some of the code I am changing in this area, I feel a WARN is very nice to have.
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_gem.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/i915/i915_gem.c +0
-0@@ -3186,6 +3186,8 @@ search_free:if (i915_is_ggtt (vm)) obj->map_and_fenceable = mappable && fenceable;Quoted 6 lines
drivers/gpu/drm/i915/i915_gem.c search_free: · line 3189
Quoted 1 line
drivers/gpu/drm/i915/i915_gem.c +1
-0+WARN_ON (map_and_fenceable & !obj->map_and_fenceable);s/&/&&/ I think, although since both are bools it doesn't matter correctness-wise.
-Daniel
Quoted 2 lines
You're absolutely right. It was a typo. Do you want resubmit, or can you fix while apply?
Fixed and applied, thanks for the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch