From: Lizhi Hou <lizhi.hou@amd.com>
To: "Taimuraz Kaitmazov" <taimuraz@kaitmazov.com>,
"Christian König" <christian.koenig@amd.com>
Cc: Min Ma <mamin506@gmail.com>, Oded Gabbay <ogabbay@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
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>
Subject: Re: [PATCH v2 0/5] accel/amdxdna: honour the SYNC_BO range
Date: Thu, 13 Aug 2026 12:01:54 -0700 [thread overview]
Message-ID: <a218d2e7-62cc-23e0-386f-8b6e2a5c2297@amd.com> (raw)
In-Reply-To: <20260813182905.124248-1-taimuraz@kaitmazov.com>
On 8/13/26 11:29, Taimuraz Kaitmazov wrote:
> Resending: my earlier reply does not appear on the lists, so I assume it
> did not reach you either.
>
> On 8/13/26 20:08, Lizhi Hou wrote:
>> The legacy NPU device is not cache coherent. And the next generation
>> (aie4) devices will be cache coherent.
> Confirming that with numbers, since I had measured it before your reply
> landed. On npu4, without a flush the CPU reads what the buffer held
> before the NPU wrote it, and the NPU reads what DRAM held before the CPU
> wrote it. Both reproduce on all 20 runs, and the stale read is most of
> the buffer, not a stray line: 3931 of 4096 values on average.
>
> Good to know aie4 is coherent -- that makes anything we do here a
> legacy-only concern.
>
> On 8/13/26 09:44, Christian König wrote:
>> An alternative would be to use DMA_BUF_IOCTL_SYNC from userspace
> Tried it against amdgpu, imported into amdxdna: stale on all 20 runs, no
> better than no sync at all. SYNC_BO on the same buffer is clean on all
> 20.
>
> Which leaves me no legal way to import a buffer the CPU also reads. Is
> there one I'm missing, or should a device like this just not import?
>
> On 8/12/26 17:45, Lizhi Hou wrote:
>> we need to unconditionally return -EOPNOTSUPP for imported BO
> is_import_bo() also covers ubuf and cbuf, so that stops maintaining our
> own userptr and carve-out BOs too. They take that arm today: on a 64 MiB
> userptr BO a 4 KiB sync and a full sync both cost 659 us, so the range
> is already being ignored there.
I am working on removing the dma-buf part for ubuf BO because that is
also not a good usage of dma-buf. So the ubuf will be a object soon.
cbuf is mainly for debug and is disabled by default.
Lizhi
>
> Keying on dma_buf->ops instead would confine it to foreign buffers.
> Either is fine by me, tell me which you want.
>
> Separately: XRT's buffer::sync() clflushes in userspace unless
> Debug.force_driver_sync is set, so the stack does this to foreign
> dma-bufs whatever the driver does. And when the ioctl is used, a
> FROM_DEVICE sync returns -EINVAL after the flush has already run, out of
> amdxdna_hwctx_sync_debug_bo() when the BO has no assigned hwctx. Happy
> to send that as its own patch; the helper has one caller, so returning 0
> there is the obvious shape unless you want it done elsewhere.
>
> v3 is sent: patches 1, 3 and 4 only. Patch 5 is dropped, and 2 with it
> since it only serves 5. I have not tested 5 on a matching tree and its
> numbers came from the foreign import case.
>
> Taimuraz
>
>
next prev parent reply other threads:[~2026-08-13 19:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 23:13 [PATCH v2 0/5] accel/amdxdna: honour the SYNC_BO range Taimuraz Kaitmazov
2026-08-11 23:13 ` [PATCH v2 1/5] accel/amdxdna: refuse an I/O memory mapping of an imported BO Taimuraz Kaitmazov
2026-08-11 23:13 ` [PATCH v2 2/5] accel/amdxdna: add a quiet variant of amdxdna_gem_vmap() Taimuraz Kaitmazov
2026-08-11 23:13 ` [PATCH v2 3/5] accel/amdxdna: return early from a zero-length flush Taimuraz Kaitmazov
2026-08-11 23:13 ` [PATCH v2 4/5] accel/amdxdna: check the sync range for overflow on a device BO Taimuraz Kaitmazov
2026-08-11 23:13 ` [PATCH v2 5/5] accel/amdxdna: flush only the requested range in amdxdna_flush_bo Taimuraz Kaitmazov
2026-08-12 8:57 ` [PATCH v2 0/5] accel/amdxdna: honour the SYNC_BO range Christian König
2026-08-12 15:45 ` Lizhi Hou
2026-08-13 7:44 ` Christian König
2026-08-13 18:08 ` Lizhi Hou
2026-08-13 18:29 ` Taimuraz Kaitmazov
2026-08-13 19:01 ` Lizhi Hou [this message]
2026-08-14 7:59 ` Christian König
2026-08-17 17:56 ` Lizhi Hou
2026-08-13 18:54 ` Alex Deucher
2026-08-13 19:50 ` Taimuraz Kaitmazov
2026-08-13 20:06 ` Alex Deucher
2026-08-13 20:14 ` Taimuraz Kaitmazov
2026-08-13 21:02 ` 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=a218d2e7-62cc-23e0-386f-8b6e2a5c2297@amd.com \
--to=lizhi.hou@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.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 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.