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

Commit 5375e1e5 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dma-buf: Use monotonic clock for buffer time tracking"

parents f44a42cc 72483f35
Loading
Loading
Loading
Loading
+7 −10
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
	dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll;
	dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0;
	dmabuf->name = bufname;
	getnstimeofday(&dmabuf->ctime);
	dmabuf->ktime = ktime_get();

	if (!resv) {
		resv = (struct reservation_object *)&dmabuf[1];
@@ -1326,24 +1326,21 @@ static int get_dma_info(const void *data, struct file *file, unsigned int n)
static void write_proc(struct seq_file *s, struct dma_proc *proc)
{
	struct dma_info *tmp;
	struct timespec curr_time;

	getnstimeofday(&curr_time);
	seq_printf(s, "\n%s (PID %ld) size: %ld\nDMA Buffers:\n",
		proc->name, proc->pid, proc->size);
	seq_printf(s, "%-8s\t%-8s\t%-8s\n",
		"Name", "Size (KB)", "Time Alive (sec)");

	list_for_each_entry(tmp, &proc->dma_bufs, head) {
		struct dma_buf *dmabuf;
		struct timespec mtime;
		__kernel_time_t elap_mtime;
		struct dma_buf *dmabuf = tmp->dmabuf;
		ktime_t elapmstime = ktime_ms_delta(ktime_get(), dmabuf->ktime);

		dmabuf = tmp->dmabuf;
		mtime = dmabuf->ctime;
		elap_mtime = curr_time.tv_sec - mtime.tv_sec;
		elapmstime = ktime_divns(elapmstime, MSEC_PER_SEC);
		seq_printf(s, "%-8s\t%-8ld\t%-8ld\n",
			dmabuf->name, dmabuf->size / SZ_1K, elap_mtime);
				dmabuf->name,
				dmabuf->size / SZ_1K,
				elapmstime);
	}
}

+2 −1
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ struct dma_buf_ops {
 * @vmap_ptr: the current vmap ptr if vmapping_counter > 0
 * @exp_name: name of the exporter; useful for debugging.
 * @name: unique name for the buffer
 * @ktime: time (in jiffies) at which the buffer was born
 * @owner: pointer to exporter module; used for refcounting when exporter is a
 *         kernel module.
 * @list_node: node for dma_buf accounting and debugging.
@@ -411,7 +412,7 @@ struct dma_buf {
	void *vmap_ptr;
	const char *exp_name;
	char *name;
	struct timespec ctime;
	ktime_t ktime;
	struct module *owner;
	struct list_head list_node;
	void *priv;