From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Daniel Almeida <daniel.almeida@collabora.com>
Cc: "Alvin Sun" <alvin.sun@linux.dev>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Lyude Paul" <lyude@redhat.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Johan Hovold" <johan@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org,
driver-core@lists.linux.dev, "Ke Sun" <sunke@kylinos.cn>
Subject: Re: [PATCH v7 09/10] drm/tyr: support write-combine BO mappings
Date: Mon, 30 Nov 2026 13:09:49 -0700 [thread overview]
Message-ID: <aw3YDYBT9lqkbRNj@um790> (raw)
In-Reply-To: <992B7455-18DB-46A3-8C94-EE5EE937EFC4@collabora.com>
On Wed, Nov 25, 2026 at 04:59:08PM -0300, Daniel Almeida wrote:
> Hi Alvin,
>
> This patch does quite a few things at once and I'd rather split this.
>
> The change we _really_ need in your series is the stale cache eviction
> problem. It is unfortunate that this is a problem in general, and not
> only in Tyr. For that, using the DMA API as soon as the BO is created is
> enough. You can do that in patch 6 by calling sg_table() before the CPU
> is allowed to touch the buffer, like you already do in this one.
I agree you could add this to Patch 6 (the helpers patch) and I think a
comment would be very helpful. IIUC something like this might work:
+ // Ensure that the CPU cache is flushed before userspace writes to the buffer.
+ // This prevents a subsequent CPU cache eviction from overwriting user data with
+ // stale zero data remaining from the initial allocation.
+ // This mismatch can occur when userspace is using the write-combine
+ // caching strategy.
Then if we remove coherency from your series (which I agree with Daniel
is the cleanest approach) then Patch 6 could also
take a very pared-down version of should_map_wc(), something like:
+/// Returns whether a BO should be mapped write-combine.
+/// Write-combine and write-back are mutually exclusive.
+pub(crate) fn should_map_wc(flags: u32) -> bool {
+ flags & uapi::drm_panthor_bo_flags_DRM_PANTHOR_BO_WB_MMAP == 0
+}
+
Then the only place you would need should_map_wc() would be in
new_object() since the dummy object and kernel bo can just keep using
write-combine.
Finally, Patch 6 could also have your getter function for BoData flags
which we will still need for your bo_mmap_offset() callback.
>
> Two other things are done by this patch:
>
> - Honor writeback mappings -> this should be its own patch.
> - Add a "coherent" flag, and thread it through the driver.
>
> What it does not do is "support write combine mappings". In fact, write
> combine mappings is the only thing properly supported and tested so far
> :)
>
> The problem with the second bullet point is that a) everything else
> needed to support coherent==true is missing and b) I don't have a system
> where coherent==true to test this. If others do, great, but even still,
> lets do this as a separate series. So I'd prefer if the coherent flag
> was dropped, along with patch 8.
>
> — Daniel
next prev parent reply other threads:[~2026-11-30 20:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 12:50 [PATCH v7 00/10] drm/tyr: add VM and BO ioctl support Alvin Sun
2026-11-22 12:50 ` [PATCH v7 01/10] rust: sizes: add SZ_4G constant Alvin Sun
2026-11-22 12:50 ` [PATCH v7 02/10] rust: task: add task_size() Alvin Sun
2026-11-25 14:45 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 03/10] rust: sync: arc: relax `ForeignOwnable` for `Arc<T>` Alvin Sun
2026-11-22 12:50 ` [PATCH v7 04/10] drm/tyr: add per-file VM pool Alvin Sun
2026-11-24 23:43 ` Deborah Brouwer
2026-11-25 15:14 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 05/10] drm/tyr: add user and MCU VM specifications Alvin Sun
2026-11-25 16:13 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 06/10] drm/tyr: add BO creation and lookup helpers Alvin Sun
2026-11-22 12:50 ` [PATCH v7 07/10] drm/tyr: add VM-related ioctls Alvin Sun
2026-11-24 23:40 ` Deborah Brouwer
2026-11-25 18:49 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 08/10] rust: device: expose the device DMA attribute Alvin Sun
2026-11-25 18:52 ` Daniel Almeida
2026-11-22 12:50 ` [PATCH v7 09/10] drm/tyr: support write-combine BO mappings Alvin Sun
2026-11-25 19:59 ` Daniel Almeida
2026-11-30 20:09 ` Deborah Brouwer [this message]
2026-11-22 12:50 ` [PATCH v7 10/10] drm/tyr: add BO-related ioctls Alvin Sun
2026-11-25 21:02 ` Daniel Almeida
2026-11-23 22:25 ` [PATCH v7 00/10] drm/tyr: add VM and BO ioctl support Daniel Almeida
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=aw3YDYBT9lqkbRNj@um790 \
--to=deborah.brouwer@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=alvin.sun@linux.dev \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=simona@ffwll.ch \
--cc=sunke@kylinos.cn \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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