The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Remove deadcode
@ 2024-12-22 17:47 linux
  2024-12-27 11:40 ` Tvrtko Ursulin
  0 siblings, 1 reply; 3+ messages in thread
From: linux @ 2024-12-22 17:47 UTC (permalink / raw)
  To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, intel-gfx
  Cc: airlied, simona, dri-devel, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

i915_active_acquire_for_context() was added in 2020 by
commit 5d9341370f57 ("drm/i915: Export a preallocate variant of
i915_active_acquire()") but has never been used.

The last use of __i915_gem_object_is_lmem() was removed in 2021 by
commit ff20afc4cee7 ("drm/i915: Update error capture code to avoid using
the current vma state")

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 23 -----------------------
 drivers/gpu/drm/i915/gem/i915_gem_lmem.h |  2 --
 drivers/gpu/drm/i915/i915_active.c       | 18 ------------------
 drivers/gpu/drm/i915/i915_active.h       |  1 -
 4 files changed, 44 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
index 3198b64ad7db..388f90784d8a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
@@ -52,29 +52,6 @@ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
 		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
 }
 
-/**
- * __i915_gem_object_is_lmem - Whether the object is resident in
- * lmem while in the fence signaling critical path.
- * @obj: The object to check.
- *
- * This function is intended to be called from within the fence signaling
- * path where the fence, or a pin, keeps the object from being migrated. For
- * example during gpu reset or similar.
- *
- * Return: Whether the object is resident in lmem.
- */
-bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
-{
-	struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
-
-#ifdef CONFIG_LOCKDEP
-	GEM_WARN_ON(dma_resv_test_signaled(obj->base.resv, DMA_RESV_USAGE_BOOKKEEP) &&
-		    i915_gem_object_evictable(obj));
-#endif
-	return mr && (mr->type == INTEL_MEMORY_LOCAL ||
-		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
-}
-
 /**
  * __i915_gem_object_create_lmem_with_ps - Create lmem object and force the
  * minimum page size for the backing pages.
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
index 5a7a14e85c3f..ecd8f1a633a1 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
@@ -19,8 +19,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
 
 bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
 
-bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
-
 struct drm_i915_gem_object *
 i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
 				      const void *data, size_t size);
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 35319228bc51..0dbc4e289300 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -527,24 +527,6 @@ int i915_active_acquire(struct i915_active *ref)
 	return err;
 }
 
-int i915_active_acquire_for_context(struct i915_active *ref, u64 idx)
-{
-	struct i915_active_fence *active;
-	int err;
-
-	err = i915_active_acquire(ref);
-	if (err)
-		return err;
-
-	active = active_instance(ref, idx);
-	if (!active) {
-		i915_active_release(ref);
-		return -ENOMEM;
-	}
-
-	return 0; /* return with active ref */
-}
-
 void i915_active_release(struct i915_active *ref)
 {
 	debug_active_assert(ref);
diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
index 77c676ecc263..821f7c21ea9b 100644
--- a/drivers/gpu/drm/i915/i915_active.h
+++ b/drivers/gpu/drm/i915/i915_active.h
@@ -186,7 +186,6 @@ int i915_request_await_active(struct i915_request *rq,
 #define I915_ACTIVE_AWAIT_BARRIER BIT(2)
 
 int i915_active_acquire(struct i915_active *ref);
-int i915_active_acquire_for_context(struct i915_active *ref, u64 idx);
 bool i915_active_acquire_if_busy(struct i915_active *ref);
 
 void i915_active_release(struct i915_active *ref);
-- 
2.47.1


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

* Re: [PATCH] drm/i915: Remove deadcode
  2024-12-22 17:47 [PATCH] drm/i915: Remove deadcode linux
@ 2024-12-27 11:40 ` Tvrtko Ursulin
  2024-12-27 12:11   ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Tvrtko Ursulin @ 2024-12-27 11:40 UTC (permalink / raw)
  To: linux, jani.nikula, joonas.lahtinen, rodrigo.vivi, intel-gfx
  Cc: airlied, simona, dri-devel, linux-kernel


Hi,

