Skip to contentSkip to conversation

staging: android: ion: Remove file ion_carveout_heap.c

PATCH In review Nishka Dasgupta 5 participants 10 messages Jul 3, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: android: ion: Remove file ion_carveout_heap.c

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
 drivers/staging/android/ion/Kconfig           |   9 --
 drivers/staging/android/ion/Makefile          |   1 -
 .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------
 3 files changed, 143 deletions(-)
 delete mode 100644 drivers/staging/android/ion/ion_carveout_heap.c
drivers/staging/android/ion/Kconfig +0 -9
index 178df581a8fc..dff641451a89 100644
@@ -18,15 +18,6 @@ config ION_SYSTEM_HEAP
 	  Choose this option to enable the Ion system heap. The system heap
 	  is backed by pages from the buddy allocator. If in doubt, say Y.
 
-config ION_CARVEOUT_HEAP
-	bool "Ion carveout heap support"
-	depends on ION
-	help
-	  Choose this option to enable carveout heaps with Ion. Carveout heaps
-	  are backed by memory reserved from the system. Allocation times are
-	  typically faster at the cost of memory not being used. Unless you
-	  know your system has these regions, you should say N here.
-
 config ION_CHUNK_HEAP
 	bool "Ion chunk heap support"
 	depends on ION
drivers/staging/android/ion/Makefile +0 -1
index 17f3a7569e3d..0ac5465e2841 100644
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_ION) += ion.o ion_heap.o
 obj-$(CONFIG_ION_SYSTEM_HEAP) += ion_system_heap.o ion_page_pool.o
-obj-$(CONFIG_ION_CARVEOUT_HEAP) += ion_carveout_heap.o
 obj-$(CONFIG_ION_CHUNK_HEAP) += ion_chunk_heap.o
 obj-$(CONFIG_ION_CMA_HEAP) += ion_cma_heap.o
drivers/staging/android/ion/ion_carveout_heap.c deleted +0 -133

133 lines not on this page · raw message

Signature · 1 line
2.19.1
#1 lore raw

PATCH 2/2 staging: android: ion: Remove file ion_chunk_heap.c

Remove file ion_chunk_heap.c as its functions and definitions are not used anywhere else.
Issue found with Coccinelle.

---
 drivers/staging/android/ion/Kconfig          |   9 --
 drivers/staging/android/ion/Makefile         |   1 -
 drivers/staging/android/ion/ion_chunk_heap.c | 147 -------------------
 3 files changed, 157 deletions(-)
 delete mode 100644 drivers/staging/android/ion/ion_chunk_heap.c
drivers/staging/android/ion/Kconfig +0 -9
index dff641451a89..989fe84a9f9d 100644
@@ -18,15 +18,6 @@ config ION_SYSTEM_HEAP
 	  Choose this option to enable the Ion system heap. The system heap
 	  is backed by pages from the buddy allocator. If in doubt, say Y.
 
-config ION_CHUNK_HEAP
-	bool "Ion chunk heap support"
-	depends on ION
-	help
-          Choose this option to enable chunk heaps with Ion. This heap is
-	  similar in function the carveout heap but memory is broken down
-	  into smaller chunk sizes, typically corresponding to a TLB size.
-	  Unless you know your system has these regions, you should say N here.
-
 config ION_CMA_HEAP
 	bool "Ion CMA heap support"
 	depends on ION && DMA_CMA
drivers/staging/android/ion/Makefile +0 -1
index 0ac5465e2841..5f4487b1a224 100644
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_ION) += ion.o ion_heap.o
 obj-$(CONFIG_ION_SYSTEM_HEAP) += ion_system_heap.o ion_page_pool.o
-obj-$(CONFIG_ION_CHUNK_HEAP) += ion_chunk_heap.o
 obj-$(CONFIG_ION_CMA_HEAP) += ion_cma_heap.o
drivers/staging/android/ion/ion_chunk_heap.c deleted +0 -147

147 lines not on this page · raw message

Signature · 1 line
2.19.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] staging: android: ion: Remove file ion_chunk_heap.c

Quoted 4 lines · Nishka Dasgupta

Remove file ion_chunk_heap.c as its functions and definitions are not used anywhere else.
Issue found with Coccinelle.

