mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/msm: Report primary minor index as gpu_mem_total gpu_id
@ 2026-10-23  7:26 oushixiong1025
  2026-10-23 10:05 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: oushixiong1025 @ 2026-10-23  7:26 UTC (permalink / raw)
  To: Rob Clark
  Cc: Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, David Airlie, Simona Vetter, linux-arm-msm,
	dri-devel, freedreno, linux-kernel, Shixiong Ou

From: Shixiong Ou <oushixiong@kylinos.cn>

Both gpu_mem_total emissions hardcode gpu_id 0, so events from multiple
GPUs are indistinguishable. Report dev->primary->index instead, as xe
already does in commit ce3d39fae3d3 ("drm/xe/bo: add GPU memory trace
points").

Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
---
 drivers/gpu/drm/msm/msm_gem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 130ae27ee00b..46dada0b2fa0 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -28,7 +28,7 @@ MODULE_IMPORT_NS("DMA_BUF");
 static void update_device_mem(struct msm_drm_private *priv, ssize_t size)
 {
 	uint64_t total_mem = atomic64_add_return(size, &priv->total_mem);
-	trace_gpu_mem_total(0, 0, total_mem);
+	trace_gpu_mem_total(priv->dev->primary->index, 0, total_mem);
 }
 
 static void update_ctx_mem(struct drm_file *file, ssize_t size)
@@ -37,7 +37,8 @@ static void update_ctx_mem(struct drm_file *file, ssize_t size)
 	uint64_t ctx_mem = atomic64_add_return(size, &ctx->ctx_mem);
 
 	rcu_read_lock(); /* Locks file->pid! */
-	trace_gpu_mem_total(0, pid_nr(rcu_dereference(file->pid)), ctx_mem);
+	trace_gpu_mem_total(file->minor->dev->primary->index,
+			    pid_nr(rcu_dereference(file->pid)), ctx_mem);
 	rcu_read_unlock();
 
 }
-- 
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/msm: Report primary minor index as gpu_mem_total gpu_id
  2026-10-23  7:26 [PATCH] drm/msm: Report primary minor index as gpu_mem_total gpu_id oushixiong1025
@ 2026-10-23 10:05 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-10-23 10:05 UTC (permalink / raw)
  To: oushixiong1025, Rob Clark
  Cc: Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang, Sean Paul,
	Marijn Suijten, David Airlie, Simona Vetter, linux-arm-msm,
	dri-devel, freedreno, linux-kernel, Shixiong Ou

On 10/23/26 9:26 AM, oushixiong1025@163.com wrote:
> From: Shixiong Ou <oushixiong@kylinos.cn>
> 
> Both gpu_mem_total emissions hardcode gpu_id 0, so events from multiple
> GPUs are indistinguishable. Report dev->primary->index instead, as xe
> already does in commit ce3d39fae3d3 ("drm/xe/bo: add GPU memory trace
> points").
> 
> Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
> ---

Acked-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-23 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23  7:26 [PATCH] drm/msm: Report primary minor index as gpu_mem_total gpu_id oushixiong1025
2026-10-23 10:05 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®