On 22/12/2024 17:47, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> i915_active_acquire_for_context() was added in 2020 by
> commit 5d9341370f57 ("drm/i915: Export a preallocate variant of
> i915_active_acquire()") but has never been used.
> 
> The last use of __i915_gem_object_is_lmem() was removed in 2021 by
> commit ff20afc4cee7 ("drm/i915: Update error capture code to avoid using
> the current vma state")
> 
> Remove them.

I plan to apply this and your other two dead code removal patches. I 
needed to re-send to the mailing list first so they get picked up by the 
CI before I can do that (I guess you are not subscribed to intel-gfx). 
It should happen in a day or two. Thanks for the cleanup!

Regards,

Tvrtko
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>   drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 23 -----------------------
>   drivers/gpu/drm/i915/gem/i915_gem_lmem.h |  2 --
>   drivers/gpu/drm/i915/i915_active.c       | 18 ------------------
>   drivers/gpu/drm/i915/i915_active.h       |  1 -
>   4 files changed, 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> index 3198b64ad7db..388f90784d8a 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> @@ -52,29 +52,6 @@ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
>   		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
>   }
>   
> -/**
> - * __i915_gem_object_is_lmem - Whether the object is resident in
> - * lmem while in the fence signaling critical path.
> - * @obj: The object to check.
> - *
> - * This function is intended to be called from within the fence signaling
> - * path where the fence, or a pin, keeps the object from being migrated. For
> - * example during gpu reset or similar.
> - *
> - * Return: Whether the object is resident in lmem.
> - */
> -bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
> -{
> -	struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
> -
> -#ifdef CONFIG_LOCKDEP
> -	GEM_WARN_ON(dma_resv_test_signaled(obj->base.resv, DMA_RESV_USAGE_BOOKKEEP) &&
> -		    i915_gem_object_evictable(obj));
> -#endif
> -	return mr && (mr->type == INTEL_MEMORY_LOCAL ||
> -		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
> -}
> -
>   /**
>    * __i915_gem_object_create_lmem_with_ps - Create lmem object and force the
>    * minimum page size for the backing pages.
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> index 5a7a14e85c3f..ecd8f1a633a1 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> @@ -19,8 +19,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
>   
>   bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
>   
> -bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
> -
>   struct drm_i915_gem_object *
>   i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
>   				      const void *data, size_t size);
> diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
> index 35319228bc51..0dbc4e289300 100644
> --- a/drivers/gpu/drm/i915/i915_active.c
> +++ b/drivers/gpu/drm/i915/i915_active.c
> @@ -527,24 +527,6 @@ int i915_active_acquire(struct i915_active *ref)
>   	return err;
>   }
>   
> -int i915_active_acquire_for_context(struct i915_active *ref, u64 idx)
> -{
> -	struct i915_active_fence *active;
> -	int err;
> -
> -	err = i915_active_acquire(ref);
> -	if (err)
> -		return err;
> -
> -	active = active_instance(ref, idx);
> -	if (!active) {
> -		i915_active_release(ref);
> -		return -ENOMEM;
> -	}
> -
> -	return 0; /* return with active ref */
> -}
> -
>   void i915_active_release(struct i915_active *ref)
>   {
>   	debug_active_assert(ref);
> diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
> index 77c676ecc263..821f7c21ea9b 100644
> --- a/drivers/gpu/drm/i915/i915_active.h
> +++ b/drivers/gpu/drm/i915/i915_active.h
> @@ -186,7 +186,6 @@ int i915_request_await_active(struct i915_request *rq,
>   #define I915_ACTIVE_AWAIT_BARRIER BIT(2)
>   
>   int i915_active_acquire(struct i915_active *ref);
> -int i915_active_acquire_for_context(struct i915_active *ref, u64 idx);
>   bool i915_active_acquire_if_busy(struct i915_active *ref);
>   
>   void i915_active_release(struct i915_active *ref);

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

* Re: [PATCH] drm/i915: Remove deadcode
  2024-12-27 11:40 ` Tvrtko Ursulin
@ 2024-12-27 12:11   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2024-12-27 12:11 UTC (permalink / raw)
  To: Tvrtko Ursulin
  Cc: jani.nikula, joonas.lahtinen, rodrigo.vivi, intel-gfx, airlied,
	simona, dri-devel, linux-kernel

* Tvrtko Ursulin (tursulin@ursulin.net) wrote:
> 
> Hi,
> 
> On 22/12/2024 17:47, linux@treblig.org wrote:
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > 
> > i915_active_acquire_for_context() was added in 2020 by
> > commit 5d9341370f57 ("drm/i915: Export a preallocate variant of
> > i915_active_acquire()") but has never been used.
> > 
> > The last use of __i915_gem_object_is_lmem() was removed in 2021 by
> > commit ff20afc4cee7 ("drm/i915: Update error capture code to avoid using
> > the current vma state")
> > 
> > Remove them.
> 
> I plan to apply this and your other two dead code removal patches.

Thanks!

> I needed
> to re-send to the mailing list first so they get picked up by the CI before
> I can do that (I guess you are not subscribed to intel-gfx).

Right, I'm not subscribed.

> It should
> happen in a day or two. Thanks for the cleanup!

Thanks again,

Dave

> 
> Regards,
> 
> Tvrtko
> > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> > ---
> >   drivers/gpu/drm/i915/gem/i915_gem_lmem.c | 23 -----------------------
> >   drivers/gpu/drm/i915/gem/i915_gem_lmem.h |  2 --
> >   drivers/gpu/drm/i915/i915_active.c       | 18 ------------------
> >   drivers/gpu/drm/i915/i915_active.h       |  1 -
> >   4 files changed, 44 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> > index 3198b64ad7db..388f90784d8a 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.c
> > @@ -52,29 +52,6 @@ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
> >   		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
> >   }
> > -/**
> > - * __i915_gem_object_is_lmem - Whether the object is resident in
> > - * lmem while in the fence signaling critical path.
> > - * @obj: The object to check.
> > - *
> > - * This function is intended to be called from within the fence signaling
> > - * path where the fence, or a pin, keeps the object from being migrated. For
> > - * example during gpu reset or similar.
> > - *
> > - * Return: Whether the object is resident in lmem.
> > - */
> > -bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
> > -{
> > -	struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
> > -
> > -#ifdef CONFIG_LOCKDEP
> > -	GEM_WARN_ON(dma_resv_test_signaled(obj->base.resv, DMA_RESV_USAGE_BOOKKEEP) &&
> > -		    i915_gem_object_evictable(obj));
> > -#endif
> > -	return mr && (mr->type == INTEL_MEMORY_LOCAL ||
> > -		      mr->type == INTEL_MEMORY_STOLEN_LOCAL);
> > -}
> > -
> >   /**
> >    * __i915_gem_object_create_lmem_with_ps - Create lmem object and force the
> >    * minimum page size for the backing pages.
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> > index 5a7a14e85c3f..ecd8f1a633a1 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_lmem.h
> > @@ -19,8 +19,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
> >   bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
> > -bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
> > -
> >   struct drm_i915_gem_object *
> >   i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
> >   				      const void *data, size_t size);
> > diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
> > index 35319228bc51..0dbc4e289300 100644
> > --- a/drivers/gpu/drm/i915/i915_active.c
> > +++ b/drivers/gpu/drm/i915/i915_active.c
> > @@ -527,24 +527,6 @@ int i915_active_acquire(struct i915_active *ref)
> >   	return err;
> >   }
> > -int i915_active_acquire_for_context(struct i915_active *ref, u64 idx)
> > -{
> > -	struct i915_active_fence *active;
> > -	int err;
> > -
> > -	err = i915_active_acquire(ref);
> > -	if (err)
> > -		return err;
> > -
> > -	active = active_instance(ref, idx);
> > -	if (!active) {
> > -		i915_active_release(ref);
> > -		return -ENOMEM;
> > -	}
> > -
> > -	return 0; /* return with active ref */
> > -}
> > -
> >   void i915_active_release(struct i915_active *ref)
> >   {
> >   	debug_active_assert(ref);
> > diff --git a/drivers/gpu/drm/i915/i915_active.h b/drivers/gpu/drm/i915/i915_active.h
> > index 77c676ecc263..821f7c21ea9b 100644
> > --- a/drivers/gpu/drm/i915/i915_active.h
> > +++ b/drivers/gpu/drm/i915/i915_active.h
> > @@ -186,7 +186,6 @@ int i915_request_await_active(struct i915_request *rq,
> >   #define I915_ACTIVE_AWAIT_BARRIER BIT(2)
> >   int i915_active_acquire(struct i915_active *ref);
> > -int i915_active_acquire_for_context(struct i915_active *ref, u64 idx);
> >   bool i915_active_acquire_if_busy(struct i915_active *ref);
> >   void i915_active_release(struct i915_active *ref);
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

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

end of thread, other threads:[~2024-12-27 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-22 17:47 [PATCH] drm/i915: Remove deadcode linux
2024-12-27 11:40 ` Tvrtko Ursulin
2024-12-27 12:11   ` Dr. David Alan Gilbert

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