lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210726164135.1745059-1-kaleshsingh@google.com>
Date:   Mon, 26 Jul 2021 16:41:31 +0000
From:   Kalesh Singh <kaleshsingh@...gle.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     gregkh@...uxfoundation.org, surenb@...gle.com, hridya@...gle.com,
        john.reitan@....com, orjan.eide@....com, mark.underwood@....com,
        gary.sweet@...adcom.com, stephen.mansfield@...tec.com,
        mbalci@...cinc.com, mkrom@....qualcomm.com,
        kernel-team@...roid.com, Kalesh Singh <kaleshsingh@...gle.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] tracing/gpu: Add gpu_mem_imported tracepoint

The existing gpu_mem_total tracepoint allows GPU drivers a unifrom way
to report the per-process and system-wide GPU memory usage. This
tracepoint reports a single total of the GPU private allocations and the
imported memory. [1]

To allow distinguishing GPU private vs imported memory, add
gpu_mem_imported tracepoint.

GPU drivers can use this tracepoint to report the per-process and global
GPU-imported memory in a uniform way.

For backward compatility with already existing implementations of
gpu_mem_total by various Android GPU drivers, this is proposed as a new
tracepoint rather than additional args to gpu_mem_total.

[1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/

Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
---
 include/trace/events/gpu_mem.h | 51 ++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 15 deletions(-)

diff --git a/include/trace/events/gpu_mem.h b/include/trace/events/gpu_mem.h
index 26d871f96e94..b9543abf1461 100644
--- a/include/trace/events/gpu_mem.h
+++ b/include/trace/events/gpu_mem.h
@@ -13,21 +13,7 @@
 
 #include <linux/tracepoint.h>
 
-/*
- * The gpu_memory_total event indicates that there's an update to either the
- * global or process total gpu memory counters.
- *
- * This event should be emitted whenever the kernel device driver allocates,
- * frees, imports, unimports memory in the GPU addressable space.
- *
- * @gpu_id: This is the gpu id.
- *
- * @pid: Put 0 for global total, while positive pid for process total.
- *
- * @size: Size of the allocation in bytes.
- *
- */
-TRACE_EVENT(gpu_mem_total,
+DECLARE_EVENT_CLASS(gpu_mem_template,
 
 	TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
 
@@ -51,6 +37,41 @@ TRACE_EVENT(gpu_mem_total,
 		__entry->size)
 );
 
+/*
+ * The gpu_memory_total event indicates that there's an update to either the
+ * global or process total gpu memory counters.
+ *
+ * This event should be emitted whenever the kernel device driver allocates,
+ * frees, imports, unimports memory in the GPU addressable space.
+ *
+ * @gpu_id: This is the gpu id.
+ *
+ * @pid: Put 0 for global total, while positive pid for process total.
+ *
+ * @size: Size of the allocation in bytes.
+ *
+ */
+DEFINE_EVENT(gpu_mem_template, gpu_mem_total,
+	TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
+	TP_ARGS(gpu_id, pid, size));
+
+/*
+ * The gpu_mem_imported event indicates that there's an update to the
+ * global or process imported gpu memory counters.
+ *
+ * This event should be emitted whenever the kernel device driver imports
+ * or unimports memory (allocated externally) in the GPU addressable space.
+ *
+ * @gpu_id: This is the gpu id.
+ *
+ * @pid: Put 0 for global total, while positive pid for process total.
+ *
+ * @size: Size of the imported memory in bytes.
+ */
+DEFINE_EVENT(gpu_mem_template, gpu_mem_imported,
+	TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
+	TP_ARGS(gpu_id, pid, size));
+
 #endif /* _TRACE_GPU_MEM_H */
 
 /* This part must be outside protection */

base-commit: ff1176468d368232b684f75e82563369208bc371
-- 
2.32.0.432.gabb21c7263-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