Commit bbd9d056 authored by Yiwei Zhang's avatar Yiwei Zhang Committed by Steven Rostedt (VMware)
Browse files

gpu/trace: add a gpu total memory usage tracepoint

This change adds the below gpu memory tracepoint:
gpu_mem/gpu_mem_total: track global or proc gpu memory total usages

Per process tracking of total gpu memory usage in the gem layer is not
appropriate and hard to implement with trivial overhead. So for the gfx
device driver layer to track total gpu memory usage both globally and
per process in an easy and uniform way is to integrate the tracepoint in
this patch to the underlying varied implementations of gpu memory
tracking system from vendors.

Putting this tracepoint in the common trace events can not only help
wean the gfx drivers off of debugfs but also greatly help the downstream
Android gpu vendors because debugfs is to be deprecated in the upcoming
Android release. Then the gpu memory tracking of both Android kernel and
the upstream linux kernel can stay closely, which can benefit the whole
kernel eco-system in the long term.

Link: http://lkml.kernel.org/r/20200302235044.59163-1-zzyiwei@google.com



Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarYiwei Zhang <zzyiwei@google.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 89b74cac
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -200,6 +200,8 @@ source "drivers/thunderbolt/Kconfig"

source "drivers/android/Kconfig"

source "drivers/gpu/trace/Kconfig"

source "drivers/nvdimm/Kconfig"

source "drivers/dax/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@
obj-$(CONFIG_TEGRA_HOST1X)	+= host1x/
obj-y			+= drm/ vga/
obj-$(CONFIG_IMX_IPUV3_CORE)	+= ipu-v3/
obj-$(CONFIG_TRACE_GPU_MEM)		+= trace/
+4 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

config TRACE_GPU_MEM
	bool
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_TRACE_GPU_MEM) += trace_gpu_mem.o
+13 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * GPU memory trace points
 *
 * Copyright (C) 2020 Google, Inc.
 */

#include <linux/module.h>

#define CREATE_TRACE_POINTS
#include <trace/events/gpu_mem.h>

EXPORT_TRACEPOINT_SYMBOL(gpu_mem_total);
Loading