Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Tejas Upadhyay <tejas.upadhyay@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <matthew.brost@intel.com>
Subject: Re: [PATCH 3/4] drm/xe: Drop RCU list handling for VRAM bad-page tracking, use mgr->lock
Date: Thu, 1 Oct 2026 15:56:24 +0530	[thread overview]
Message-ID: <fb9de556-4428-497b-afcf-3e3c5a4a65ec@intel.com> (raw)
In-Reply-To: <20261001094518.1493651-9-tejas.upadhyay@intel.com>



On 01-10-2026 15:15, Tejas Upadhyay wrote:
> queued_pages and offlined_pages were mutated with list_add_rcu()/
> list_del_rcu()/kfree_rcu(), but the only lockless consumer was the
> vram_bad_pages debugfs show function. Every other reader and writer
> already runs under mgr->lock, so the RCU protection bought nothing
> but complexity and a rcu_head field on every tracked entry.
> 
> Convert all list operations to plain list_add()/list_del()/kfree(),
> including the retry helper added by the ghost-ownership fix, and
> have vram_bad_pages_show() take mgr->lock instead of rcu_read_lock()
> so list traversal is always serialized against mutation.
> 
> Fixes: 7737f819e9f1 ("drm/xe/vram: Add VRAM page offline fault handler")
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_ttm_vram_mgr.c       | 26 +++++++++++-----------
>   drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h |  2 --
>   2 files changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index ed79e4c6ba1a..7211ab5f66e9 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -243,9 +243,9 @@ static void xe_ttm_vram_retry_queued_pages(struct xe_ttm_vram_mgr *mgr)
>   			continue;
>   		}
>   		--mgr->n_queued_pages;
> -		list_del_rcu(&pos->queued_link);
> +		list_del(&pos->queued_link);
>   		++mgr->n_offlined_pages;
> -		list_add_rcu(&pos->offlined_link, &mgr->offlined_pages);
> +		list_add(&pos->offlined_link, &mgr->offlined_pages);
>   	}
>   }
>   
> @@ -394,17 +394,17 @@ static void xe_ttm_vram_free_bad_pages(struct xe_ttm_vram_mgr *mgr)
>   	struct xe_ttm_vram_offline_resource *pos, *n;
>   
>   	list_for_each_entry_safe(pos, n, &mgr->offlined_pages, offlined_link) {
> -		list_del_rcu(&pos->offlined_link);
> +		list_del(&pos->offlined_link);
>   		xe_ttm_vram_buddy_free(mgr, &pos->blocks, pos->used_visible_size);
>   		--mgr->n_offlined_pages;
> -		kfree_rcu(pos, rcu);
> +		kfree(pos);
>   	}
>   	list_for_each_entry_safe(pos, n, &mgr->queued_pages, queued_link) {
> -		list_del_rcu(&pos->queued_link);
> +		list_del(&pos->queued_link);
>   		/* queued entries have no buddy reservation yet */
>   		xe_ttm_vram_buddy_free(mgr, &pos->blocks, 0);
>   		--mgr->n_queued_pages;
> -		kfree_rcu(pos, rcu);
> +		kfree(pos);
>   	}
>   }
>   
> @@ -823,7 +823,7 @@ static int xe_ttm_vram_reserve_page_at_addr(struct xe_device *xe, u64 addr,
>   			}
>   			/* Queue free(to-be-purged) pages */
>   			++vram_mgr->n_queued_pages;
> -			list_add_rcu(&nentry->queued_link, &vram_mgr->queued_pages);
> +			list_add(&nentry->queued_link, &vram_mgr->queued_pages);
>   		} else {
>   			/* Immediately offline unoccupied pages */
>   			/* Queue free(to-be-reserved) pages */
> @@ -837,11 +837,11 @@ static int xe_ttm_vram_reserve_page_at_addr(struct xe_device *xe, u64 addr,
>   					"Page at addr:0x%llx still busy (%d), deferring reservation\n",
>   					addr, ret);
>   				++vram_mgr->n_queued_pages;
> -				list_add_rcu(&nentry->queued_link, &vram_mgr->queued_pages);
> +				list_add(&nentry->queued_link, &vram_mgr->queued_pages);
>   				return 0;
>   			}
>   			++vram_mgr->n_offlined_pages;
> -			list_add_rcu(&nentry->offlined_link, &vram_mgr->offlined_pages);
> +			list_add(&nentry->offlined_link, &vram_mgr->offlined_pages);
>   			return ret;
>   		}
>   	}
> @@ -1045,16 +1045,16 @@ static int vram_bad_pages_show(struct seq_file *m, void *unused)
>   			continue;
>   		mgr = to_xe_ttm_vram_mgr(man);
>   
> -		rcu_read_lock();
> +		mutex_lock(&mgr->lock);
>   
> -		list_for_each_entry_rcu(pos, &mgr->offlined_pages, offlined_link) {
> +		list_for_each_entry(pos, &mgr->offlined_pages, offlined_link) {
>   			u64 pfn;
>   
>   			pfn = (pos->addr + vr->dpa_base) >> PAGE_SHIFT;
>   			seq_printf(m, "0x%016llx : 0x%016lx : R\n", pfn, PAGE_SIZE);
>   		}
>   
> -		list_for_each_entry_rcu(pos, &mgr->queued_pages, queued_link) {
> +		list_for_each_entry(pos, &mgr->queued_pages, queued_link) {
>   			u64 pfn;
>   
>   			pfn = (pos->addr + vr->dpa_base) >> PAGE_SHIFT;
> @@ -1062,7 +1062,7 @@ static int vram_bad_pages_show(struct seq_file *m, void *unused)
>   				   pfn, PAGE_SIZE, pos->status ? 'F' : 'P');
>   		}
>   
> -		rcu_read_unlock();
> +		mutex_unlock(&mgr->lock);
>   	}
>   
>   	return 0;
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> index 95a427e3b0a7..ef7e4c87a7bb 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
> @@ -81,8 +81,6 @@ struct xe_ttm_vram_offline_resource {
>   	u64 addr;
>   	/** @status: buddy reservation status */
>   	enum xe_page_reserve_status status;
> -	/** @rcu: RCU head for deferred freeing */
> -	struct rcu_head rcu;

Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

>   };
>   
>   #endif


  reply	other threads:[~2026-10-01 10:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  9:45 [PATCH 0/4] Followup fixes for memory page offline Tejas Upadhyay
2026-10-01  9:45 ` [PATCH 1/4] drm/xe: Clean up kernel-doc typos in VRAM manager Tejas Upadhyay
2026-10-01 10:25   ` Ghimiray, Himal Prasad
2026-10-01  9:45 ` [PATCH 2/4] drm/xe: Re-validate external pin under resv lock before VRAM purge Tejas Upadhyay
2026-10-05  6:58   ` Ghimiray, Himal Prasad
2026-10-01  9:45 ` [PATCH 3/4] drm/xe: Drop RCU list handling for VRAM bad-page tracking, use mgr->lock Tejas Upadhyay
2026-10-01 10:26   ` Ghimiray, Himal Prasad [this message]
2026-10-01  9:45 ` [PATCH 4/4] drm/xe: Keep VRAM fault injection within the usable range Tejas Upadhyay
2026-10-01 10:01   ` sashiko-bot
2026-10-05  6:13     ` Upadhyay, Tejas
2026-10-01 10:27   ` Ghimiray, Himal Prasad
2026-10-01  9:53 ` ✓ CI.KUnit: success for Followup fixes for memory page offline Patchwork
2026-10-01 13:19 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-01 17:19 ` ✗ Xe.CI.FULL: 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=fb9de556-4428-497b-afcf-3e3c5a4a65ec@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=tejas.upadhyay@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