linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
@ 2021-08-31 17:02 Kalesh Singh
  2021-09-02 16:29 ` Kalesh Singh
  2021-09-03 20:30 ` Steven Rostedt
  0 siblings, 2 replies; 6+ messages in thread
From: Kalesh Singh @ 2021-08-31 17:02 UTC (permalink / raw)
  Cc: surenb, hridya, gregkh, john.reitan, orjan.eide, mark.underwood,
	gary.sweet, stephen.mansfield, kernel-team, Kalesh Singh,
	Steven Rostedt, Ingo Molnar, linux-kernel

The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
this new field to report the per-process and global GPU-imported memory
in a uniform way.

User space tools can detect and handle the old vs new gpu_mem_total
format via the gpu_mem/gpu_mem_total/format file.

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

Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
---
 include/trace/events/gpu_mem.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/trace/events/gpu_mem.h b/include/trace/events/gpu_mem.h
index 26d871f96e94..ae6fab6bab7b 100644
--- a/include/trace/events/gpu_mem.h
+++ b/include/trace/events/gpu_mem.h
@@ -15,7 +15,7 @@
 
 /*
  * The gpu_memory_total event indicates that there's an update to either the
- * global or process total gpu memory counters.
+ * global or process total and imported gpu memory counters.
  *
  * This event should be emitted whenever the kernel device driver allocates,
  * frees, imports, unimports memory in the GPU addressable space.
@@ -24,31 +24,36 @@
  *
  * @pid: Put 0 for global total, while positive pid for process total.
  *
- * @size: Size of the allocation in bytes.
+ * @size: Total size of allocated and imported memory in bytes.
+ *
+ * @imported_size: Total size of imported memory in bytes.
  *
  */
 TRACE_EVENT(gpu_mem_total,
 
-	TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
+	TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size, uint64_t imported_size),
 
-	TP_ARGS(gpu_id, pid, size),
+	TP_ARGS(gpu_id, pid, size, imported_size),
 
 	TP_STRUCT__entry(
 		__field(uint32_t, gpu_id)
 		__field(uint32_t, pid)
 		__field(uint64_t, size)
+		__field(uint64_t, imported_size)
 	),
 
 	TP_fast_assign(
 		__entry->gpu_id = gpu_id;
 		__entry->pid = pid;
 		__entry->size = size;
+		__entry->imported_size = imported_size;
 	),
 
-	TP_printk("gpu_id=%u pid=%u size=%llu",
+	TP_printk("gpu_id=%u pid=%u size=%llu imported_size=%llu",
 		__entry->gpu_id,
 		__entry->pid,
-		__entry->size)
+		__entry->size,
+		__entry->imported_size)
 );
 
 #endif /* _TRACE_GPU_MEM_H */

base-commit: 9c849ce86e0fa93a218614eac562ace44053d7ce
-- 
2.33.0.259.gc128427fd7-goog


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

