Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: FlightlessMango <flightlessmangoyt@gmail.com>,
	intel-gfx@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Martin Peres <martin.peres@mupuf.org>
Subject: Re: [Intel-gfx] [OA][RFC] Exposing low-resolution engine business via sysfs
Date: Thu, 12 Jan 2023 08:55:35 +0000	[thread overview]
Message-ID: <cbacd042-83ea-254a-9e41-36acda4d0f8f@linux.intel.com> (raw)
In-Reply-To: <65afb3a4-bdc1-04a8-a2ac-6c561cddd710@gmail.com>


Hi,

On 12/01/2023 07:50, FlightlessMango wrote:
> Hi,
> 
> I am the developer of MangoHud[1], a Vulkan and OpenGL overlay for 
> monitoring FPS / temperatures / CPU/GPU load and more.
> 
> I would like to add support for i915 (and xe in the future) but I am 
> currently unable to do this easily because not everything I need is 
> exposed directly to non-root users. Namely:
> 
>   * Engine business (RCS)
>   * CPU, iGPU and dGPU power usage
>   * IMC bandwith (nice to have but not mandatory)
> 
> This is a problem because it would require us to ship a setuid binary to 
> poll these metrics for the overlay (we can't run games as root).
> 
> For your information, this is Intel-specific as AMD and NVIDIA are 
> exposing these values directly. I understand the security concerns, but 
> we are not asking for super precise information (1% accuracy is perfect).
> 
> Can we work together on this, what are your thoughts?

A few angles here. First of all, last time you raised it I think we 
didn't have per client engine busyness in fdinfo. So *if* you are 
satisfied with reading client's own busyness you can do it unprivileged 
via /proc/<pid>|self/fdinfo/<fd>.

Secondly, i915 internal stats, iGPU power usage and IMC are exposed via 
three separate perf/PMU drivers, of which this team (this mailing) is 
really responsible for only i915. The access controls for all though are 
common and provided by the core kernel. See 
/proc/sys/kernel/perf_event_paranoid and corresponding docs.

Long(-ish) time ago we have proposed making the latter a per PMU driver 
but that did not get any traction in the kernel.

Once you move to dGPU then for power you will get to use hwmon and for 
that one I am currently not familiar how access control works.

And finally for the new Xe driver I not aware how it will expose it so I 
am copying Rodrigo in case he knows.

In summary I personally see these options for what i915 stats are concerned:

1. You go with fdinfo and get what you can.

2. We try to propose per PMU access controls once more.

And then maybe the point below becomes less controversial, unlikely though.

3. You instruct users to configure /proc/sys/kernel/perf_event_paranoid, 
or convince the distros to setuid your tool, or something along those lines.

Regards,

Tvrtko

> 
> Thanks for your consideration.
> 
> //Simon Hallsten
> 
> [1] https://github.com/flightlessmango/MangoHud
> 
> 
> 

      reply	other threads:[~2023-01-12  8:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12  7:50 [Intel-gfx] [OA][RFC] Exposing low-resolution engine business via sysfs FlightlessMango
2023-01-12  8:55 ` Tvrtko Ursulin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbacd042-83ea-254a-9e41-36acda4d0f8f@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=flightlessmangoyt@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=martin.peres@mupuf.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox