Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Li Sheng" <wirsbf@gmail.com>, intel-xe@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Lock BO in xe_bo_dma_unmap_pinned()
Date: Sun, 06 Dec 2026 04:03:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-252137@kernel.org> (raw)
In-Reply-To: <20261206034613.558542-1-wirsbf@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/xe: stale xe_oa_quiesce_gt() comment and omitted caller in
  commit log
--

commit ea3e3665aedf57056b31951b4e309f08ebe463ae
Author: Li Sheng <wirsbf@gmail.com>

drm/xe: Lock BO in xe_bo_dma_unmap_pinned()

This commit acquires the BO reservation lock in xe_bo_dma_unmap_pinned()
before reading ttm_bo->ttm and unmapping its scatter-gather table.

> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index c89b39b503fe1..febfda24163db 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -1878,7 +1878,10 @@ int xe_bo_restore_pinned(struct xe_bo *bo)
>  int xe_bo_dma_unmap_pinned(struct xe_bo *bo)
>  {
>  	struct ttm_buffer_object *ttm_bo = &bo->ttm;
> -	struct ttm_tt *tt = ttm_bo->ttm;
> +	struct ttm_tt *tt;
> +
> +	xe_bo_lock(bo, false);
> +	tt = ttm_bo->ttm;
>  
>  	if (tt) {
>  		struct xe_ttm_tt *xe_tt = container_of(tt, typeof(*xe_tt), ttm);

[Severity: Low]
Should this patch also update the comment in xe_oa_quiesce_gt()?

drivers/gpu/drm/xe/xe_oa.c:xe_oa_quiesce_gt() {
	...
		/*
		 * The OA buffer stays pinned until the stream fd is released, an mmap may still
		 * hold a reference on it. Drop its DMA mapping now: the fd may be released, and
		 * the BO unpinned, while xe_bo_pinned_fini() DMA-unmaps it without the BO lock.
		 */
		xe_bo_dma_unmap_pinned(stream->oa_buffer.bo);
	...
}

Once xe_bo_dma_unmap_pinned() takes xe_bo_lock(), xe_bo_pinned_fini() no
longer DMA-unmaps the BO without the BO lock, which makes that comment
stale and makes the early call worth re-evaluating or re-documenting.

The commit message also omits xe_oa_quiesce_gt() when listing the callers
of xe_bo_dma_unmap_pinned().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206034613.558542-1-wirsbf@gmail.com?part=1

           reply	other threads:[~2026-12-06  4:03 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261206034613.558542-1-wirsbf@gmail.com>]

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=sashiko-outbox-252137@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wirsbf@gmail.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