Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1643099 > unrolled thread
| Started by | Archit Taneja <architt@codeaurora.org> |
|---|---|
| First post | 2017-05-17 10:20 +0200 |
| Last post | 2017-05-18 06:50 +0200 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/3] staging: android: ion: Minor clean ups and fixes Archit Taneja <architt@codeaurora.org> - 2017-05-17 10:20 +0200
[PATCH 3/3] staging: android: ion: Avoid calling free_duped_table() twice Archit Taneja <architt@codeaurora.org> - 2017-05-17 10:20 +0200
[PATCH 1/3] staging: android: ion: Remove unused members from ion_buffer Archit Taneja <architt@codeaurora.org> - 2017-05-17 10:20 +0200
Re: [PATCH 0/3] staging: android: ion: Minor clean ups and fixes Laura Abbott <labbott@redhat.com> - 2017-05-17 18:40 +0200
Re: [PATCH 0/3] staging: android: ion: Minor clean ups and fixes Sumit Semwal <sumit.semwal@linaro.org> - 2017-05-18 06:50 +0200
| From | Archit Taneja <architt@codeaurora.org> |
|---|---|
| Date | 2017-05-17 10:20 +0200 |
| Subject | [PATCH 0/3] staging: android: ion: Minor clean ups and fixes |
| Message-ID | <tI2lA-AO-7@gated-at.bofh.it> |
The recent ION clean ups introduced some leftover code that can be removed, and a bug that comes up if the call to dma_buf_map_attachment() from an importer fails. Fix these. Archit Taneja (3): staging: android: ion: Remove unused members from ion_buffer staging: android: ion: Remove ION_FLAG_CACHED_NEEDS_SYNC staging: android: ion: Avoid calling free_duped_table() twice drivers/staging/android/ion/ion.c | 14 +++----------- drivers/staging/android/ion/ion.h | 14 -------------- drivers/staging/android/uapi/ion.h | 6 ------ 3 files changed, 3 insertions(+), 31 deletions(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
[toc] | [next] | [standalone]
| From | Archit Taneja <architt@codeaurora.org> |
|---|---|
| Date | 2017-05-17 10:20 +0200 |
| Subject | [PATCH 3/3] staging: android: ion: Avoid calling free_duped_table() twice |
| Message-ID | <tI2lA-AO-19@gated-at.bofh.it> |
| In reply to | #1643099 |
Currently, the duplicated sg table is freed in the detach() and
the error path of map_dma_buf() ion's dma_buf_ops.
If a call to dma_buf_map_attachment() fails, the importer is
expected to call dma_buf_detach() to remove the attachment. This
will result in us trying to free the duped sg table twice.
Don't call free_duped_table() in ion_map_dma_buf() to avoid this.
Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
drivers/staging/android/ion/ion.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 90ae6ce466ed..b483e1081309 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -268,20 +268,14 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
{
struct ion_dma_buf_attachment *a = attachment->priv;
struct sg_table *table;
- int ret;
table = a->table;
if (!dma_map_sg(attachment->dev, table->sgl, table->nents,
- direction)){
- ret = -ENOMEM;
- goto err;
- }
- return table;
+ direction))
+ return ERR_PTR(-ENOMEM);
-err:
- free_duped_table(table);
- return ERR_PTR(ret);
+ return table;
}
static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
[toc] | [prev] | [next] | [standalone]
| From | Archit Taneja <architt@codeaurora.org> |
|---|---|
| Date | 2017-05-17 10:20 +0200 |
| Subject | [PATCH 1/3] staging: android: ion: Remove unused members from ion_buffer |
| Message-ID | <tI2lB-AO-33@gated-at.bofh.it> |
| In reply to | #1643099 |
A few members in ion_buffer struct are unused after features
like page faulting, ion_handle and ion_client were removed.
Remove these members and the leftover references to them.
Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
drivers/staging/android/ion/ion.c | 2 --
drivers/staging/android/ion/ion.h | 14 --------------
2 files changed, 16 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 03d3a4fce0e2..90ae6ce466ed 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -115,7 +115,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
buffer->dev = dev;
buffer->size = len;
- INIT_LIST_HEAD(&buffer->vmas);
INIT_LIST_HEAD(&buffer->attachments);
mutex_init(&buffer->lock);
mutex_lock(&dev->buffer_lock);
@@ -135,7 +134,6 @@ void ion_buffer_destroy(struct ion_buffer *buffer)
if (WARN_ON(buffer->kmap_cnt > 0))
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
buffer->heap->ops->free(buffer);
- vfree(buffer->pages);
kfree(buffer);
}
diff --git a/drivers/staging/android/ion/ion.h b/drivers/staging/android/ion/ion.h
index ace8416bd509..fa9ed81ab972 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -68,14 +68,6 @@ struct ion_platform_heap {
* @kmap_cnt: number of times the buffer is mapped to the kernel
* @vaddr: the kernel mapping if kmap_cnt is not zero
* @sg_table: the sg table for the buffer if dmap_cnt is not zero
- * @pages: flat array of pages in the buffer -- used by fault
- * handler and only valid for buffers that are faulted in
- * @vmas: list of vma's mapping this buffer
- * @handle_count: count of handles referencing this buffer
- * @task_comm: taskcomm of last client to reference this buffer in a
- * handle, used for debugging
- * @pid: pid of last client to reference this buffer in a
- * handle, used for debugging
*/
struct ion_buffer {
union {
@@ -92,13 +84,7 @@ struct ion_buffer {
int kmap_cnt;
void *vaddr;
struct sg_table *sg_table;
- struct page **pages;
- struct list_head vmas;
struct list_head attachments;
- /* used to track orphaned buffers */
- int handle_count;
- char task_comm[TASK_COMM_LEN];
- pid_t pid;
};
void ion_buffer_destroy(struct ion_buffer *buffer);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
[toc] | [prev] | [next] | [standalone]
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2017-05-17 18:40 +0200 |
| Message-ID | <tIa9s-5sd-15@gated-at.bofh.it> |
| In reply to | #1643099 |
On 05/17/2017 01:15 AM, Archit Taneja wrote: > The recent ION clean ups introduced some leftover code that can be > removed, and a bug that comes up if the call to dma_buf_map_attachment() > from an importer fails. Fix these. > > Archit Taneja (3): > staging: android: ion: Remove unused members from ion_buffer > staging: android: ion: Remove ION_FLAG_CACHED_NEEDS_SYNC > staging: android: ion: Avoid calling free_duped_table() twice > > drivers/staging/android/ion/ion.c | 14 +++----------- > drivers/staging/android/ion/ion.h | 14 -------------- > drivers/staging/android/uapi/ion.h | 6 ------ > 3 files changed, 3 insertions(+), 31 deletions(-) > Acked-by: Laura Abbott <labbott@redhat.com>
[toc] | [prev] | [next] | [standalone]
| From | Sumit Semwal <sumit.semwal@linaro.org> |
|---|---|
| Date | 2017-05-18 06:50 +0200 |
| Message-ID | <tIlxT-4UV-7@gated-at.bofh.it> |
| In reply to | #1643099 |
Hi Archit, On 17 May 2017 at 13:45, Archit Taneja <architt@codeaurora.org> wrote: > The recent ION clean ups introduced some leftover code that can be > removed, and a bug that comes up if the call to dma_buf_map_attachment() > from an importer fails. Fix these. > > Archit Taneja (3): > staging: android: ion: Remove unused members from ion_buffer > staging: android: ion: Remove ION_FLAG_CACHED_NEEDS_SYNC > staging: android: ion: Avoid calling free_duped_table() twice > Thanks for these patches! Please feel free to add my Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> > drivers/staging/android/ion/ion.c | 14 +++----------- > drivers/staging/android/ion/ion.h | 14 -------------- > drivers/staging/android/uapi/ion.h | 6 ------ > 3 files changed, 3 insertions(+), 31 deletions(-) > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation > Best, Sumit.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web