From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.11 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796069435; b=s5rKrlLKvluX7jlBWnRLf7KWbHX97/g8sEYpGPWOg1D47kZi1A3dpPN4dNjvNmYMR4qn wufxYFGYCa+J1D4IJMKL4UnlzhP0tsIfdHHLcfZtwaPQVFEpyxM28+Sg5s8ZMXcpBehqk EFlyhMJGY3/p7ncd06nPCG3iIriAdPXtZc0hv/b3+U54YPzlsvgOPR7sE3AH/SCg3bx6x M7wMD4aVOdrvZapYDgaDXSEzMrNpvXuvQkdWGoEMPUtOoHGTNQ+oPfAbWwb1xKXfi0BBJ rOMdR90svCtghN/0mpcAPX7GyDhAhl/tAToQjvzLTr5nZulX05Zz3+YeGugREoHH2Zw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796069435; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To:X-Zoho-Virus-Status: X-Zoho-AV-Stamp; bh=W6UfvLk+AZK2LHzT16RT+U2Ae7lJ+kOOo+cUbWsXstM=; b=di9YZW/sK7aKzTJC0XxJt23JFLunf/SIhYK+B6Uv1kPckzWhEFF2KOEZuL46ss/NyywV rwQTiw5x86AI4WnXoo76fO335OZG6kubBgH0nhKvWLZajY5drzaxbQ6Lgmm+NKZUkY0Fl v4okEkxq/kxQ8OMdlFj5uOh5/ntOz1g4Cdi/L2O1W3FWJpO6SKz12kDHj4Njokoe75gW6 7ARmPsg9t2hnNR8E3eg9aOMCtQz4nrco5yCd0Agjr22zB7yl99HA7jjy63ItiCOKdgMu5 JCpzjdQw7ATiDDogw70rOp2vUaxUb/+f13jj1GkXO2B0ApmvJge+IOmawdDKekylRiw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=X9hHEPAu; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.11 Received: from sender6-op-o11.zoho.com (sender6-op-o11.zoho.com [165.173.180.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFAA1606A31A for ; Mon, 30 Nov 2026 20:10:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EFAA1606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=X9hHEPAu ARC-Seal: i=1; a=rsa-sha256; t=1796069391; cv=none; d=zohomail.com; s=zohoarc; b=cd2HXL7GqDegYAg/+G/59mQWY8+d4Oz9O9AwqvYWX84fh9F9BvYo+jM9GSkEHC2FqpTOiXIkQ2j1GTsmUjBrUYuq6W1Rb4pBed0RbAgQq4kDTPHe44T8pTEkR3ILwsNYW0BuTnRY8zox+Uyo3qvevpjx9Dc/nLzihAkGihXFD9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796069391; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=W6UfvLk+AZK2LHzT16RT+U2Ae7lJ+kOOo+cUbWsXstM=; b=X3fEg3StKKp6nmItakBuryuJUAkDW5uWEPQrCIPlMTomBvIyaiXXM1cLU/uHO6tKTiYF0bA7BBWAKQpoeKNMpOvxNS2C2Z+Oyxp5jBFM8/tcfDI9flZbWrVBpgyZojoSqrqq9LwLmQcKvbUUrApIl6CQ5Xezi8Fh2zVzVD9SGF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=deborah.brouwer@collabora.com; dmarc=pass header.from= DKIM-Signature: a=rsa-sha256; b=X9hHEPAu66Y4v07FYEiyzWkdznVF28BjRE3rHfQN2rPAKxVvQQGycKH4SdBPpX4aOkRjQlSGi185iY8St17rujV3wgJsBmUg7aJDaXIgbkLBSxnPFgNl6BD3k4diAqobgy0QcpjMu1bArXKnnYoF3fA7ACFwCdau6CwAOJP01Pg=; c=relaxed/relaxed; s=zohomail; d=collabora.com; v=1; bh=W6UfvLk+AZK2LHzT16RT+U2Ae7lJ+kOOo+cUbWsXstM=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; Received: by smtp.zohomail.com with SMTPS id 1796069390675601.3466517747487; Mon, 30 Nov 2026 12:09:50 -0800 (PST) Date: Mon, 30 Nov 2026 13:09:49 -0700 From: Deborah Brouwer To: Daniel Almeida Cc: Alvin Sun , Miguel Ojeda , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Tamir Duberstein , Alexandre Courbot , Onur =?iso-8859-1?Q?=D6zkan?= , Lyude Paul , David Airlie , Simona Vetter , Greg Kroah-Hartman , "Rafael J. Wysocki" , Johan Hovold , Sami Tolvanen , rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org, driver-core@lists.linux.dev, Ke Sun Subject: Re: [PATCH v7 09/10] drm/tyr: support write-combine BO mappings Message-ID: References: <20261122-tyr-ioctls-v7-0-3a2af624b992@linux.dev> <20261122-tyr-ioctls-v7-9-3a2af624b992@linux.dev> <992B7455-18DB-46A3-8C94-EE5EE937EFC4@collabora.com> X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <992B7455-18DB-46A3-8C94-EE5EE937EFC4@collabora.com> X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-0.2.28.1.5.5/296.42.99 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