dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range()
@ 2019-06-26  9:43 Chris Wilson
  2019-06-26 17:32 ` Daniele Ceraolo Spurio
  2019-06-26 21:28 ` Daniel Vetter
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2019-06-26  9:43 UTC (permalink / raw)
  To: dri-devel; +Cc: Daniel Vetter, intel-gfx

We gracefully handle the caller specifying a zero range, so don't force
them to special case that condition if it naturally falls out of their
setup. What we don't check is if the end < start, so keep that as an
assert for an illegal call.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 9a59865ce574..4581c5387372 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -472,7 +472,7 @@ int drm_mm_insert_node_in_range(struct drm_mm * const mm,
 	u64 remainder_mask;
 	bool once;
 
-	DRM_MM_BUG_ON(range_start >= range_end);
+	DRM_MM_BUG_ON(range_start > range_end);
 
 	if (unlikely(size == 0 || range_end - range_start < size))
 		return -ENOSPC;
-- 
2.20.1

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

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

* Re: [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range()
  2019-06-26  9:43 [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range() Chris Wilson
@ 2019-06-26 17:32 ` Daniele Ceraolo Spurio
  2019-06-26 21:28 ` Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Daniele Ceraolo Spurio @ 2019-06-26 17:32 UTC (permalink / raw)
  To: Chris Wilson, dri-devel; +Cc: Daniel Vetter, intel-gfx



On 6/26/19 2:43 AM, Chris Wilson wrote:
> We gracefully handle the caller specifying a zero range, so don't force
> them to special case that condition if it naturally falls out of their
> setup. What we don't check is if the end < start, so keep that as an
> assert for an illegal call.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

Daniele

>   drivers/gpu/drm/drm_mm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 9a59865ce574..4581c5387372 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -472,7 +472,7 @@ int drm_mm_insert_node_in_range(struct drm_mm * const mm,
>   	u64 remainder_mask;
>   	bool once;
>   
> -	DRM_MM_BUG_ON(range_start >= range_end);
> +	DRM_MM_BUG_ON(range_start > range_end);
>   
>   	if (unlikely(size == 0 || range_end - range_start < size))
>   		return -ENOSPC;
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range()
  2019-06-26  9:43 [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range() Chris Wilson
  2019-06-26 17:32 ` Daniele Ceraolo Spurio
@ 2019-06-26 21:28 ` Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2019-06-26 21:28 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Daniele Ceraolo Spurio, Daniel Vetter, intel-gfx, dri-devel

On Wed, Jun 26, 2019 at 10:43:30AM +0100, Chris Wilson wrote:
> We gracefully handle the caller specifying a zero range, so don't force
> them to special case that condition if it naturally falls out of their
> setup. What we don't check is if the end < start, so keep that as an
> assert for an illegal call.

Maybe spend a few words on why a drm_mm user might want to do that. Sounds
very funky ...
-Daniel

> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_mm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 9a59865ce574..4581c5387372 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -472,7 +472,7 @@ int drm_mm_insert_node_in_range(struct drm_mm * const mm,
>  	u64 remainder_mask;
>  	bool once;
>  
> -	DRM_MM_BUG_ON(range_start >= range_end);
> +	DRM_MM_BUG_ON(range_start > range_end);
>  
>  	if (unlikely(size == 0 || range_end - range_start < size))
>  		return -ENOSPC;
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-26 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-26  9:43 [PATCH] drm: Allow range of 0 for drm_mm_insert_node_in_range() Chris Wilson
2019-06-26 17:32 ` Daniele Ceraolo Spurio
2019-06-26 21:28 ` Daniel Vetter

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