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 48968606A329 for ; Tue, 1 Dec 2026 13:22:10 +0000 (UTC) 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=bTXZpkv4 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B185410E2D3; Tue, 1 Dec 2026 13:22:04 +0000 (UTC) Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC2FB10E2D3 for ; Tue, 1 Dec 2026 13:21:58 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-9210f2622ccso127021546d6.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.freedesktop.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=bTXZpkv4NOxTx1sAs4oYhM12yXo3TtYBEoqTiibvCgmkQlrE/6vxPjyX/rUkKPyRIx fYYL3XLQeHP/R1OcOG18TWL+zEJu73Csxb9kYOD8F6ZMg31rd3IsF2vITQXSYa5CIu2i xUqiK23gAy81/v2jbfXz8F081juccB5Pr+pL8Iv5Er2ljiCRh14hxPeDoNM2JKkrDsQK qzxYIpRsGT5PVVUG6LsOLF7RM/J7fChxH5tTL5t9wT+TyrpgLfBcUpOVyX6MAiAFNkzX L255dTBTGWzQotVDz0u0UCgDU29XpjGE/eOlF/bCWv3JEMfqlR8NgCPuabm0klhz2wz6 qopQ== 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=eAeDtWaXzkCoirbzOW1+tMSR6XCYw2zKDANzkCY1B4Ved5lCGKQnZhZYzbq5+SSfE6 etV2WbYBjQ3ck4FcQj0PyUJf0uzeSENiNeuocXzG54OBFlaNnRqVO+TFjbNK5tw7eSvb OUKRB8KRLniASOMWkGtaqNN8ISV+P0tWtdyTuuN6dTZYqTJ89AETzC+MCxWG82MjXd2O 7MLgUtyCghTdMwfHaPC2mJMH8aL6cOisHvj3erQZe8jpX5V1FVizYYsBG5c0kG2TsS+q jbiPTYnt79AKrSSa0gAaC3rYJ6dGFnFz75HQUjF/BWP7QcVHIWCMzgRdN2lxjhdks0+D Imbw== X-Forwarded-Encrypted: i=1; AL+hErEV3yE4eaaXDbMqBJP0QtoGe4pcG0XVDnwD9qfSCNG8F3rUMDUtC1+cdPcKQlduIu3XWRjR8H3d1To=@lists.freedesktop.org X-Gm-Message-State: APuU4Z8PDflTX2JD1UcM0InGInNu4S7N9IoWjbAPenH3MvHHAbur9P8+ AkJlQ5Yw4Q9z3bmICUoH+u5UvKe8zERBFZQ9DcpYOj4A/m/zHDNUBmDoJGyBRdE0IWc= X-Gm-Gg: AZFdTZfBSLAB0eMUkVKbVxvBrWNPQHLr5YtNaTEiGRuJLH6YiEGNYCerQql/W0SX0xG 9kzA1L1YJhoJRLcMtomUUxBZP442lFqGixqhUJaKB7DikrSWhqxkJ+fp+L+hC5RxmKFqmCMn70G GsUfhr1yAuUqJrHVUa1b9bxBkIkmLzz221zFeKCchJzZAjbRKGs3ZubB3G3sOole8ejTHhe49ew enLa05lSA4ZZw4QdjOVviGZNMpiSP3xgwAq4+kXgQ+1Gpej3fhyAbWE6YCJO8+RafJJYIovt7tv rSakhZ8KYo9/Q5TIZmpkdRZMlYsGik/ipCVRudAokpSZaLOOVtH8BZcR7Y7+02/4QTB918RFiHw O7SRuE+5J++SFP2UcVngtDp5oL6l0ESW8Oks4pZwo7CVp7EtNk3JZrce0afk0CRA1hkHO62w4QN 5G5UuHyi0OmbbQoLd4rL++xh2hxW9FyRVi60GMO0lbwv+0OADNregTFZQ6Hc2Brf6yzxk/+Z1w4 5K49CCsAWnfOZQZwUMNuIAyDh3d3rKLPlLvxHtkC1CLkhnNnWcrZOPWl1oCIGuBCVbboVhEmAHM ziAb 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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,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 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