[Intel-xe] [PATCH v2 3/6] drm/xe/query: restrict system wide accounting

Matthew Auld matthew.auld at intel.com
Mon Mar 27 10:09:59 UTC 2023


On 24/03/2023 16:52, Gwan-gyeong Mun wrote:
> looks good to me.
> 
> btw, it is similar to the constraint attribute described in this article,
> https://docs.kernel.org/gpu/rfc/i915_small_bar.html#probed-cpu-visible-size-attribute
> do you have any plan to add a small bar related doc for xe?

Yeah, that should be the same stuff. I think we can at least add 
kernel-doc for the xe query related bits, and copy-paste some of the 
stuff from i915 for the small-bar bits. Will fix.

> 
> Reviewed-by: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>

Thanks.

> 
> On 3/23/23 1:59 PM, Matthew Auld wrote:
>> Since this is considered an info leak (system wide accounting), rather
>> hide behind perfmon_capable().
>>
>> 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>
>> ---
>>   drivers/gpu/drm/xe/xe_query.c | 17 ++++++++++++++---
>>   1 file changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_query.c 
>> b/drivers/gpu/drm/xe/xe_query.c
>> index 0f70945176f6..9ff806cafcdd 100644
>> --- a/drivers/gpu/drm/xe/xe_query.c
>> +++ b/drivers/gpu/drm/xe/xe_query.c
>> @@ -127,7 +127,10 @@ 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);
>> +    else
>> +        usage->regions[0].used = usage->regions[0].total_size;
>>       usage->num_regions = 1;
>>       for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
>> @@ -144,8 +147,16 @@ 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);
>> +            } else {
>> +                usage->regions[usage->num_regions].used =
>> +                    man->size;
>> +            }
>> +
>> +            usage->num_regions++;
>>           }
>>       }


More information about the Intel-xe mailing list