Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131319; b=DhZchbqRYdzswE5huiR7ZDRFDKm035gR6uxKQwaqcfzv//1xohV83navDXSOZBEm70JA wjNp+47Y5kkDUcwooJO3nqhZivUqQKZkht3RC+PrfqSF+uuHqxO4+CL0RUQveVA+uT/IB q3Sm0za06lHtChK0Q7fp2Gs7/H3TR8Qww6VU/meMSXeUXIJ7/D1zuLqPoOWhV0fate5F5 Bz2hQq4Ai1oLpXZLJiehNrpbOriIqXDqvt160GJslPNXW977wiHwWWoFzCdnXkXKjLltk 0UkGo1vsTc2ltv3mNb5qI8yQ1boNtkL5GUsPsBN433Wks5/rPNuNcH2xPL0lUIsjAZw== 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=NzKzbDo24cto0P9yhxUCdCLMrsMYB/K20g/+OpFjNR8m+SMLaB+iWErS1709h3nkRhNv Ba4WDTQJeM64sv5M2fr66WbRzDXgbNeMV5nVDTNdIW8EMNI0etKCx2geefJBFDh5S+iEB NzOfxUTpZCmywG7ZNsRuV3LG7gMV3UgzpCczeB+WjMIVHmW0SMV1JNZW9GZAbvFKGBC5n SQ0pYJsHYvkFxHMtLe/Ml3MgDSkisBWmISS9tKbugvVmVTwZifsgb2TTWcujSF4/WE6W0 RnrHYeYDCkaY3dLGoBN53dT8LS0R1cs1LUJx3f5trlyk2cJEY4OSqT3LpzAdHbdgv9A== 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.41 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (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 A9819606A327 for ; Tue, 1 Dec 2026 13:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A9819606A327 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-f41.google.com with SMTP id 6a1803df08f44-9210f2622ccso127021526d6.3 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=SO9Uk/0tzfy7ULAkmj7trz2EfGIbOsZ84HesXqpjgdDeyn/jfk5fBpEnfaWlphMuZZ c/s0ljIrDJVNkaSuBO6c7GBCRdTGU33oANUFo/KGA5oxZ8aSB1fi7BMB3HpnCCU8Q+ce 5wXZs/DNLy11mzBNT2b8mU7b3iPhOlF3WPL2eiPtt4X1ePTtpl9GCqUHLKYKQ80U2/bW q+IA6pJI5iGZ1wIFVq3wDkXk5b4uwKUd8BbaLFEBpWzmuyZJ8qceKswJI8shPxguWzqL EvnykFbF4oDmbK68VveM9BRYxL+ihan68krh40yvhTegNAE9+X6X0RDQFTvNclUKlUQX ShBg== X-Forwarded-Encrypted: i=1; AL+hErElVFqtxXmO0sbGuPUD9TgH2azehvGw6ZPDWz/6jFUjAJLiz00+uqbaJd/UH5oY5exlXk+X9Xs=@lists.linux.dev X-Gm-Message-State: APuU4Z+po8g+eiJxeqyQJVOEjZdPjPjgcURbHHFKEB5jO4kvQD0Gp/8N kggr1s0IsorsiUOoVRD0a8vtcmakjytloHrS8RRswaA6whlvTL3KE0sDFke5VEy8M2o= X-Gm-Gg: AZFdTZfyDbWAEqL0jaCy8vLmKQwP80RE3BEFSYCNf+j/66HnxEZVM7VIC9qNajxatmn sI0jBihb081kq9cmXYn11BwCFgkeXgGfQKyl/PHvQQpG2zhuX1X1XROE1dL/LhiuJrGfxq1DZqJ 9GISM+JvrwiKlOiK3uY3txixiYmIf6kxetq0FwMEv3A8IOgbLj5IzRn2RkGvCUgXC3E13LWusG+ ilcxqw6ooS36ReuwzMGf6skvNFNE/itlupU6GfTXTeeDMFZjQE2uv2Dw7AIyzPsoUTlpJrCADrQ C2cbG2/A8E+oQZUXsPQFdL+lNuEFVuusQGPohkhP7SpbPjE+XNGxdWAeriZlQYvxdxVtJi9i3CI fQmyWtQuwQaGB4q3JJpc159kvzafKB21FKT6F2J264AEFNZb7b1psvPoIacvkKmcM150sJ1O0Rn 8h2z0k6VRVal7UnswSZ72cWkwOKrJg1z1SeBuxHYZgD9rxwir+wHB+gCuMvILfHCO4u4DO1SHyI eYptwmZPVwLrZsGIEaJH6MnjfJtp1gqOyuApPBvHANXj4Thzp3KfiFE7uuosYh+WW/Z4aHwO1tE QRGN 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: kvmarm@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