Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8f41e97 authored by Prakash Gupta's avatar Prakash Gupta Committed by Gerrit - the friendly Code Review server
Browse files

ion: add additional debug info in dmabuf exp_info



Add heap name, tgid and comm info to dmabuf export info. This will help
aggregate allocations based of above parameters for debug purpose.

Change-Id: I5d3022ef18f22ec29a87a84d97d64964615b5856
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
parent b6072a3c
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -505,6 +505,7 @@ static void ion_dma_buf_release(struct dma_buf *dmabuf)
	struct ion_buffer *buffer = dmabuf->priv;

	_ion_buffer_destroy(buffer);
	kfree(dmabuf->exp_name);
}

static void *ion_dma_buf_kmap(struct dma_buf *dmabuf, unsigned long offset)
@@ -1047,6 +1048,7 @@ struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask,
	struct ion_heap *heap;
	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
	struct dma_buf *dmabuf;
	char task_comm[TASK_COMM_LEN];

	pr_debug("%s: len %zu heap_id_mask %u flags %x\n", __func__,
		 len, heap_id_mask, flags);
@@ -1078,14 +1080,20 @@ struct dma_buf *ion_alloc_dmabuf(size_t len, unsigned int heap_id_mask,
	if (IS_ERR(buffer))
		return ERR_CAST(buffer);

	get_task_comm(task_comm, current->group_leader);

	exp_info.ops = &dma_buf_ops;
	exp_info.size = buffer->size;
	exp_info.flags = O_RDWR;
	exp_info.priv = buffer;
	exp_info.exp_name = kasprintf(GFP_KERNEL, "%s-%s-%d-%s", KBUILD_MODNAME,
				      heap->name, current->tgid, task_comm);

	dmabuf = dma_buf_export(&exp_info);
	if (IS_ERR(dmabuf))
	if (IS_ERR(dmabuf)) {
		_ion_buffer_destroy(buffer);
		kfree(dmabuf->exp_name);
	}

	return dmabuf;
}