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 E8A71606A328 for ; Thu, 5 Nov 2026 16:53:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F0ECtycT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4684410E2E8; Thu, 5 Nov 2026 16:52:57 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CD1610E187 for ; Thu, 5 Nov 2026 16:52:49 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A37DC6020A; Thu, 5 Nov 2026 16:52:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6AA51F000C1; Thu, 5 Nov 2026 16:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793897568; bh=93Jjsh5uP1bJuXaCFxDECc/bZWbVcYpxvdFTfNjDZUY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=F0ECtycT0ID6uIHdj/OpmBK2gU3FHjDn3/gApTFyDgc91RQtJ4WgWm+RL2HwAhVdt nWsuBuZYAr0GwetQrft6qOL+ZG0OfKdSu4K1WmEtRjthoSmuVPdG98l1Kpwf6aQG0W TxNu9lDTAXW6iF8+9OnH1JOR16vW2uC3ZObWq9SKfkU8PZEFIoJyiVJFzz4xz4fKVG zzPcRa9glxwjIFDFcSrYw1yFqUAO0Hkna49kQLb0fVCLIYNVQjfbRuGEiahNsBkEYN wkqeuLitvZXCR+Sp14k3ZHYCWxqNnyon64Q4EWpYZKeW/u8085i4PiD3HSrj4uKiaF h72LTbmmT/bkA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v9 06/14] dma-pool: Allocate CoCo atomic pools using CoCo shared memory allocator To: =?utf-8?b?QW5lZXNoIEt1bWFyIEsuViAoQXJtKQ==?= Cc: "Andrew Morton" , "Baoquan He" , "Mike Rapoport" , "Pasha Tatashin" , "Pratyush Yadav" , "Catalin Marinas" , =?utf-8?b?Q2hyaXN0aWFuIEvDtm5pZw==?= , "Jason Gunthorpe" , "Joerg Roedel" , "Marc Zyngier" , "Marek Szyprowski" , "Robin Murphy" , "Steven Price" , "Sumit Semwal" , "Suzuki K Poulose" , "Thomas Gleixner" , "Will Deacon" , "Russell King" , "Benjamin Gaignard" , "Brian Starkey" , "John Stultz" , "Mark Rutland" , "Radu Rendec" , "T.J. Mercier" , "Madhavan Srinivasan" , "Michael Ellerman" , "Nicholas Piggin" , "Christophe Leroy" , "Ritesh Harjani" , "Shrikanth Hegde" , "Alexander Gordeev" , "Gerald Schaefer" , "Heiko Carstens" , "Vasily Gorbik" , "Christian Borntraeger" , "Sven Schnelle" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H . Peter Anvin" , "Kiryl Shutsemau" , "Rick Edgecombe" , "K . Y . Srinivasan" , "Haiyang Zhang" , "Wei Liu" , "Dexuan Cui" , "Long Li" , "Paolo Bonzini" , "Vitaly Kuznetsov" , "Andy Lutomirski" , "Peter Zijlstra" , dri-devel@lists.freedesktop.org, linux-mm@kvack.org, kvmarm@lists.linux.dev, "Oliver Upton" , media-ci@linuxtv.org In-Reply-To: <20261104164555.3555725-7-aneesh.kumar@kernel.org> References: <20261104164555.3555725-1-aneesh.kumar@kernel.org> <20261104164555.3555725-7-aneesh.kumar@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 05 Nov 2026 16:52:45 +0000 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: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [High] dma-pool: cc_make_shared() runs after arch_dma_prep_coherent() -- commit daae4fcc15a00bc83c4081ef4b27786a7f224537 Author: Aneesh Kumar K.V (Arm) dma-pool: Allocate CoCo atomic pools using CoCo shared memory allocator This commit updates atomic_pool_expand() to allocate confidential computing shared atomic DMA pools using the cc_shared layout and transition helpers (cc_shared_calc_layout(), cc_make_shared(), and cc_make_private()), enforci= ng shared granule size alignment and minimum allocation order. > diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c > index 70b7f64b17ab5..da487c3f9dc61 100644 > --- a/kernel/dma/pool.c > +++ b/kernel/dma/pool.c [ ... ] > @@ -126,8 +142,7 @@ static int atomic_pool_expand(struct dma_gen_pool *dm= a_pool, size_t pool_size, > * shrink so no re-encryption occurs in dma_direct_free(). > */ > if (dma_pool->cc_shared) { > - ret =3D set_memory_decrypted((unsigned long)page_to_virt(page), > - 1 << order); > + ret =3D cc_make_shared(page_to_virt(page), pool_size); [Severity: High] Does calling cc_make_shared(page_to_virt(page), pool_size) after arch_dma_prep_coherent() and dma_common_contiguous_remap() leave dirty cache lines on the cacheable linear mapping alias when CONFIG_DMA_DIRECT_REMAP is enabled? In atomic_pool_expand(), arch_dma_prep_coherent() and the vmap remapping run first: kernel/dma/pool.c:atomic_pool_expand() { ... arch_dma_prep_coherent(page, pool_size); #ifdef CONFIG_DMA_DIRECT_REMAP if (dma_pool->cc_shared) prot =3D pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)); else prot =3D pgprot_dmacoherent(PAGE_KERNEL); addr =3D dma_common_contiguous_remap(page, pool_size, prot, __builtin_return_address(0)); if (!addr) goto free_page; #else addr =3D page_to_virt(page); #endif if (dma_pool->cc_shared) { ret =3D cc_make_shared(page_to_virt(page), pool_size); ... } Because set_memory_decrypted() (in commit 0a47431deefc ("mm: Zero memory during shared memory transitions")) zeroes the range through the cacheable linear map address passed to it: cc_make_shared() -> set_memory_decrypted() -> realm_set_memory_decrypted() / pkvm_set_memory_decrypted() -> memset((void *)addr, 0, (size_t)numpages << PAGE_SHIFT); performing this transition after arch_dma_prep_coherent() has already clean= ed the linear map alias dirties the CPU data cache for page_to_virt(page) with zeros without a subsequent cache clean (and on Arm CCA, cleans the protected physical address alias before the RIPAS transition rather than the shared physical address alias after zeroing). Those dirty cache lines on the linear mapping can later be evicted to the Point of Coherency and overwrite live D= MA buffers accessed via the non-cacheable vmap alias at addr. In contrast, dma_direct_alloc() transitions the pages before calling arch_dma_prep_coherent() and dma_common_contiguous_remap(). Should atomic_pool_expand() similarly call cc_make_shared() before arch_dma_prep_coherent() and dma_common_contiguous_remap()? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261104164555.3555= 725-1-aneesh.kumar@kernel.org?part=3D6