All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Introduce a sysfs interface for lmem information
@ 2025-05-19 15:34 Krzysztof Niemiec
  2025-05-19 15:34 ` [RFC 1/2] drm/i915: Expose local memory information via sysfs Krzysztof Niemiec
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Krzysztof Niemiec @ 2025-05-19 15:34 UTC (permalink / raw)
  To: intel-gfx
  Cc: dri-devel, Andi Shyti, Janusz Krzysztofik, Krzysztof Karas,
	Sebastian Brzezinka, Chris Wilson, Joonas Lahtinen,
	Krzysztof Niemiec

Hi,

This series introduces a way for applications to read local memory
information via files in the sysfs. So far the only way to do this was
via i915_query ioctl. This is slightly less handy than sysfs for
external users. Additionally, the ioctl has a capability check which
limits which users of a system might use it to get information.

The goals of this series are:

	1) Introduce a simpler interface to access lmem information,
	2) Lift the CAP_PERFMON check on that information, OR provide
	   the administrator with a way to optionally lift it.

The first patch introduces the general mechanism without protections.
This will effectively lift a capability check on obtaining the memory
information. The second patch introduces that check back inside the
_show() functions, but also adds a sysctl parameter allowing to override
the checks, if an administrator so decides.

I'm sending this as RFC because I have a feeling that there's no
consensus whether memory information exposed in the patch should be
protected or not. Showing it to any user is strictly speaking an info
leak, but the severity thereof might be considered not that high, so I'd
rather leave it up to discussion first.

If we decide for lifting the check, the first patch is sufficient. If we
decide against it, the second patch protects the information by default,
but with a way to expose it as a conscious decision of the admin. I find
it a decent compromise.

This change has been requested in these parallel issues for i915 and Xe:

https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14153
https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4861

Thanks
Krzysztof

Krzysztof Niemiec (2):
  drm/i915: Expose local memory information via sysfs
  drm/i915: Add protections to sysfs local memory information

 drivers/gpu/drm/i915/i915_sysfs.c          |   6 +
 drivers/gpu/drm/i915/intel_memory_region.c | 136 +++++++++++++++++++++
 drivers/gpu/drm/i915/intel_memory_region.h |   3 +
 3 files changed, 145 insertions(+)

-- 
2.45.2
_

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

end of thread, other threads:[~2025-05-22  4:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 15:34 [RFC 0/2] Introduce a sysfs interface for lmem information Krzysztof Niemiec
2025-05-19 15:34 ` [RFC 1/2] drm/i915: Expose local memory information via sysfs Krzysztof Niemiec
2025-05-19 15:57   ` Jani Nikula
2025-05-19 18:08   ` kernel test robot
2025-05-20 14:25   ` Krzysztof Karas
2025-05-19 15:34 ` [RFC 2/2] drm/i915: Add protections to sysfs local memory information Krzysztof Niemiec
2025-05-20 14:39   ` Krzysztof Karas
2025-05-19 16:43 ` ✗ Fi.CI.CHECKPATCH: warning for Introduce a sysfs interface for lmem information Patchwork
2025-05-19 16:43 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-05-19 17:05 ` ✗ i915.CI.BAT: failure " Patchwork
2025-05-20 14:26 ` [RFC 0/2] " Krzysztof Karas
2025-05-20 15:01 ` Joonas Lahtinen
2025-05-20 17:46   ` Andi Shyti
2025-05-21 17:01     ` Krzysztof Niemiec
2025-05-21  8:06   ` Tvrtko Ursulin
2025-05-21 17:10     ` Krzysztof Niemiec
2025-05-22  4:31       ` Tvrtko Ursulin
2025-05-21 16:56   ` Krzysztof Niemiec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.