* [PATCH] drm/xe/uapi: loosen used tracking restriction
@ 2025-09-19 12:20 Matthew Auld
2025-09-19 21:19 ` Rodrigo Vivi
2025-09-19 23:05 ` Lucas De Marchi
0 siblings, 2 replies; 3+ messages in thread
From: Matthew Auld @ 2025-09-19 12:20 UTC (permalink / raw)
To: intel-xe
Cc: Thomas Hellström, Joshua Santosh, José Roberto de Souza,
Matthew Brost, Rodrigo Vivi, stable
Currently this is hidden behind perfmon_capable() since this is
technically an info leak, given that this is a system wide metric.
However the granularity reported here is always PAGE_SIZE aligned, which
matches what the core kernel is already willing to expose to userspace
if querying how many free RAM pages there are on the system, and that
doesn't need any special privileges. In addition other drm drivers seem
happy to expose this.
The motivation here if with oneAPI where they want to use the system
wide 'used' reporting here, so not the per-client fdinfo stats. This has
also come up with some perf overlay applications wanting this
information.
Fixes: 1105ac15d2a1 ("drm/xe/uapi: restrict system wide accounting")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Joshua Santosh <joshua.santosh.ranjan@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
---
drivers/gpu/drm/xe/xe_query.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index e1b603aba61b..2e9ff33ed2fe 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -276,8 +276,7 @@ static int query_mem_regions(struct xe_device *xe,
mem_regions->mem_regions[0].instance = 0;
mem_regions->mem_regions[0].min_page_size = PAGE_SIZE;
mem_regions->mem_regions[0].total_size = man->size << PAGE_SHIFT;
- if (perfmon_capable())
- mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man);
+ mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man);
mem_regions->num_mem_regions = 1;
for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
@@ -293,13 +292,11 @@ static int query_mem_regions(struct xe_device *xe,
mem_regions->mem_regions[mem_regions->num_mem_regions].total_size =
man->size;
- if (perfmon_capable()) {
- xe_ttm_vram_get_used(man,
- &mem_regions->mem_regions
- [mem_regions->num_mem_regions].used,
- &mem_regions->mem_regions
- [mem_regions->num_mem_regions].cpu_visible_used);
- }
+ xe_ttm_vram_get_used(man,
+ &mem_regions->mem_regions
+ [mem_regions->num_mem_regions].used,
+ &mem_regions->mem_regions
+ [mem_regions->num_mem_regions].cpu_visible_used);
mem_regions->mem_regions[mem_regions->num_mem_regions].cpu_visible_size =
xe_ttm_vram_get_cpu_visible_size(man);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/xe/uapi: loosen used tracking restriction
2025-09-19 12:20 [PATCH] drm/xe/uapi: loosen used tracking restriction Matthew Auld
@ 2025-09-19 21:19 ` Rodrigo Vivi
2025-09-19 23:05 ` Lucas De Marchi
1 sibling, 0 replies; 3+ messages in thread
From: Rodrigo Vivi @ 2025-09-19 21:19 UTC (permalink / raw)
To: Matthew Auld
Cc: intel-xe, Thomas Hellström, Joshua Santosh,
José Roberto de Souza, Matthew Brost, stable
On Fri, Sep 19, 2025 at 01:20:53PM +0100, Matthew Auld wrote:
> Currently this is hidden behind perfmon_capable() since this is
> technically an info leak, given that this is a system wide metric.
> However the granularity reported here is always PAGE_SIZE aligned, which
> matches what the core kernel is already willing to expose to userspace
> if querying how many free RAM pages there are on the system, and that
> doesn't need any special privileges. In addition other drm drivers seem
> happy to expose this.
>
> The motivation here if with oneAPI where they want to use the system
> wide 'used' reporting here, so not the per-client fdinfo stats. This has
> also come up with some perf overlay applications wanting this
> information.
>
> Fixes: 1105ac15d2a1 ("drm/xe/uapi: restrict system wide accounting")
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Joshua Santosh <joshua.santosh.ranjan@intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: <stable@vger.kernel.org> # v6.8+
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_query.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index e1b603aba61b..2e9ff33ed2fe 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -276,8 +276,7 @@ static int query_mem_regions(struct xe_device *xe,
> mem_regions->mem_regions[0].instance = 0;
> mem_regions->mem_regions[0].min_page_size = PAGE_SIZE;
> mem_regions->mem_regions[0].total_size = man->size << PAGE_SHIFT;
> - if (perfmon_capable())
> - mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man);
> + mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man);
> mem_regions->num_mem_regions = 1;
>
> for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
> @@ -293,13 +292,11 @@ static int query_mem_regions(struct xe_device *xe,
> mem_regions->mem_regions[mem_regions->num_mem_regions].total_size =
> man->size;
>
> - if (perfmon_capable()) {
> - xe_ttm_vram_get_used(man,
> - &mem_regions->mem_regions
> - [mem_regions->num_mem_regions].used,
> - &mem_regions->mem_regions
> - [mem_regions->num_mem_regions].cpu_visible_used);
> - }
> + xe_ttm_vram_get_used(man,
> + &mem_regions->mem_regions
> + [mem_regions->num_mem_regions].used,
> + &mem_regions->mem_regions
> + [mem_regions->num_mem_regions].cpu_visible_used);
>
> mem_regions->mem_regions[mem_regions->num_mem_regions].cpu_visible_size =
> xe_ttm_vram_get_cpu_visible_size(man);
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/xe/uapi: loosen used tracking restriction
2025-09-19 12:20 [PATCH] drm/xe/uapi: loosen used tracking restriction Matthew Auld
2025-09-19 21:19 ` Rodrigo Vivi
@ 2025-09-19 23:05 ` Lucas De Marchi
1 sibling, 0 replies; 3+ messages in thread
From: Lucas De Marchi @ 2025-09-19 23:05 UTC (permalink / raw)
To: Matthew Auld
Cc: intel-xe, Thomas Hellström, Joshua Santosh,
José Roberto de Souza, Matthew Brost, Rodrigo Vivi, stable
On Fri, Sep 19, 2025 at 01:20:53PM +0100, Matthew Auld wrote:
>Currently this is hidden behind perfmon_capable() since this is
>technically an info leak, given that this is a system wide metric.
>However the granularity reported here is always PAGE_SIZE aligned, which
>matches what the core kernel is already willing to expose to userspace
>if querying how many free RAM pages there are on the system, and that
>doesn't need any special privileges. In addition other drm drivers seem
>happy to expose this.
>
>The motivation here if with oneAPI where they want to use the system
>wide 'used' reporting here, so not the per-client fdinfo stats. This has
>also come up with some perf overlay applications wanting this
>information.
>
>Fixes: 1105ac15d2a1 ("drm/xe/uapi: restrict system wide accounting")
>Signed-off-by: Matthew Auld <matthew.auld@intel.com>
>Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>Cc: Joshua Santosh <joshua.santosh.ranjan@intel.com>
>Cc: José Roberto de Souza <jose.souza@intel.com>
>Cc: Matthew Brost <matthew.brost@intel.com>
>Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Lucas De Marchi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-19 23:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 12:20 [PATCH] drm/xe/uapi: loosen used tracking restriction Matthew Auld
2025-09-19 21:19 ` Rodrigo Vivi
2025-09-19 23:05 ` Lucas De Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox