Linux Media Controller development
 help / color / mirror / Atom feed
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: Mon, 17 Aug 2026 10:56:00 -0700	[thread overview]
Message-ID: <1aba31b8-36a6-d3f0-8624-a603d319c54d@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.
>
> 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.

Based on the discussion, could you add one patch to unconditionally 
return -EOPNOTSUPP for imported BO at the beginning of amdxdna_flush_bo()?

Lizhi

>
> Taimuraz
>
>

      parent reply	other threads:[~2026-08-17 17:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260811231351.1011244-1-taimuraz@kaitmazov.com>
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:54         ` Alex Deucher
     [not found]           ` <20260813195059.149991-1-taimuraz@kaitmazov.com>
2026-08-13 20:06             ` Alex Deucher
     [not found]               ` <20260813201416.158728-1-taimuraz@kaitmazov.com>
2026-08-13 21:02                 ` Lizhi Hou
     [not found]         ` <20260813182905.124248-1-taimuraz@kaitmazov.com>
2026-08-13 19:01           ` Lizhi Hou
2026-08-14  7:59           ` Christian König
2026-08-17 17:56           ` Lizhi Hou [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=1aba31b8-36a6-d3f0-8624-a603d319c54d@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox