diff options
author | Matthew Auld <[email protected]> | 2023-03-31 09:46:24 +0100 |
---|---|---|
committer | Rodrigo Vivi <[email protected]> | 2023-12-21 11:34:59 -0500 |
commit | 1105ac15d2a151bc87c3fe0e79f95c5cde90f1eb (patch) | |
tree | f4a59ec38019943f82a0962a5ffa810fdf7f3731 | |
parent | 1bc56a934f11cc9bb859116d30e828ccf2df54cf (diff) |
drm/xe/uapi: restrict system wide accounting
Since this is considered an info leak (system wide accounting), rather
hide behind perfmon_capable().
v2:
- Without perfmon_capable() it likely makes more sense to report as zero,
instead of reporting as used == total size. This should give similar
behaviour as i915 which rather tracks free instead of used.
Signed-off-by: Matthew Auld <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Thomas Hellström <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: José Roberto de Souza <[email protected]>
Cc: Filip Hazubski <[email protected]>
Cc: Carl Zhang <[email protected]>
Cc: Effie Yu <[email protected]>
Cc: Gwan-gyeong Mun <[email protected]>
Reviewed-by: José Roberto de Souza <[email protected]>
Reviewed-by: Gwan-gyeong Mun <[email protected]>
Signed-off-by: Rodrigo Vivi <[email protected]>
-rw-r--r-- | drivers/gpu/drm/xe/xe_query.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c index c4165fa3428e..15e171ca7e62 100644 --- a/drivers/gpu/drm/xe/xe_query.c +++ b/drivers/gpu/drm/xe/xe_query.c @@ -128,7 +128,8 @@ static int query_memory_usage(struct xe_device *xe, usage->regions[0].min_page_size = PAGE_SIZE; usage->regions[0].max_page_size = PAGE_SIZE; usage->regions[0].total_size = man->size << PAGE_SHIFT; - usage->regions[0].used = ttm_resource_manager_usage(man); + if (perfmon_capable()) + usage->regions[0].used = ttm_resource_manager_usage(man); usage->num_regions = 1; for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) { @@ -145,8 +146,13 @@ static int query_memory_usage(struct xe_device *xe, SZ_1G; usage->regions[usage->num_regions].total_size = man->size; - usage->regions[usage->num_regions++].used = - ttm_resource_manager_usage(man); + + if (perfmon_capable()) { + usage->regions[usage->num_regions].used = + ttm_resource_manager_usage(man); + } + + usage->num_regions++; } } |