diff mbox series

drm/i915: Kill the undead i915_gem_batch_pool.c

Message ID 20190822065917.18988-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series drm/i915: Kill the undead i915_gem_batch_pool.c | expand

Commit Message

Chris Wilson Aug. 22, 2019, 6:59 a.m. UTC
You have to cut it off at the neck, otherwise it just reappears in the
next merge, like commit 3f866026f0ce ("Merge drm/drm-next
into drm-intel-next-queued")

References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_batch_pool.c | 132 ---------------------
 1 file changed, 132 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/i915_gem_batch_pool.c

Comments

Joonas Lahtinen Aug. 22, 2019, 11:12 a.m. UTC | #1
Quoting Chris Wilson (2019-08-22 09:59:17)
> You have to cut it off at the neck, otherwise it just reappears in the
> next merge, like commit 3f866026f0ce ("Merge drm/drm-next
> into drm-intel-next-queued")
> 
> References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>

Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
Chris Wilson Aug. 22, 2019, 11:17 a.m. UTC | #2
Quoting Joonas Lahtinen (2019-08-22 12:12:03)
> Quoting Chris Wilson (2019-08-22 09:59:17)
> > You have to cut it off at the neck, otherwise it just reappears in the
> > next merge, like commit 3f866026f0ce ("Merge drm/drm-next
> > into drm-intel-next-queued")
> > 
> > References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

And once more the nails have been put back in the coffin.
-Chris
Sean Paul Oct. 9, 2019, 6:53 p.m. UTC | #3
On Thu, Aug 22, 2019 at 7:17 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Joonas Lahtinen (2019-08-22 12:12:03)
> > Quoting Chris Wilson (2019-08-22 09:59:17)
> > > You have to cut it off at the neck, otherwise it just reappears in the
> > > next merge, like commit 3f866026f0ce ("Merge drm/drm-next
> > > into drm-intel-next-queued")
> > >
> > > References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> >
> > Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>
> And once more the nails have been put back in the coffin.

Months later, a hand reaches out from the grave and says:

Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c

(warnings from i915.rst htmldocs build)

Sean



> -Chris
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson Oct. 9, 2019, 6:57 p.m. UTC | #4
Quoting Sean Paul (2019-10-09 19:53:31)
> On Thu, Aug 22, 2019 at 7:17 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > Quoting Joonas Lahtinen (2019-08-22 12:12:03)
> > > Quoting Chris Wilson (2019-08-22 09:59:17)
> > > > You have to cut it off at the neck, otherwise it just reappears in the
> > > > next merge, like commit 3f866026f0ce ("Merge drm/drm-next
> > > > into drm-intel-next-queued")
> > > >
> > > > References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > >
> > > Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> >
> > And once more the nails have been put back in the coffin.
> 
> Months later, a hand reaches out from the grave and says:
> 
> Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
> Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
> Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c

commit b047463c852272ef9956ad3a4c706f78f8b06c17
Author: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Date:   Fri Aug 30 11:58:48 2019 +0300

    drm/i915: Remove link to missing "Batchbuffer Pools" documentation

-Chris
Sean Paul Oct. 9, 2019, 7:12 p.m. UTC | #5
On Wed, Oct 09, 2019 at 07:57:33PM +0100, Chris Wilson wrote:
> Quoting Sean Paul (2019-10-09 19:53:31)
> > On Thu, Aug 22, 2019 at 7:17 AM Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > >
> > > Quoting Joonas Lahtinen (2019-08-22 12:12:03)
> > > > Quoting Chris Wilson (2019-08-22 09:59:17)
> > > > > You have to cut it off at the neck, otherwise it just reappears in the
> > > > > next merge, like commit 3f866026f0ce ("Merge drm/drm-next
> > > > > into drm-intel-next-queued")
> > > > >
> > > > > References: 3f866026f0ce ("Merge drm/drm-next into drm-intel-next-queued")
> > > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > >
> > > > Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > >
> > > And once more the nails have been put back in the coffin.
> > 
> > Months later, a hand reaches out from the grave and says:
> > 
> > Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
> > Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
> > Error: Cannot open file ../drivers/gpu/drm/i915/i915_gem_batch_pool.c
> 
> commit b047463c852272ef9956ad3a4c706f78f8b06c17
> Author: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Date:   Fri Aug 30 11:58:48 2019 +0300
> 
>     drm/i915: Remove link to missing "Batchbuffer Pools" documentation
> 

Ah, that's so much less fun :-)

Thanks for the reference, I look forward to getting it in -misc on the next
backmerge.

Sean

> -Chris
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_batch_pool.c b/drivers/gpu/drm/i915/i915_gem_batch_pool.c
deleted file mode 100644
index 8675a608a6fe..000000000000
--- a/drivers/gpu/drm/i915/i915_gem_batch_pool.c
+++ /dev/null
@@ -1,132 +0,0 @@ 
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright © 2014-2018 Intel Corporation
- */
-
-#include "i915_gem_batch_pool.h"
-#include "i915_drv.h"
-
-/**
- * DOC: batch pool
- *
- * In order to submit batch buffers as 'secure', the software command parser
- * must ensure that a batch buffer cannot be modified after parsing. It does
- * this by copying the user provided batch buffer contents to a kernel owned
- * buffer from which the hardware will actually execute, and by carefully
- * managing the address space bindings for such buffers.
- *
- * The batch pool framework provides a mechanism for the driver to manage a
- * set of scratch buffers to use for this purpose. The framework can be
- * extended to support other uses cases should they arise.
- */
-
-/**
- * i915_gem_batch_pool_init() - initialize a batch buffer pool
- * @pool: the batch buffer pool
- * @engine: the associated request submission engine
- */
-void i915_gem_batch_pool_init(struct i915_gem_batch_pool *pool,
-			      struct intel_engine_cs *engine)
-{
-	int n;
-
-	pool->engine = engine;
-
-	for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++)
-		INIT_LIST_HEAD(&pool->cache_list[n]);
-}
-
-/**
- * i915_gem_batch_pool_fini() - clean up a batch buffer pool
- * @pool: the pool to clean up
- *
- * Note: Callers must hold the struct_mutex.
- */
-void i915_gem_batch_pool_fini(struct i915_gem_batch_pool *pool)
-{
-	int n;
-
-	lockdep_assert_held(&pool->engine->i915->drm.struct_mutex);
-
-	for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) {
-		struct drm_i915_gem_object *obj, *next;
-
-		list_for_each_entry_safe(obj, next,
-					 &pool->cache_list[n],
-					 batch_pool_link)
-			i915_gem_object_put(obj);
-
-		INIT_LIST_HEAD(&pool->cache_list[n]);
-	}
-}
-
-/**
- * i915_gem_batch_pool_get() - allocate a buffer from the pool
- * @pool: the batch buffer pool
- * @size: the minimum desired size of the returned buffer
- *
- * Returns an inactive buffer from @pool with at least @size bytes,
- * with the pages pinned. The caller must i915_gem_object_unpin_pages()
- * on the returned object.
- *
- * Note: Callers must hold the struct_mutex
- *
- * Return: the buffer object or an error pointer
- */
-struct drm_i915_gem_object *
-i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
-			size_t size)
-{
-	struct drm_i915_gem_object *obj;
-	struct list_head *list;
-	int n, ret;
-
-	lockdep_assert_held(&pool->engine->i915->drm.struct_mutex);
-
-	/* Compute a power-of-two bucket, but throw everything greater than
-	 * 16KiB into the same bucket: i.e. the the buckets hold objects of
-	 * (1 page, 2 pages, 4 pages, 8+ pages).
-	 */
-	n = fls(size >> PAGE_SHIFT) - 1;
-	if (n >= ARRAY_SIZE(pool->cache_list))
-		n = ARRAY_SIZE(pool->cache_list) - 1;
-	list = &pool->cache_list[n];
-
-	list_for_each_entry(obj, list, batch_pool_link) {
-		struct dma_resv *resv = obj->base.resv;
-
-		/* The batches are strictly LRU ordered */
-		if (!dma_resv_test_signaled_rcu(resv, true))
-			break;
-
-		/*
-		 * The object is now idle, clear the array of shared
-		 * fences before we add a new request. Although, we
-		 * remain on the same engine, we may be on a different
-		 * timeline and so may continually grow the array,
-		 * trapping a reference to all the old fences, rather
-		 * than replace the existing fence.
-		 */
-		if (rcu_access_pointer(resv->fence)) {
-			dma_resv_lock(resv, NULL);
-			dma_resv_add_excl_fence(resv, NULL);
-			dma_resv_unlock(resv);
-		}
-
-		if (obj->base.size >= size)
-			goto found;
-	}
-
-	obj = i915_gem_object_create_internal(pool->engine->i915, size);
-	if (IS_ERR(obj))
-		return obj;
-
-found:
-	ret = i915_gem_object_pin_pages(obj);
-	if (ret)
-		return ERR_PTR(ret);
-
-	list_move_tail(&obj->batch_pool_link, list);
-	return obj;
-}