From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131319; b=RjSyPdvv7DcFiA8D+BYeD729etORS3gUTwlwmbekwKWli5d2wArJWjN8TOGNez//6TBn Pi+hz6GSo+ywlZv77MInzNNn86eCSDvsjQUeHOpF4+chS2IbXCFM+7SmDRbFPejLYTQ0/ 7lUfkaa9eszcu4oK1+4KvUhCoTtZAj7z7aA+kDl3V0CZTc4fBFX5HoTchutZXJKya0TL/ pnBPkXlVI4QMD+RaT105VbZcSA3R+T5LLfbHyiAU701/GDINdu2T0Udr8TH7d0UV+YbC/ BuCFm1ggSCejKZQO1R49kZzyNnswqP2wB880VXtzfiVYGCHIOt6CpaFluFWzA95yw+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131319; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=WZ1mGEbMc/O1mLUq5FLQjGvnyRDcqjliNg3cIZlNtGI=; b=fhwJAy/69e6CQKne30VoWB0p5j5pkg3vsnmGNDWRcP7NG8RU4SOA9D678Xw+HVmG3vkt ElVA3Niqjo7rhr9QjDs3SCp79taSVyNIE5Mqqk/UhRdmu5wSC3RrE4YMw+WrErqIy9V/z ydSefgjpgMJw4IxmX89qg1i0Qu0lCCwATnjlyZfH+hTH3w+7C92ef2VqokAeBeNSBLbyX 2aIAD3i4w1JUaDcJ7YOEKlq9vrFrEKE9u5leOb2jlNue58H113L4IoGrcPgOFkrYx7Ph7 9W9fJIjHXFoiMcYebyo6dzgNumldgBZMEO1O4hSFV7eYC459zdhEnvamJTvVeEnk/kg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=eKLt5fMd; arc=none smtp.remote-ip=209.85.219.51 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A61E5606A320 for ; Tue, 1 Dec 2026 13:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A61E5606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=eKLt5fMd Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-91f0274f88cso155287266d6.0 for ; Tue, 01 Dec 2026 05:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1796131317; x=1796736117; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WZ1mGEbMc/O1mLUq5FLQjGvnyRDcqjliNg3cIZlNtGI=; b=eKLt5fMd4Lus1a2vPytNU3mneYB+EyvsLAlEEp+nT073LfZq2/7V5l0rwWkDcvbsv9 MMY9G5eEHTx8OcS3/7mkMmFAWCPtMn9HJHYPKPDJRCC5Q5R6f/Rb8gaJ6/UiPPKiP3md 8QqkarPMNvdbq9xmrSjMK2D+POCF+QCIng+c9ytmOUKR9YX7R66JNsu+QIRQ3Yjos665 dN1EgXfG3QKBEPJZbFzj3UQYC3Xe/CoZwAe2fbkosV2yYs2sWOoQA6Ig3sFIJ9VAVw8B lyzZuxgRK3U/cB/B5YzNw2wqBSIprHI7gssEfIyBxVwMeJvzCwW9+lDojXywmNSwHTyQ 8ErQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796131317; x=1796736117; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WZ1mGEbMc/O1mLUq5FLQjGvnyRDcqjliNg3cIZlNtGI=; b=oRP2yeEyiY9pk1TiGarQ6Bro7F4VYDqHqL0WM2BMAb5D08e9q27XF+GTorJt1F15Zj BX3Qr7n7dkXbDDAU4iKtvX/2POOJyohlhwAkwwhUrEuF97vLoVe5zNhvRRJYd1kRHTh4 oVqcCtkNlb7x3WMyddYet3ajkDoGbJvWfBAoNhRm1D5wJOGqBBuDMYqIcn05iUWuVb26 VK0R0PU9jPa9j2ajRaGqkj9Yo/OpXH6/SYaYNkf3iafYjot6tfp8xyRAa0b6mR23vlRN 23pOnkSAC1WYzNjr7MlBnHaO3ByhmK6DqHRzsJziSZCz5DS1yBHtdQCckOgTV05XhAS1 GNGA== X-Forwarded-Encrypted: i=1; AL+hErE3HxkaxCdp46qQ/V+ns8y4ABzJJEHy3imFpQWBoUYYwfuNK+yyCpqnqebVCxrdWk5uwTkQRSVK4u2x@lists.linux.dev X-Gm-Message-State: APuU4Z8A/k76INTyUsoMcvFrZ1Ys+uUV7NXeAiWWx4WARzUpTs6i7AAb xQ0PoPQ3wDWxaIK8RFWsPYhBga2Lu8qo6Lzvf7mcMIHItuQuSmtMiuKcR9VXTBt0d7c= X-Gm-Gg: AZFdTZf51H0cvXEPYB/iQGa3uazO8fH4N438pkeccE/w6W5AHcPehOkVHileXYzLhCU SjyJ0yto/zuPneik+JcgO7GOIUcr/hpzkpofp70E164AyRhj0BijUWuj10qsgzDJaZqCTAmiNEC FW107F42WVqVKGC0cArQmQ7mpmCuLCRaYaTE+5ECw93/lZomyepMnYZXYRbLKVzATcaUbPCJkU9 967OrICTyTWu1jztlI+QPiMzlYYx7Fwghuq1F7K1c7QMdj74Pr/3jLOX1VKkeLO3BjYN3zWXtiX 4FAQw/lL7a3cphdyrSSsp67YaCpnC/XuBqjbV38T0cOAjeWbEi3Fq7iHNBDFDD93Z0nZ0NN6Krd wG+r+S0RaklBfboiZSdKFi87JlaL3v/t+agjE+WFhDrxeIs+zb1fVjA3EeM5iw6GsbO/QVLrMPA RuYvW3Etd4n4g9VPcRRbC2792E+xp7B5qwVa0PQZo6YmGazJBZXaPEWUOdLVEiNzXC6TtWqXX22 VDaBudvygWInpRFDYjieJM/jUtpEhsYiiSjlrjCT6SwwbyNgQ6df1AAjeq0RQS3qpbfStwhQwAU 40sI X-Received: by 2002:a05:6214:2682:b0:91c:67a7:1373 with SMTP id 6a1803df08f44-92134b89818mr707056536d6.54.1796131317481; Tue, 01 Dec 2026 05:21:57 -0800 (PST) Received: from ziepe.ca ([142.177.118.84]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921349d0e35sm323498396d6.20.2026.12.01.05.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 05:21:56 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1xYNnw-00000000mzp-0ke5; Tue, 01 Dec 2026 09:21:56 -0400 Date: Tue, 1 Dec 2026 09:21:56 -0400 From: Jason Gunthorpe To: "Aneesh Kumar K.V" Cc: Catalin Marinas , 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 Message-ID: <20261201132156.GC1856591@ziepe.ca> References: <20261116091137.94252-1-aneesh.kumar@kernel.org> <20261116091137.94252-5-aneesh.kumar@kernel.org> <20261124134621.GI9566@ziepe.ca> X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sat, Nov 28, 2026 at 10:09:33PM +0530, Aneesh Kumar K.V wrote: > 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. It is "power-of-two sharing granule" right? And when doing the ITS conversions you'll need to min() to the required alignments that Mark explained. Jason