All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu: Check errors before releasing the SPM VMID
Date: Wed, 02 Dec 2026 11:40:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-245620@kernel.org> (raw)
In-Reply-To: <20261202113037.1806655-2-srinivasan.shanmugam@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu: dead error checks on uninterruptible waits in
  amdgpu_vm_ioctl()
--

commit 1c20d0b2a4030e6c94419ccf8d5459e64734db54
Author: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>

drm/amdgpu: Check errors before releasing the SPM VMID

This commit checks the return values of amdgpu_bo_reserve() and
dma_resv_wait_timeout() in the AMDGPU_VM_OP_UNRESERVE_VMID path of
amdgpu_vm_ioctl() before releasing the SPM VMID.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 94b1cfe05e3e0..8031d3072bcdf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -3027,13 +3027,24 @@ int amdgpu_vm_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>  	}
>  	case AMDGPU_VM_OP_UNRESERVE_VMID: {
>  		struct amdgpu_bo *root = vm->root.bo;
> +		long wait;
> +		int r;
> +
> +		r = amdgpu_bo_reserve(root, true);
> +		if (r)
> +			return r;
>  
> -		amdgpu_bo_reserve(root, true);
>  		/* Wait for the jobs which might still use the reserved VMID */
> -		if (vm->reserved_vmid[AMDGPU_GFXHUB(0)])
> -			dma_resv_wait_timeout(root->tbo.base.resv,
> -					      DMA_RESV_USAGE_READ, false,
> -					      MAX_SCHEDULE_TIMEOUT);
> +		if (vm->reserved_vmid[AMDGPU_GFXHUB(0)]) {
> +			wait = dma_resv_wait_timeout(root->tbo.base.resv,
> +						     DMA_RESV_USAGE_READ, false,
> +						     MAX_SCHEDULE_TIMEOUT);
> +			if (wait <= 0) {
> +				amdgpu_bo_unreserve(root);
> +				return wait < 0 ? (int)wait : -ETIME;
> +			}
> +		}

[Severity: Medium]
Can either of these error checks ever trigger while both calls use
uninterruptible waits?

amdgpu_bo_reserve(root, true) passes no_intr = true to
ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL), which calls
dma_resv_lock() with no ticket and always returns 0.  Likewise,
dma_resv_wait_timeout(..., false, MAX_SCHEDULE_TIMEOUT) sleeps
uninterruptibly with no timeout and always returns MAX_SCHEDULE_TIMEOUT.

If this ioctl should abort on a signal so userspace can retry,
amdgpu_bo_reserve(root, false) and dma_resv_wait_timeout(..., true,
MAX_SCHEDULE_TIMEOUT) would be needed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202113037.1806655-2-srinivasan.shanmugam@amd.com?part=1

      reply	other threads:[~2026-12-02 11:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 11:30 [PATCH] drm/amdgpu: Report SPM VMID root BO reservation failure Srinivasan Shanmugam
2026-12-02 11:30 ` [PATCH] drm/amdgpu: Check errors before releasing the SPM VMID Srinivasan Shanmugam
2026-12-02 11:40   ` sashiko-bot [this message]

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-245620@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivasan.shanmugam@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.