Skip to content

Commit 1105ac1

Browse files
matt-auldrodrigovivi
authored andcommitted
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 <matthew.auld@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Cc: Filip Hazubski <filip.hazubski@intel.com> Cc: Carl Zhang <carl.zhang@intel.com> Cc: Effie Yu <effie.yu@intel.com> Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 1bc56a9 commit 1105ac1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/gpu/drm/xe/xe_query.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ static int query_memory_usage(struct xe_device *xe,
128128
usage->regions[0].min_page_size = PAGE_SIZE;
129129
usage->regions[0].max_page_size = PAGE_SIZE;
130130
usage->regions[0].total_size = man->size << PAGE_SHIFT;
131-
usage->regions[0].used = ttm_resource_manager_usage(man);
131+
if (perfmon_capable())
132+
usage->regions[0].used = ttm_resource_manager_usage(man);
132133
usage->num_regions = 1;
133134

134135
for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
@@ -145,8 +146,13 @@ static int query_memory_usage(struct xe_device *xe,
145146
SZ_1G;
146147
usage->regions[usage->num_regions].total_size =
147148
man->size;
148-
usage->regions[usage->num_regions++].used =
149-
ttm_resource_manager_usage(man);
149+
150+
if (perfmon_capable()) {
151+
usage->regions[usage->num_regions].used =
152+
ttm_resource_manager_usage(man);
153+
}
154+
155+
usage->num_regions++;
150156
}
151157
}
152158

0 commit comments

Comments
 (0)