From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131319; b=Jh7RKHsIP6BnzfhHX5KlqznFlMdefNTalTAbu+XbHm+c81BIlkdp3GabbB4D1gaHi1WQ 1U/uX+/YxSIQStnrRJeuJrp9ulls1jSvBPgzU1Ov+PyqoSmPo5G02LgecS5c2yejlbjDG v86DorMnE5OfOwpqnn8HNiEWwjtokaFGEHk0Llo0To8JrOTF6JvO7DO7oNd7bqfu2m34j o0Xbj7rEU/IZasnpQHsiMLQOqLoaS47xUh9/X9796+FpCsNp8Rn8EFpmzzFOEkNEeKoYY L0ZUMGG3v7vLpTN1Da4tqRwj6KQ+A0MLsiHM+mrmGnxXsH6bb3TOyJNE9BpFbusxUgQ== 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=WSa4gryBHpWGmp3N6b6uP0zw7e4cLcd+8NI9FFgOQCrnA3jLZgU5wrj6+IWrWtF8NS9N Gls3vmaRQktXRcShOMtn5EKNy1oYThtG+kQn+ag7SkRnzQ9q0QZHsBsPmpwncHqliCzrf Fn9ZRpaTFNFmeQBL0suRffUVEX2Rahz5tnrClUds6DL+/4Tx612QYDG60+IQgjmhtDFWW Zzhpixbm0oGxR6+It7IlRLVBtFMrIsfLii20tao7+dYatBn3+qokFjAl2cbxjIaWmWL3H 8Ta1wxKNRaclVdni+UsSUwgW42Kw3iG8rOZANovStxchGH7kVJtuGKHPji+/2DrhICg== 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=NAPk0Wt4; arc=none smtp.remote-ip=209.85.219.42 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 A4949606A31A for ; Tue, 1 Dec 2026 13:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A4949606A31A 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=NAPk0Wt4 Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-9210f2622ccso127021516d6.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=vger.kernel.org; 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=NAPk0Wt4VfjFaJXVBUpzsEfpGMEdB64e7eR5ReqkKuXVwFL5HmM9Skk2QgCTqTwfDN qVRzYVBjx6O/ByJGdCDLNpH8XPO+ypBrLmd/0oE2BpsuDEA8M480+y95lAMzbf+RAtBU QOS/2X7ZMrNd81WD4HZN1uUzZ1a0h6UgOf+7H1RDiR1TAdm/P/9eeLiSlvt2aGGT/Soj aFa4Zro5UavjmIZKhHbpKp0MKmcp3MU6uRe9fYfdRm6Cru0HgTV1LfbdmnSLbcQoRdem RApQ1h0zVEhc3jWYjKzj3Pf1oFnKaJTeU7w4JzGbfM/u7RExJJ53NqsP7tQ77puB/FAi 6gyQ== 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=oy7s8apbeBpy6/F2+p8oxb7ZZJJfMISSXxcehAJVeMrb88gmlBwdwPGotou3eSQcFq UJXStd9oxUMyBo2KT2TXkDYtwq6aRT5Q0eIc2X1wiACuBl9ARKSfdOzAnn55oP49iEk+ 39yc6OAyuJxfCt2f4U+yiSntEd02vcG6DnTNwMOOFAdNxY+jryPrOQ1fliO7gdVrnanw Y6XmMWEYDYFmB1Oi5RhOxHDL+TWCCKdvIANKtaYoQnPaBaWTBRR6kmNCmOka4J2B9lFf dSgFrLMZPN3nY/V2ByqYAqShW2oE+5IM0gPbPHHPC0KQM8rcp5j6NuYIkjuIQH2ZNv6Y 7lVw== X-Forwarded-Encrypted: i=1; AL+hErGSnFfYlr+9f3CAg6Ed4nn63AhFPa4SEQHucOlRPiLd7c/Ft66f5WBaUG2k8gQu61avhXlm+t8/R7gSdQ==@vger.kernel.org X-Gm-Message-State: APuU4Z93tQEjJG+8hCweKv9g1tU1roC3M5B10Z6NrHnobpfbrJcg6xzh TKJJd3zjzwGbM1OCDk6XbOU1xoayubilj+45efYNGp5JHGSc7RGS338A77ct2gNrzTo= X-Gm-Gg: AZFdTZetyZBi3NCUPbIETL5hM+RqSyFh2eLt4dLO6OjpVNVHYCDClctsVWgTnMw1e62 LHdtNll2vr/cRWOO98tphO6r/n50BVnJJh++UCb2CsvB85Yt3ySW1zzcDBGTUWOcTCoYpPRcKEA ADWQ2V2Ccs+3uo3v+1bMKawZjqh2IJ1PQRHnad7eyuZulg6cW0rIgQTbvTgFGR9Vw3640jd2lyV QgBUvbl6PsSa7Cq20b4eimaFiLU5wXpyOjk34y0egNMNk4xhrufCzlTqHOprkN6opjlR0E8Lv4b Wyr5SsiYnkntxqcjN1IPAI+wdXkVBYYjWwi5CsAp3TkNl1NzYDrVAVWzrqhx1a5TWuIbzbhCrSW a7XxEeP6WeFULY9Fyaj1pnNPUD9LCvGz5o99/7Luo2qVxn10qDX3lUjfmJbKiV52+VZ0A3l5Ujg VrQUY6C5mGasLNSt/UZ0qeTh3AGgn7bqjJaAPZVvnM4wDfx0TvKnN20T3WDedP07ePhV7hZUAAr RqhxBhLHUyH4MAS9pP2G0+zNmOrOZzT7aIFAArhPkaKRtIf5q6+l7Ctod3a5r+0GDBOnczE825s IPvr 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-media@vger.kernel.org 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