mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>,
	Min Ma <mamin506@gmail.com>, Oded Gabbay <ogabbay@kernel.org>
Cc: "Christian König" <christian.koenig@amd.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Alex Deucher" <alexdeucher@gmail.com>,
	"Max Zhen" <max.zhen@amd.com>,
	"Sonal Santan" <sonal.santan@amd.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v5 5/5] accel/amdxdna: do not fail a sync for a BO with no debug context
Date: Thu, 17 Sep 2026 09:11:35 -0700	[thread overview]
Message-ID: <d0157864-cfe6-a4f3-bc62-3338c04e806b@amd.com> (raw)
In-Reply-To: <20260819224458.257346-6-taimuraz@kaitmazov.com>


On 8/19/26 15:44, Taimuraz Kaitmazov wrote:
> amdxdna_drm_sync_bo_ioctl() calls amdxdna_hwctx_sync_debug_bo() for every
> FROM_DEVICE sync, which answers -EINVAL when the BO's assigned_hwctx names
> no context. Only a BO attached with ATTACH_DEBUG_BO is ever given one, so
> an ordinary read-back sync reports failure after its flush has already run.
>
> Ask for the debug sync only when the BO has a context. An unattached BO
> carries AMDXDNA_INVALID_CTX_HANDLE and hwctx ids are allocated above it, so
> the test is exact, -EINVAL keeps meaning that the named context is gone,
> and the handle is not resolved twice. The field is written under dev_lock
> and read here without it; the context is still resolved under that lock, so
> a racing attach only decides whether this sync sees the buffer.
>
> Suggested-by: Lizhi Hou <lizhi.hou@amd.com>
> Signed-off-by: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>
> ---
>   drivers/accel/amdxdna/amdxdna_gem.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index 4be5298d1062..2613c94dd842 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -1319,7 +1319,8 @@ int amdxdna_drm_sync_bo_ioctl(struct drm_device *dev,
>   	XDNA_DBG(xdna, "Sync bo %d offset 0x%llx, size 0x%llx\n",
>   		 args->handle, args->offset, args->size);
>   
> -	if (args->direction == SYNC_DIRECT_FROM_DEVICE)
> +	if (abo->assigned_hwctx != AMDXDNA_INVALID_CTX_HANDLE &&
> +	    args->direction == SYNC_DIRECT_FROM_DEVICE)
>   		ret = amdxdna_hwctx_sync_debug_bo(client, args->handle);
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
>   
>   put_obj:

  parent reply	other threads:[~2026-09-17 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260819224458.257346-1-taimuraz@kaitmazov.com>
     [not found] ` <20260819224458.257346-5-taimuraz@kaitmazov.com>
2026-09-02 15:39   ` [PATCH v5 4/5] accel/amdxdna: refuse to flush an imported BO Lizhi Hou
     [not found] ` <20260819224458.257346-4-taimuraz@kaitmazov.com>
2026-09-17 15:55   ` [PATCH v5 3/5] accel/amdxdna: do not warn when a sync request is rejected Lizhi Hou
2026-09-17 20:24     ` Lizhi Hou
     [not found] ` <20260819224458.257346-6-taimuraz@kaitmazov.com>
2026-09-17 16:11   ` Lizhi Hou [this message]
2026-09-17 20:25     ` [PATCH v5 5/5] accel/amdxdna: do not fail a sync for a BO with no debug context Lizhi Hou

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=d0157864-cfe6-a4f3-bc62-3338c04e806b@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mamin506@gmail.com \
    --cc=max.zhen@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=sonal.santan@amd.com \
    --cc=sumit.semwal@linaro.org \
    --cc=taimuraz@kaitmazov.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

all inboxes | Powered by JetHome®