public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Yadav, Arvind" <arvind.yadav@intel.com>
To: Matthew Brost <matthew.brost@intel.com>,
	Tejas Upadhyay <tejas.upadhyay@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.auld@intel.com>,
	<thomas.hellstrom@linux.intel.com>,
	<himal.prasad.ghimiray@intel.com>
Subject: Re: [RFC PATCH V7 05/10] drm/xe: Extend BO purge to handle vram pages as well
Date: Tue, 5 May 2026 13:45:01 +0530	[thread overview]
Message-ID: <a6bc1c52-e070-4c4f-a331-b1fe008632f6@intel.com> (raw)
In-Reply-To: <afLQGypRcDWYSAjb@gsse-cloud1.jf.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2902 bytes --]


On 30-04-2026 09:14, Matthew Brost wrote:
> On Thu, Apr 16, 2026 at 01:19:54PM +0530, Tejas Upadhyay wrote:
>> Recent driver update introduce support for purgeable buffer
>> objects (BOs), extending the API to include VRAM pages to
>> better manage memory pressure and enable memory offlining.
>>
>> Signed-off-by: Tejas Upadhyay<tejas.upadhyay@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_bo.c | 5 +----
>>   drivers/gpu/drm/xe/xe_bo.h | 1 +
>>   2 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
>> index 5ce60d161e09..04d3b25c7c8e 100644
>> --- a/drivers/gpu/drm/xe/xe_bo.c
>> +++ b/drivers/gpu/drm/xe/xe_bo.c
>> @@ -903,7 +903,7 @@ void xe_bo_set_purgeable_state(struct xe_bo *bo,
>>    *
>>    * Return: 0 on success, negative error code on failure
>>    */
>> -static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx)
>> +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx)
>>   {
>>   	struct xe_bo *bo = ttm_to_xe_bo(ttm_bo);
>>   	struct ttm_placement place = {};
>> @@ -911,9 +911,6 @@ static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operatio
>>   
>>   	xe_bo_assert_held(bo);
>>   
>> -	if (!ttm_bo->ttm)
>> -		return 0;
>> -
> I think blindly deleting this is fine but I'd run this by Arvind to make
> sure in normal purge flow this won't do anything bad but afiak in normal
> purge flows ttm_bo->ttm will never be NULL.


The purge paths (|xe_bo_move(evict=true, DONTNEED)| and |swap_notify|), 
|ttm_bo->ttm| is always non‑NULL. TTM allocates |ttm_tt| before invoking 
|->move| on a populated BO. So removing this check is safe.

~Arvind


>
> If not then adjust the existing call...
>
> @@ -978,7 +978,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
>           * The move_notify callback will handle invalidation asynchronously.
>           */
>          if (evict && xe_bo_madv_is_dontneed(bo)) {
> -               ret = xe_ttm_bo_purge(ttm_bo, ctx);
> +               if (ttm_bo->ttm)
> +                       ret = xe_ttm_bo_purge(ttm_bo, ctx);
>                  if (ret)
>                          return ret;
>
> Matt
>
>>   	if (!xe_bo_madv_is_dontneed(bo))
>>   		return 0;
>>   
>> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
>> index 68dea7d25a6b..9f55b3589caf 100644
>> --- a/drivers/gpu/drm/xe/xe_bo.h
>> +++ b/drivers/gpu/drm/xe/xe_bo.h
>> @@ -500,6 +500,7 @@ struct xe_bo_shrink_flags {
>>   long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo,
>>   		  const struct xe_bo_shrink_flags flags,
>>   		  unsigned long *scanned);
>> +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx);
>>   
>>   /**
>>    * xe_bo_is_mem_type - Whether the bo currently resides in the given
>> -- 
>> 2.52.0
>>

[-- Attachment #2: Type: text/html, Size: 3703 bytes --]

  parent reply	other threads:[~2026-05-05  8:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  7:49 [RFC PATCH V7 00/10] Add memory page offlining support Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 01/10] drm/xe: Link VRAM object with gpu buddy Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 02/10] gpu/buddy: Integrate lockdep for gpu buddy manager Tejas Upadhyay
2026-04-16  8:55   ` Matthew Auld
2026-04-16  9:43     ` Upadhyay, Tejas
2026-04-16  9:56       ` Matthew Auld
2026-04-16 10:04         ` Upadhyay, Tejas
2026-04-16 10:15           ` Matthew Auld
2026-04-16 10:18             ` Upadhyay, Tejas
2026-04-16  7:49 ` [RFC PATCH V7 03/10] drm/gpu: Add gpu_buddy_allocated_addr_to_block helper Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 04/10] drm/xe: Link LRC BO and its execution Queue Tejas Upadhyay
2026-04-30  3:34   ` Matthew Brost
2026-05-04  9:11     ` Upadhyay, Tejas
2026-04-16  7:49 ` [RFC PATCH V7 05/10] drm/xe: Extend BO purge to handle vram pages as well Tejas Upadhyay
2026-04-30  3:44   ` Matthew Brost
2026-04-30 12:08     ` Upadhyay, Tejas
2026-05-05  8:15     ` Yadav, Arvind [this message]
2026-04-16  7:49 ` [RFC PATCH V7 06/10] drm/xe: Handle physical memory address error Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 07/10] drm/xe/cri: Add debugfs to inject faulty vram address Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 08/10] gpu/buddy: Add routine to dump allocated buddy blocks Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 09/10] drm/xe/configfs: Add vram bad page reservation policy Tejas Upadhyay
2026-04-16  7:49 ` [RFC PATCH V7 10/10] drm/xe/cri: Add sysfs interface for bad gpu vram pages Tejas Upadhyay
2026-04-30 13:53   ` Matthew Auld
2026-05-04  9:02     ` Upadhyay, Tejas
2026-05-05  8:44       ` Matthew Auld
2026-04-16  7:56 ` ✗ CI.checkpatch: warning for Add memory page offlining support (rev8) Patchwork
2026-04-16  7:57 ` ✗ CI.KUnit: failure " 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=a6bc1c52-e070-4c4f-a331-b1fe008632f6@intel.com \
    --to=arvind.yadav@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=tejas.upadhyay@intel.com \
    --cc=thomas.hellstrom@linux.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