Quoted 182 lines
---
  drivers/staging/android/ion/Kconfig          |   9 --
  drivers/staging/android/ion/Makefile         |   1 -
  drivers/staging/android/ion/ion_chunk_heap.c | 147 -------------------
  3 files changed, 157 deletions(-)

delete mode 100644 drivers/staging/android/ion/ion_chunk_heap.c

drivers/staging/android/ion/Kconfig +0 -9
index dff641451a89..989fe84a9f9d 100644
@@ -18,15 +18,6 @@ config ION_SYSTEM_HEAP
  	  Choose this option to enable the Ion system heap. The system heap
  	  is backed by pages from the buddy allocator. If in doubt, say Y.
 
-config ION_CHUNK_HEAP
-	bool "Ion chunk heap support"
-	depends on ION
-	help
-          Choose this option to enable chunk heaps with Ion. This heap is
-	  similar in function the carveout heap but memory is broken down
-	  into smaller chunk sizes, typically corresponding to a TLB size.
-	  Unless you know your system has these regions, you should say N here.
-
  config ION_CMA_HEAP
  	bool "Ion CMA heap support"
  	depends on ION && DMA_CMA
drivers/staging/android/ion/Makefile +0 -1
index 0ac5465e2841..5f4487b1a224 100644
@@ -1,5 +1,4 @@
  # SPDX-License-Identifier: GPL-2.0
  obj-$(CONFIG_ION) += ion.o ion_heap.o
  obj-$(CONFIG_ION_SYSTEM_HEAP) += ion_system_heap.o ion_page_pool.o
-obj-$(CONFIG_ION_CHUNK_HEAP) += ion_chunk_heap.o
  obj-$(CONFIG_ION_CMA_HEAP) += ion_cma_heap.o
