Proposal to report GPU private memory allocations with sysfs nodes [plain text version]

Yiwei Zhang zzyiwei at google.com
Fri Mar 20 21:35:25 UTC 2020


Hi Rohan,

Thanks for your reply! We'd like the standardization to happen in the drm
layer so it can be carried along, however, debugfs has already been
deprecated in Android kernel and tracking per pid is most likely a doable
solution only in the device driver layer. So...since we'd still like the
low-cost run-time query system, we eventually end up doing the
tracepoint[1] + eBPF solution. We standardized a gpu memory total
tracepoint in upstream linux. Then the GPU vendors integrate into their
kernel driver to track those global and per-process total counters. Then we
wrote a bpf c program to track this tracepoint and maintain a map for the
userspace to poke at.

Best regards,
Yiwei

[1] https://lore.kernel.org/lkml/20200302235044.59163-1-zzyiwei@google.com



On Fri, Mar 20, 2020 at 5:07 AM Rohan Garg <rohan.garg at collabora.com> wrote:

> Hi Yiwei
> After some deliberation on how to move forward with my BO Labeling
> patches[1],
> we've come up with the following structure for debugfs entries:
>
> /debugfs/dri/128/bo/<handle>/label
> /debugfs/dri/128/bo/<handle>/size
>
> My initial idea was to count the total memory allocated for a particular
> label
> in kernel space, but that turned out to be far too complicated to
> implement.
> Which is why we decided to move towards something simpler and handle
> collating
> this information on the userspace side of things.
>
> Would this satisfy most of the Android  teams requirements? I understand
> that
> it would leave out the memory tracking requirements tied to a specific
> PID,
> but correct me if I'm wrong, would this not possible with gralloc on
> Android?
>
> Cheers
> Rohan Garg
>
> [1] https://patchwork.freedesktop.org/patch/335508/?series=66752&rev=4
>
> On lunes, 6 de enero de 2020 21:47:21 (CET) Yiwei Zhang wrote:
> > Thanks, I'll check it out.
> >
> > Best,
> > Yiwei
> >
> > On Mon, Jan 6, 2020 at 2:46 AM Rohan Garg <rohan.garg at collabora.com>
> wrote:
> > > Hi Yiwei
> > >
> > > On jueves, 19 de diciembre de 2019 19:52:26 (CET) Yiwei Zhang wrote:
> > > > Hi Rohan,
> > > >
> > > > Thanks for pointing out the pids issue! Then the index would be
> > >
> > > {namespace
> > >
> > > > + pid(in that namespace)}. I'll grab a setup and play with the
> driver to
> > > > see what I can do. I know how to find an Intel or Freedreno setup,
> but
> > >
> > > I'd
> > >
> > > > still like to know is there a development friendly Mali setup?
> > >
> > > You should be able to setup a Mali T860 compatible device with this
> guide
> > > [1].
> > >
> > > Cheers
> > > Rohan Garg
> > >
> > > [1] https://panfrost.freedesktop.org/building-panfrost-mesa.html
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20200320/7760b1b4/attachment.htm>


More information about the dri-devel mailing list