From: "Christian König" <christian.koenig@amd.com>
To: Saleemkhan Jamadar <saleemkhan083@gmail.com>,
alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually
Date: Mon, 3 Nov 2025 16:26:48 +0100 [thread overview]
Message-ID: <c982e61c-976e-49de-af88-5bedde45eab9@amd.com> (raw)
In-Reply-To: <20251103152401.9304-1-saleemkhan083@gmail.com>
On 11/3/25 16:24, Saleemkhan Jamadar wrote:
> This should not be used indiviually, use amdgpu_bo_gpu_offset
> with bo reserved.
>
> Signed-off-by: Saleemkhan Jamadar <saleemkhan083@gmail.com>
> Suggested-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 10 +++++++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> index 3040437d99c2..bc7858567321 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c
> @@ -129,7 +129,7 @@ uint32_t amdgpu_doorbell_index_on_bar(struct amdgpu_device *adev,
> {
> int db_bo_offset;
>
> - db_bo_offset = amdgpu_bo_gpu_offset_no_check(db_bo);
> + db_bo_offset = amdgpu_bo_gpu_offset(db_bo);
>
> /* doorbell index is 32 bit but doorbell's size can be 32 bit
> * or 64 bit, so *db_size(in byte)/4 for alignment.
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index b1ee9473d628..0a244f80426c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -93,7 +93,15 @@ mes_userq_create_wptr_mapping(struct amdgpu_userq_mgr *uq_mgr,
> return ret;
> }
>
> - queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset_no_check(wptr_obj->obj);
> + ret = amdgpu_bo_reserve(wptr_obj->obj, true);
> + if (ret) {
> + DRM_ERROR("Failed to reserve wptr bo\n");
> + return ret;
> + }
> +
> + queue->wptr_obj.gpu_addr = amdgpu_bo_gpu_offset(wptr_obj->obj);
> + amdgpu_bo_unreserve(wptr_obj->obj);
The problem here is that the return value of amdgpu_bo_gpu_offset() can change as soon as you unlock the BO.
So that wptr BO either need to be pinned or fenced for this to work.
Regards,
Christian.
> +
> return 0;
> }
>
next prev parent reply other threads:[~2025-11-03 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 15:24 [PATCH] drm/amdgpu: do not use amdgpu_bo_gpu_offset_no_check individually Saleemkhan Jamadar
2025-11-03 15:26 ` Christian König [this message]
2025-11-03 21:00 ` Alex Deucher
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=c982e61c-976e-49de-af88-5bedde45eab9@amd.com \
--to=christian.koenig@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=saleemkhan083@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