drivers/staging/android/ion/ion_chunk_heap.c deleted +0 -137
deleted file mode 100644
index 1e869f4bad45..000000000000
@@ -1,147 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * ION memory allocator chunk heap helper
- *
- * Copyright (C) 2012 Google, Inc.
- */
-
-#include <linux/dma-mapping.h>
-#include <linux/err.h>
-#include <linux/genalloc.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/slab.h>
-
-#include "ion.h"
-
-struct ion_chunk_heap {
-	struct ion_heap heap;
-	struct gen_pool *pool;
-	unsigned long chunk_size;
-	unsigned long size;
-	unsigned long allocated;
-};
-
-static int ion_chunk_heap_allocate(struct ion_heap *heap,
-				   struct ion_buffer *buffer,
-				   unsigned long size,
-				   unsigned long flags)
-{
-	struct ion_chunk_heap *chunk_heap =
-		container_of(heap, struct ion_chunk_heap, heap);
-	struct sg_table *table;
-	struct scatterlist *sg;
-	int ret, i;
-	unsigned long num_chunks;
-	unsigned long allocated_size;
-
-	allocated_size = ALIGN(size, chunk_heap->chunk_size);
-	num_chunks = allocated_size / chunk_heap->chunk_size;
-
-	if (allocated_size > chunk_heap->size - chunk_heap->allocated)
-		return -ENOMEM;
-
-	table = kmalloc(sizeof(*table), GFP_KERNEL);
-	if (!table)
-		return -ENOMEM;
-	ret = sg_alloc_table(table, num_chunks, GFP_KERNEL);
-	if (ret) {
-		kfree(table);
-		return ret;
-	}
-
-	sg = table->sgl;
-	for (i = 0; i < num_chunks; i++) {
-		unsigned long paddr = gen_pool_alloc(chunk_heap->pool,
-						     chunk_heap->chunk_size);
-		if (!paddr)
-			goto err;
-		sg_set_page(sg, pfn_to_page(PFN_DOWN(paddr)),
-			    chunk_heap->chunk_size, 0);
-		sg = sg_next(sg);
-	}
-
-	buffer->sg_table = table;
-	chunk_heap->allocated += allocated_size;
-	return 0;
-err:
-	sg = table->sgl;
-	for (i -= 1; i >= 0; i--) {
-		gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
-			      sg->length);
-		sg = sg_next(sg);
-	}
-	sg_free_table(table);
-	kfree(table);
-	return -ENOMEM;
-}
-
-static void ion_chunk_heap_free(struct ion_buffer *buffer)
-{
-	struct ion_heap *heap = buffer->heap;
-	struct ion_chunk_heap *chunk_heap =
-		container_of(heap, struct ion_chunk_heap, heap);
-	struct sg_table *table = buffer->sg_table;
-	struct scatterlist *sg;
-	int i;
-	unsigned long allocated_size;
-
-	allocated_size = ALIGN(buffer->size, chunk_heap->chunk_size);
-
-	ion_heap_buffer_zero(buffer);
-
-	for_each_sg(table->sgl, sg, table->nents, i) {
-		gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
-			      sg->length);
-	}
-	chunk_heap->allocated -= allocated_size;
-	sg_free_table(table);
-	kfree(table);
-}
-
-static struct ion_heap_ops chunk_heap_ops = {
-	.allocate = ion_chunk_heap_allocate,
-	.free = ion_chunk_heap_free,
-	.map_user = ion_heap_map_user,
-	.map_kernel = ion_heap_map_kernel,
-	.unmap_kernel = ion_heap_unmap_kernel,
-};
-
-struct ion_heap *ion_chunk_heap_create(phys_addr_t base, size_t size,
-				       size_t chunk_size)
-{
-	struct ion_chunk_heap *chunk_heap;
-	int ret;
-	struct page *page;
-
-	page = pfn_to_page(PFN_DOWN(base));
-	ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
-	if (ret)
-		return ERR_PTR(ret);
-
-	chunk_heap = kzalloc(sizeof(*chunk_heap), GFP_KERNEL);
-	if (!chunk_heap)
-		return ERR_PTR(-ENOMEM);
-
-	chunk_heap->chunk_size = chunk_size;
-	chunk_heap->pool = gen_pool_create(get_order(chunk_heap->chunk_size) +
-					   PAGE_SHIFT, -1);
-	if (!chunk_heap->pool) {
-		ret = -ENOMEM;
-		goto error_gen_pool_create;
-	}
-	chunk_heap->size = size;
-	chunk_heap->allocated = 0;
-
-	gen_pool_add(chunk_heap->pool, base, size, -1);
-	chunk_heap->heap.ops = &chunk_heap_ops;

drivers/staging/android/ion/ion_chunk_heap.c line 147

Quoted 10 lines
drivers/staging/android/ion/ion_chunk_heap.c deleted +0 -10
-	chunk_heap->heap.type = ION_HEAP_TYPE_CHUNK;
-	chunk_heap->heap.flags = ION_HEAP_FLAG_DEFER_FREE;
-	pr_debug("%s: base %pa size %zu\n", __func__, &base, size);
-
-	return &chunk_heap->heap;
-
-error_gen_pool_create:
-	kfree(chunk_heap);
-	return ERR_PTR(ret);
-}

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#3 lore raw
In reply to Nishka Dasgupta
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
 drivers/staging/android/ion/Kconfig           |   9 --
 drivers/staging/android/ion/Makefile          |   1 -
 .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

Hopefully that wakes some people up...

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
Quoted 11 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
  drivers/staging/android/ion/Kconfig           |   9 --
  drivers/staging/android/ion/Makefile          |   1 -
  .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------
Quoted 7 lines

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

I'm sorry, I don't think I understand. Should I drop these patches from my tree then?

Thanking you,
Nishka

Quoted 6 lines

Hopefully that wakes some people up...

thanks,

greg k-h

maintainer
#5 lore raw
Quoted 17 lines · Nishka Dasgupta
Quoted 16 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
  drivers/staging/android/ion/Kconfig           |   9 --
  drivers/staging/android/ion/Makefile          |   1 -
  .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Quoted 5 lines
Quoted 2 lines

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

I'm sorry, I don't think I understand. Should I drop these patches from my tree then?

What "tree"? Let's see what the ION maintainer and developers say before rushing to anything.

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to Greg KH
Quoted 17 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
 drivers/staging/android/ion/Kconfig           |   9 --
 drivers/staging/android/ion/Makefile          |   1 -
 .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Quoted 4 lines

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

