dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Hung" <alex.hung@amd.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu: Fix __rcu fence pointer accesses
Date: Thu, 09 Jul 2026 22:55:39 +0000	[thread overview]
Message-ID: <20260709225540.0491E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709223312.475563-1-alex.hung@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Misuse of rcu_access_pointer() on a non-RCU annotated pointer (f->ops), which actively triggers a Sparse warning.
--

--- Patch [1]: [PATCH 1/2] drm/amdgpu: Fix __rcu fence pointer accesses ---
commit 5448af797b4d872eec1209aac5ec209c3c2b6b4a
Author: Alex Hung <alex.hung@amd.com>

drm/amdgpu: Fix __rcu fence pointer accesses

This commit uses rcu_access_pointer() to resolve sparse warnings when
comparing fence pointers in the KFD code. It wraps f->ops and an
eviction fence pointer to address 'incompatible types in comparison
expression' warnings.

Closes: https://lore.kernel.org/oe-kbuild-all/202607091659.SHEscT0c-lkp@intel.com/

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> index 31b8fa52b42fa..3419bad5c23a7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c
> @@ -92,7 +92,7 @@ struct amdgpu_amdkfd_fence *to_amdgpu_amdkfd_fence(struct dma_fence *f)
>  		return NULL;
>  
>  	fence = container_of(f, struct amdgpu_amdkfd_fence, base);
> -	if (f->ops == &amdkfd_fence_ops)
> +	if (rcu_access_pointer(f->ops) == &amdkfd_fence_ops)

[Severity: Low]
Is f->ops actually an __rcu-annotated pointer? 

Looking at struct dma_fence, the ops field is a standard
const struct dma_fence_ops * without the __rcu annotation.

Does wrapping a non-RCU pointer in rcu_access_pointer() trigger the exact
Sparse warning ("different address spaces") this commit aims to fix, since
the macro expects an __rcu pointer?

>  		return fence;
>  
>  	return NULL;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709223312.475563-1-alex.hung@amd.com?part=1

  parent reply	other threads:[~2026-07-09 22:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 22:33 [PATCH 1/2] drm/amdgpu: Fix __rcu fence pointer accesses Alex Hung
2026-07-09 22:33 ` [PATCH 2/2] drm/amdgpu: Pack nested ucode_info struct Alex Hung
2026-07-17 20:56   ` Harry Wentland
2026-07-09 22:55 ` sashiko-bot [this message]
2026-07-10  7:58 ` [PATCH 1/2] drm/amdgpu: Fix __rcu fence pointer accesses Christian König

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=20260709225540.0491E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alex.hung@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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