From: Lizhi Hou <lizhi.hou@amd.com>
To: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>, <mamin506@gmail.com>,
<ogabbay@kernel.org>
Cc: <jacek.lawrynowicz@linux.intel.com>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] accel/amdxdna: return early from a zero-length flush
Date: Tue, 18 Aug 2026 09:23:37 -0700 [thread overview]
Message-ID: <a6cc7a11-5ada-cfd6-07dd-df3cad271f5a@amd.com> (raw)
In-Reply-To: <20260817230655.356785-1-taimuraz@kaitmazov.com>
On 8/17/26 16:06, Taimuraz Kaitmazov wrote:
> SYNC_BO does not constrain its size, so a request for zero bytes reaches
> drm_clflush_virt_range(), which ends with an unconditional
> clflushopt(end - 1). For an empty range that is the byte before the
> mapping, and abo->mem.kva comes from vmap(), so the access lands in the
> guard page below the vmalloc area and faults:
>
> BUG: unable to handle page fault for address: ffffd16fbbc70fff
> #PF: supervisor read access in kernel mode
> Oops: Oops: 0000 [#1] SMP NOPTI
> CPU: 7 UID: 1000 Comm: sync_bo_probe
> RIP: 0010:drm_clflush_virt_range+0x3c/0x70
> Call Trace:
> amdxdna_drm_sync_bo_ioctl+0x124/0x430 [amdxdna]
> drm_ioctl+0x301/0x4c0
> __x64_sys_ioctl+0x115/0x2f0
> do_syscall_64+0xa6/0x3d0
>
> Any process that can open the render node can do this. Reproduced 3 of 3
> times on a Strix Point NPU (1022:17f0), by calling SYNC_BO with size 0 on
> an AMDXDNA_BO_SHARE object. The import arm takes the same request but
> flushes the whole scatterlist, so it survives it.
>
> Nothing needs flushing for an empty range, so answer before choosing a
> path.
>
> Fixes: e252e3f3488a ("accel/amdxdna: Revise device bo creation and free")
> Cc: stable@vger.kernel.org
> Signed-off-by: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>
> ---
> Trees before amdxdna_flush_bo() existed carry the same call inline in
> amdxdna_drm_sync_bo_ioctl(), with args->size passed to
> drm_clflush_virt_range() unclamped, so a backport wants the guard at that
> call site instead.
>
> drivers/accel/amdxdna/amdxdna_gem.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index 1c63eff0a4a8..2a16de96e6a4 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -1247,6 +1247,9 @@ static int amdxdna_flush_bo(struct amdxdna_gem_obj *abo, u64 offset, u64 size)
> return -EINVAL;
>
> size = min(abo->mem.size, end) - offset;
> + if (!size)
> + return 0;
> +
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
> if (is_import_bo(abo))
> drm_clflush_sg(abo->base.sgt);
> else if (amdxdna_gem_vmap(abo))
next parent reply other threads:[~2026-08-18 16:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260817230655.356785-1-taimuraz@kaitmazov.com>
2026-08-18 16:23 ` Lizhi Hou [this message]
2026-08-19 18:36 ` 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=a6cc7a11-5ada-cfd6-07dd-df3cad271f5a@amd.com \
--to=lizhi.hou@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mamin506@gmail.com \
--cc=ogabbay@kernel.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®