From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC35C606A31A for ; Mon, 30 Nov 2026 20:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=X9hHEPAu Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2386B10F422; Mon, 30 Nov 2026 20:10:02 +0000 (UTC) Received: from sender5-op-o11.zoho.com (sender5-op-o11.zoho.com [165.173.182.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54C7C10F422 for ; Mon, 30 Nov 2026 20:09:56 +0000 (UTC) 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-Archived-By: 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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