Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Filip Hazubski <filip.hazubski@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	Carl Zhang <carl.zhang@intel.com>, Effie Yu <effie.yu@intel.com>
Subject: Re: [Intel-xe] [PATCH v2 3/6] drm/xe/query: restrict system wide accounting
Date: Mon, 27 Mar 2023 11:09:59 +0100	[thread overview]
Message-ID: <2d7fd15b-4fd1-9795-cd52-31c1bbd77d93@intel.com> (raw)
In-Reply-To: <9563684e-90c4-6b39-1951-9fd0ed22f2f7@intel.com>

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@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@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>
>> ---
>>   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++;
>>           }
>>       }

  reply	other threads:[~2023-03-27 10:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 11:59 [Intel-xe] [PATCH v2 0/6] uAPI bits for small-bar Matthew Auld
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 1/6] drm/xe: add XE_BO_CREATE_VRAM_MASK Matthew Auld
2023-03-24 15:13   ` Souza, Jose
2023-03-24 15:40   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 2/6] drm/xe/bo: refactor try_add_vram Matthew Auld
2023-03-24 15:19   ` Souza, Jose
2023-03-24 15:53   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 3/6] drm/xe/query: restrict system wide accounting Matthew Auld
2023-03-24 15:20   ` Souza, Jose
2023-03-24 16:52   ` Gwan-gyeong Mun
2023-03-27 10:09     ` Matthew Auld [this message]
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 4/6] drm/xe/bo: support tiered vram allocation for small-bar Matthew Auld
2023-03-25 23:30   ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 5/6] drm/xe/uapi: add the userspace bits " Matthew Auld
2023-03-24 15:22   ` Souza, Jose
2023-03-27  4:37   ` Gwan-gyeong Mun
2023-03-27 10:00     ` Matthew Auld
2023-03-27 10:04       ` Gwan-gyeong Mun
2023-03-23 11:59 ` [Intel-xe] [PATCH v2 6/6] drm/xe: fully turn on small-bar support Matthew Auld
2023-03-27  4:42   ` Gwan-gyeong Mun
2023-03-23 12:02 ` [Intel-xe] ✓ CI.Patch_applied: success for uAPI bits for small-bar (rev2) Patchwork
2023-03-23 12:03 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-03-23 12:07 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-03-23 12:24 ` [Intel-xe] ○ CI.BAT: info " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d7fd15b-4fd1-9795-cd52-31c1bbd77d93@intel.com \
    --to=matthew.auld@intel.com \
    --cc=carl.zhang@intel.com \
    --cc=effie.yu@intel.com \
    --cc=filip.hazubski@intel.com \
    --cc=gwan-gyeong.mun@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox