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 73D7A606A321 for ; Sat, 28 Nov 2026 16:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nKWFooM/ Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B268310E0FD; Sat, 28 Nov 2026 16:40:04 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34DEA10E0FD for ; Sat, 28 Nov 2026 16:39:58 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id CC1E542336; Sat, 28 Nov 2026 16:39:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CBB1F00897; Sat, 28 Nov 2026 16:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795883997; bh=Xmj5oVcG3ZMhpzMx9V8DGIeVZkPO3QyI7dk0nE0g6aE=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=nKWFooM/99UZc3nMM8dhy5+pchlXWnzblw1BIM6mYzA6LTHOSU1sM6pPviNuuKekm vePaUIaCuvueIrLnTbqh/J2MJIcNTNBrLs9cJYrksU+kvs4gQjhSturwzYa+PRYUq2 DHlaQAG652HC86XLbpu8HyPnfJofUYY9RiolyqAAZ/MIxYtEZpqx3ZrO+UrD4g1DUd YG3NPHT0j/s1Jrp1TsaRllREXrcilKBhiixEJmB2a56KiYGCua7ZBpD3EJN5NSx8MC 5IBTRkRoo4l3SJtgZGTZ91399ktjQOeTGKJsFHvU1K7WnXhIQ7ZpfTAY5uWu27O8Ge LQn10Y2qr+zug== X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Catalin Marinas , Jason Gunthorpe Cc: linux-coco@lists.linux.dev, Andrew Morton , Baoquan He , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , Christian K?nig , 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, iommu@lists.linux.dev, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mm@kvack.org, kvmarm@lists.linux.dev, patches@lists.linux.dev Subject: Re: [PATCH v10 04/13] irqchip/gic-v3-its: Allocate shared tables using CoCo shared memory allocator In-Reply-To: References: <20261116091137.94252-1-aneesh.kumar@kernel.org> <20261116091137.94252-5-aneesh.kumar@kernel.org> <20261124134621.GI9566@ziepe.ca> Date: Sat, 28 Nov 2026 22:09:33 +0530 Message-ID: X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain 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=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 Catalin Marinas writes: > On Tue, Nov 24, 2026 at 09:46:21AM -0400, Jason Gunthorpe wrote: >> On Tue, Nov 24, 2026 at 07:00:00PM +0530, Aneesh Kumar K.V wrote: >> >> > Taking Jason's feedback into account, we could have the allocator >> > request compound pages and recover the actual allocation order with >> > compound_order(). That would avoid passing an order to free: >> > >> > void *alloc_cc_shared_node(int nid, gfp_t gfp, unsigned int order); >> > void *alloc_cc_shared(gfp_t gfp, unsigned int order); >> > void free_cc_shared(void *addr); >> >> It probably shouldn't be order here, that is hard to use. Just size_t >> len >> >> And round up internally > > Minor point in favour of keeping the '_pages' naming and order is that > it makes it more obvious what alignment is returned for code that needs > it like the ITS. Otherwise we can just document it, I don't have a > strong opinion either way (only that it's simpler than what was proposed > earlier). > Thanks. I'll keep the byte-based interface for now and document the returned alignment: void *alloc_cc_shared_node(int nid, gfp_t gfp, size_t len); void *alloc_cc_shared(gfp_t gfp, size_t len); void free_cc_shared(void *addr); This leaves room for a kmalloc-style shared buffer cache in the future, where allocations could come from already-shared backing memory. Callers would request a byte count without needing to know the underlying allocation order. For now, the implementation will round up the size internally, allocate compound pages, and share the entire allocation. Will add this to the kernel doc? * Allocate a physically contiguous block of at least @len bytes, rounded * up to the sharing granule and then to a power-of-two number of pages. * The physical base address is aligned to the full allocation size. * The entire allocation is shared and zeroed. -aneesh