[Intel-xe] [PATCH v6 2/6] drm/xe/uapi: restrict system wide accounting
Matthew Auld
matthew.auld at intel.com
Mon Jun 19 11:00:21 UTC 2023
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 <matthew.auld at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Cc: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: José Roberto de Souza <jose.souza at intel.com>
Cc: Filip Hazubski <filip.hazubski at intel.com>
Cc: Carl Zhang <carl.zhang at intel.com>
Cc: Effie Yu <effie.yu at intel.com>
Cc: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
Reviewed-by: José Roberto de Souza <jose.souza at intel.com>
Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
---
drivers/gpu/drm/xe/xe_query.c | 12 +++++++++---
1 file 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++;
}
}
--
2.41.0
More information about the Intel-xe
mailing list