* Re: [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
  2021-08-31 17:02 [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint Kalesh Singh
@ 2021-09-02 16:29 ` Kalesh Singh
  2021-09-03 20:30 ` Steven Rostedt
  1 sibling, 0 replies; 6+ messages in thread
From: Kalesh Singh @ 2021-09-02 16:29 UTC (permalink / raw)
  Cc: Suren Baghdasaryan, Hridya Valsaraju, Greg KH, John Reitan,
	Ørjan Eide, Mark Underwood, Gary Sweet, Stephen Mansfield,
	Cc: Android Kernel, Steven Rostedt, Ingo Molnar, LKML

On Tue, Aug 31, 2021 at 10:02 AM Kalesh Singh <kaleshsingh@google.com> wrote:
>
> The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
> imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
> this new field to report the per-process and global GPU-imported memory
> in a uniform way.
>
> User space tools can detect and handle the old vs new gpu_mem_total
> format via the gpu_mem/gpu_mem_total/format file.
>
> [1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/
>
> Signed-off-by: Kalesh Singh <kaleshsingh@google.com>

Friendly ping on this one, since Steve was out of office :)

If there are no other concerns, I would like to have it considered for merge.

Thanks,
Kalesh

> ---
>  include/trace/events/gpu_mem.h | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/include/trace/events/gpu_mem.h b/include/trace/events/gpu_mem.h
> index 26d871f96e94..ae6fab6bab7b 100644
> --- a/include/trace/events/gpu_mem.h
> +++ b/include/trace/events/gpu_mem.h
> @@ -15,7 +15,7 @@
>
>  /*
>   * The gpu_memory_total event indicates that there's an update to either the
> - * global or process total gpu memory counters.
> + * global or process total and imported gpu memory counters.
>   *
>   * This event should be emitted whenever the kernel device driver allocates,
>   * frees, imports, unimports memory in the GPU addressable space.
> @@ -24,31 +24,36 @@
>   *
>   * @pid: Put 0 for global total, while positive pid for process total.
>   *
> - * @size: Size of the allocation in bytes.
> + * @size: Total size of allocated and imported memory in bytes.
> + *
> + * @imported_size: Total size of imported memory in bytes.
>   *
>   */
>  TRACE_EVENT(gpu_mem_total,
>
> -       TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size),
> +       TP_PROTO(uint32_t gpu_id, uint32_t pid, uint64_t size, uint64_t imported_size),
>
> -       TP_ARGS(gpu_id, pid, size),
> +       TP_ARGS(gpu_id, pid, size, imported_size),
>
>         TP_STRUCT__entry(
>                 __field(uint32_t, gpu_id)
>                 __field(uint32_t, pid)
>                 __field(uint64_t, size)
> +               __field(uint64_t, imported_size)
>         ),
>
>         TP_fast_assign(
>                 __entry->gpu_id = gpu_id;
>                 __entry->pid = pid;
>                 __entry->size = size;
> +               __entry->imported_size = imported_size;
>         ),
>
> -       TP_printk("gpu_id=%u pid=%u size=%llu",
> +       TP_printk("gpu_id=%u pid=%u size=%llu imported_size=%llu",
>                 __entry->gpu_id,
>                 __entry->pid,
> -               __entry->size)
> +               __entry->size,
> +               __entry->imported_size)
>  );
>
>  #endif /* _TRACE_GPU_MEM_H */
>
> base-commit: 9c849ce86e0fa93a218614eac562ace44053d7ce
> --
> 2.33.0.259.gc128427fd7-goog
>

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

* Re: [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
  2021-08-31 17:02 [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint Kalesh Singh
  2021-09-02 16:29 ` Kalesh Singh
@ 2021-09-03 20:30 ` Steven Rostedt
  2021-09-03 22:36   ` Kalesh Singh
  1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-09-03 20:30 UTC (permalink / raw)
  To: Kalesh Singh
  Cc: surenb, hridya, gregkh, john.reitan, orjan.eide, mark.underwood,
	gary.sweet, stephen.mansfield, kernel-team, Ingo Molnar,
	linux-kernel

On Tue, 31 Aug 2021 17:02:29 +0000
Kalesh Singh <kaleshsingh@google.com> wrote:

> The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
> imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
> this new field to report the per-process and global GPU-imported memory
> in a uniform way.
> 
> User space tools can detect and handle the old vs new gpu_mem_total
> format via the gpu_mem/gpu_mem_total/format file.
> 
> [1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/
> 
> Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> ---
>  include/trace/events/gpu_mem.h | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 

This is that trace event that doesn't have any in tree callers, right? I
thought there was going to be some soon.

For the updates to the tracing side (besides not having any users), it
looks trivial to me.

Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

But this needs to be pulled in by one of the GPU maintainers.

-- Steve

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

* Re: [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
  2021-09-03 20:30 ` Steven Rostedt
@ 2021-09-03 22:36   ` Kalesh Singh
  2021-09-07 17:49     ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Kalesh Singh @ 2021-09-03 22:36 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Suren Baghdasaryan, Hridya Valsaraju, Greg KH, John Reitan,
	Ørjan Eide, Mark Underwood, Gary Sweet, Stephen Mansfield,
	Cc: Android Kernel, Ingo Molnar, LKML

On Fri, Sep 3, 2021 at 1:30 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Tue, 31 Aug 2021 17:02:29 +0000
> Kalesh Singh <kaleshsingh@google.com> wrote:
>
> > The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
> > imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
> > this new field to report the per-process and global GPU-imported memory
> > in a uniform way.
> >
> > User space tools can detect and handle the old vs new gpu_mem_total
> > format via the gpu_mem/gpu_mem_total/format file.
> >
> > [1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/
> >
> > Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> > ---
> >  include/trace/events/gpu_mem.h | 17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> >
>
> This is that trace event that doesn't have any in tree callers, right? I
> thought there was going to be some soon.

The trace event is currently used by the Android GPU drivers, and
there is some work ongoing to add this in drm core upstream but it's
not yet ready.

>
> For the updates to the tracing side (besides not having any users), it
> looks trivial to me.
>
> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>
> But this needs to be pulled in by one of the GPU maintainers.

Thanks for the review Steve. I'll resend adding the GPU maintainers.

>
> -- Steve

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

* Re: [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
  2021-09-03 22:36   ` Kalesh Singh
@ 2021-09-07 17:49     ` Steven Rostedt
  2021-09-07 17:52       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2021-09-07 17:49 UTC (permalink / raw)
  To: Kalesh Singh
  Cc: Suren Baghdasaryan, Hridya Valsaraju, Greg KH, John Reitan,
	Ørjan Eide, Mark Underwood, Gary Sweet, Stephen Mansfield,
	Cc: Android Kernel, Ingo Molnar, LKML, Greg Kroah-Hartman

On Fri, 3 Sep 2021 15:36:03 -0700
Kalesh Singh <kaleshsingh@google.com> wrote:

> On Fri, Sep 3, 2021 at 1:30 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Tue, 31 Aug 2021 17:02:29 +0000
> > Kalesh Singh <kaleshsingh@google.com> wrote:
> >  
> > > The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
> > > imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
> > > this new field to report the per-process and global GPU-imported memory
> > > in a uniform way.
> > >
> > > User space tools can detect and handle the old vs new gpu_mem_total
> > > format via the gpu_mem/gpu_mem_total/format file.
> > >
> > > [1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/
> > >
> > > Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> > > ---
> > >  include/trace/events/gpu_mem.h | 17 +++++++++++------
> > >  1 file changed, 11 insertions(+), 6 deletions(-)
> > >  
> >
> > This is that trace event that doesn't have any in tree callers, right? I
> > thought there was going to be some soon.  
> 
> The trace event is currently used by the Android GPU drivers, and
> there is some work ongoing to add this in drm core upstream but it's
> not yet ready.
> 
> >
> > For the updates to the tracing side (besides not having any users), it
> > looks trivial to me.
> >
> > Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> >
> > But this needs to be pulled in by one of the GPU maintainers.  
> 
> Thanks for the review Steve. I'll resend adding the GPU maintainers.

OK, so it was Greg that gave me the Ack to accept it.

I'll need his Ack again for the update.

-- Steve

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

* Re: [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint
  2021-09-07 17:49     ` Steven Rostedt
@ 2021-09-07 17:52       ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-09-07 17:52 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Kalesh Singh, Suren Baghdasaryan, Hridya Valsaraju, John Reitan,
	Ørjan Eide, Mark Underwood, Gary Sweet, Stephen Mansfield,
	Cc: Android Kernel, Ingo Molnar, LKML

On Tue, Sep 07, 2021 at 01:49:23PM -0400, Steven Rostedt wrote:
> On Fri, 3 Sep 2021 15:36:03 -0700
> Kalesh Singh <kaleshsingh@google.com> wrote:
> 
> > On Fri, Sep 3, 2021 at 1:30 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > On Tue, 31 Aug 2021 17:02:29 +0000
> > > Kalesh Singh <kaleshsingh@google.com> wrote:
> > >  
> > > > The existing gpu_mem_total tracepoint provides GPU drivers a uniform 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 an
> > > > imported_size field to the gpu_mem_total tracepoint. GPU drivers can use
> > > > this new field to report the per-process and global GPU-imported memory
> > > > in a uniform way.
> > > >
> > > > User space tools can detect and handle the old vs new gpu_mem_total
> > > > format via the gpu_mem/gpu_mem_total/format file.
> > > >
> > > > [1] https://lore.kernel.org/r/20200302234840.57188-1-zzyiwei@google.com/
> > > >
> > > > Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
> > > > ---
> > > >  include/trace/events/gpu_mem.h | 17 +++++++++++------
> > > >  1 file changed, 11 insertions(+), 6 deletions(-)
> > > >  
> > >
> > > This is that trace event that doesn't have any in tree callers, right? I
> > > thought there was going to be some soon.  
> > 
> > The trace event is currently used by the Android GPU drivers, and
> > there is some work ongoing to add this in drm core upstream but it's
> > not yet ready.
> > 
> > >
> > > For the updates to the tracing side (besides not having any users), it
> > > looks trivial to me.
> > >
> > > Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > >
> > > But this needs to be pulled in by one of the GPU maintainers.  
> > 
> > Thanks for the review Steve. I'll resend adding the GPU maintainers.
> 
> OK, so it was Greg that gave me the Ack to accept it.

Me?  Hah, I'm not a gpu developer, they are the ones that need to ack
this thing...

greg k-h

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

end of thread, other threads:[~2021-09-07 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 17:02 [RESEND v2] tracing/gpu: Add imported size to gpu_mem_imported tracepoint Kalesh Singh
2021-09-02 16:29 ` Kalesh Singh
2021-09-03 20:30 ` Steven Rostedt
2021-09-03 22:36   ` Kalesh Singh
2021-09-07 17:49     ` Steven Rostedt
2021-09-07 17:52       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).