AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Benjamin Cheng" <benjamin.cheng@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 10/10] drm/amdgpu/object: get rid of amdgpu_bo_fence
Date: Wed, 18 Nov 2026 19:29:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-221861@kernel.org> (raw)
In-Reply-To: <20261118190735.1863676-11-benjamin.cheng@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/amdgpu: removing amdgpu_bo_fence() breaks
  amdgpu_gem_object_close() build
--

commit 6a4de07fd2509683647edc1a8831db741d691fd3
Author: Benjamin Cheng <benjamin.cheng@amd.com>

drm/amdgpu/object: get rid of amdgpu_bo_fence

This commit removes the definition and declaration of amdgpu_bo_fence().

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 6aa895f63aeaf..7fc43363ec626 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1441,31 +1441,6 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>  	return 0;
>  }
>  
> -/**
> - * amdgpu_bo_fence - add fence to buffer object
> - *
> - * @bo: buffer object in question
> - * @fence: fence to add
> - * @shared: true if fence should be added shared
> - *
> - */
> -void amdgpu_bo_fence(struct amdgpu_bo *bo, struct dma_fence *fence,
> -		     bool shared)
> -{
> -	struct dma_resv *resv = bo->tbo.base.resv;
> -	int r;
> -
> -	r = dma_resv_reserve_fences(resv, 1);
> -	if (r) {
> -		/* As last resort on OOM we block for the fence */
> -		dma_fence_wait(fence, false);
> -		return;
> -	}
> -
> -	dma_resv_add_fence(resv, fence, shared ? DMA_RESV_USAGE_READ :
> -			   DMA_RESV_USAGE_WRITE);
> -}
> -
>  /**
>   * amdgpu_bo_sync_wait_resv - Wait for BO reservation fences
>   *

[Severity: High]
Does removing amdgpu_bo_fence() break the build in
amdgpu_gem_object_close()?

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c:amdgpu_gem_object_close() {
	...
	r = amdgpu_vm_clear_freed(adev, vm, &fence);
	if (unlikely(r < 0) && !drm_dev_is_unplugged(adev_to_drm(adev)))
		dev_err(adev->dev, "failed to clear page "
			"tables on GEM object close (%ld)\n", r);
	if (r || !fence)
		goto out_unlock;

	amdgpu_bo_fence(bo, fence, true);
	dma_fence_put(fence);
	...
}

amdgpu_gem_object_close() still calls amdgpu_bo_fence(), so removing it
causes compilation of amdgpu_gem.c to fail with an implicit function
declaration error.

Also note that in amdgpu_gem_object_close(), drm_exec_prepare_obj(&exec,
&bo->tbo.base, 1) is followed by amdgpu_vm_lock_pd(vm, &exec,
AMDGPU_VM_UPDATE_FENCES).  Because dma_resv_reserve_fences() is not
additive, only AMDGPU_VM_UPDATE_FENCES slots remain reserved when bo
shares the VM root PD dma_resv, while amdgpu_vm_clear_freed() plus adding
the fence to bo requires AMDGPU_VM_UPDATE_FENCES + 1 slots if replaced
with a direct dma_resv_add_fence() call.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118190735.1863676-1-benjamin.cheng@amd.com?part=10

  reply	other threads:[~2026-11-18 19:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 19:07 [PATCH v2 00/10] Consolidate and fix root PD fence resverations Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 01/10] drm/amdkfd: reserve TTM move fences Benjamin Cheng
2026-11-19 13:53   ` Christian König
2026-11-18 19:07 ` [PATCH v2 02/10] drm/amdgpu/gem: reserve fences on the VM root PD Benjamin Cheng
2026-11-19 13:58   ` Christian König
2026-11-18 19:07 ` [PATCH v2 03/10] drm/amdgpu/vm: reserve more fences in amdgpu_vm_lock_pd Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 04/10] drm/amdgpu/dma_buf: reserve AMDGPU_VM_UPDATE_FENCES for move_notify Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 05/10] drm/amdgpu/vm: reserve AMDGPU_VM_UPDATE_FENCES for handle_fault Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 06/10] drm/amdgpu: reserve only what the caller asks for in lock_pd Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 07/10] drm/amdgpu/userq: remove extra fence request when locking PD Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 08/10] drm/amdgpu/vm: stop using amdgpu_bo_fence Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 09/10] drm/amdgpu/uvd: " Benjamin Cheng
2026-11-18 19:07 ` [PATCH v2 10/10] drm/amdgpu/object: get rid of amdgpu_bo_fence Benjamin Cheng
2026-11-18 19:29   ` sashiko-bot [this message]
2026-11-19 14:40 ` [PATCH v3 1/7] drm/amdkfd: reserve TTM move fences Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 2/7] drm/amdgpu/gem: reserve fences on the VM root PD Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 3/7] drm/amdgpu/vm: reserve TTM_NUM_MOVE_FENCES in amdgpu_vm_lock_pd Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 4/7] drm/amdgpu/vm: reserve space for last_unlocked in handle_fault Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 5/7] drm/amdgpu/vm: stop using amdgpu_bo_fence Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 6/7] drm/amdgpu/uvd: " Benjamin Cheng
2026-11-19 14:40   ` [PATCH v3 7/7] drm/amdgpu/object: get rid of amdgpu_bo_fence Benjamin Cheng

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-221861@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=benjamin.cheng@amd.com \
    --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