Hopefully that wakes some people up...

John Stultz has done a steady stream on ion destaging patch series past few months, und the heading of "DMA-BUF Heaps", targeting drivers/dma-buf. I'm not following the details, and it seems a bit a crawl, but there's definitely work going on ... Just probably not in-place in staging I think.
-Daniel

Quoted 8 lines

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by
#7 lore raw
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
  drivers/staging/android/ion/Kconfig           |   9 --
  drivers/staging/android/ion/Makefile          |   1 -
  .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

Quoted 9 lines
Quoted 1 line

Hopefully that wakes some people up...

John Stultz has done a steady stream on ion destaging patch series past few months, und the heading of "DMA-BUF Heaps", targeting drivers/dma-buf. I'm not following the details, and it seems a bit a crawl, but there's definitely work going on ... Just probably not in-place in staging I think.
-Daniel

https://lists.freedesktop.org/archives/dri-devel/2019-June/223705.html

It is making slow and steady progress. Part of this is trying to make sure we actually get this right before moving anything out of staging.

That said, I think we're at the point where nobody wants the carveout and chunk heaps so I'd actually be okay with removing those files. Just to be explicit:

Thanks,
Laura
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#8 lore raw
Quoted 39 lines · Laura Abbott
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
  drivers/staging/android/ion/Kconfig           |   9 --
  drivers/staging/android/ion/Makefile          |   1 -
  .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

Quoted 9 lines
Quoted 1 line

Hopefully that wakes some people up...

John Stultz has done a steady stream on ion destaging patch series past few months, und the heading of "DMA-BUF Heaps", targeting drivers/dma-buf. I'm not following the details, and it seems a bit a crawl, but there's definitely work going on ... Just probably not in-place in staging I think.
-Daniel

https://lists.freedesktop.org/archives/dri-devel/2019-June/223705.html

It is making slow and steady progress. Part of this is trying to make sure we actually get this right before moving anything out of staging.

Quoted 5 lines

That said, I think we're at the point where nobody wants the carveout and chunk heaps so I'd actually be okay with removing those files. Just to be explicit:

Hey, if you agree to delete these, I'll not object at all!

thanks,

greg k-h
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
In reply to Laura Abbott
Quoted 34 lines · Laura Abbott
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · Greg KH
Quoted 9 lines · Nishka Dasgupta

Remove file ion_carveout_heap.c as its functions and definitions are not used anywhere.
Issue found with Coccinelle.

---
  drivers/staging/android/ion/Kconfig           |   9 --
  drivers/staging/android/ion/Makefile          |   1 -
  .../staging/android/ion/ion_carveout_heap.c   | 133 ------------------

I keep trying to do this, but others point out that the ion code is "going to be fixed up soon" and that people rely on this interface now. Well, "code outside of the kernel tree" relies on this, which is not ok, but the "soon" people keep insisting on it...

Odds are I should just delete all of ION, as there hasn't been any forward progress on it in a long time.

Quoted 9 lines
Quoted 1 line

Hopefully that wakes some people up...

John Stultz has done a steady stream on ion destaging patch series past few months, und the heading of "DMA-BUF Heaps", targeting drivers/dma-buf. I'm not following the details, and it seems a bit a crawl, but there's definitely work going on ... Just probably not in-place in staging I think.
-Daniel

Quoted 5 lines

https://lists.freedesktop.org/archives/dri-devel/2019-June/223705.html

It is making slow and steady progress. Part of this is trying to make sure we actually get this right before moving anything out of staging.

Hopefully not too much longer. The review feedback has gotten quiet recently so hopefully everyone is nodding.

Note, I'd also find it useful to *not* eject ION immediately after dmabuf heaps land, since being able to do A/B validation on the same kernel is useful if folks run into any new perf regressions. But hopefully that transition time is fairly small.

Quoted 5 lines

That said, I think we're at the point where nobody wants the carveout and chunk heaps so I'd actually be okay with removing those files. Just to be explicit:

Agreed. I think there are some out of tree uses by ARM and others for the carveout heaps, but I don't know if anyone is using those unmodified anyway. So no objection from me, as there is no way to use them upstream.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel