From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 889D3606A329 for ; Tue, 1 Dec 2026 13:22:03 +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=o/iqNOFF Received: by kanga.kvack.org (Postfix) id AF8D26B00EF; Tue, 1 Dec 2026 08:22:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA9B76B05B1; Tue, 1 Dec 2026 08:22:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 970C86B05B2; Tue, 1 Dec 2026 08:22:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 63A5A6B00EF for ; Tue, 1 Dec 2026 08:22:02 -0500 (EST) Received: from smtpin14.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7261540E83 for ; Tue, 1 Dec 2026 13:22:00 +0000 (UTC) X-FDA: 85495477200.14.D06A872 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf27.hostedemail.com (Postfix) with ESMTP id 856C74000A for ; Tue, 1 Dec 2026 13:21:58 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b="o/iqNOFF"; spf=pass (imf27.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.41 as permitted sender) smtp.mailfrom=jgg@ziepe.ca; dmarc=none ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796131318; b=dSIiKaXxwTBGsBrEVUTSyk1ZddSCrM8cXlvZpF8R6AGmJhJOBgSQasJd3zoedjtRdJHEZt d/h2t+5oPGzvo1HQ+36NeKp7jusouf7P2333UE6I9UgVlX+q0w4fs6EE3dRjPakC04Wla7 PphoWnJKl4deH4W4FBadfo/AfJ2Pt5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796131318; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WZ1mGEbMc/O1mLUq5FLQjGvnyRDcqjliNg3cIZlNtGI=; b=FU1Q4gsu9Y1w2WxBaVWVDUpvv4Zudgyxx699T1yC5QitWynXEVaT3hui66i/CTMEfCfPMg OLFCw421cDBF5DNXPhh0oyWvRiuZNgpgVpzDPJdUhm1NViu20+lvHh6swM8O7GVLIDRGFN NGmlO8VGZt9AE40bytFiZo6tUjAXqgk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b="o/iqNOFF"; spf=pass (imf27.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.41 as permitted sender) smtp.mailfrom=jgg@ziepe.ca; dmarc=none Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-91f0274f88cso155287336d6.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=kvack.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=o/iqNOFFhmBMaQGYntYVNwgXIcHIHXkH16nyD+KVjy63dSy8ZyRLKEzG2HVGIbxUiD CbrJZSBdc0Lhp7tNH33fLI44ExbsHZUKsuBi4if4Pvq1PeezlmqbItqqyEZb8eqDVelT lCFA1cfhkwe5Vd8imHxF1ycQRFsuFHxu5DRMDp/05SZxWRn5wTKwXUvM0zrXIRkG7QSZ lNEFqj4rKu0UUWrEHZrya4Xrx4Zu2pmBM4F5Rla+EfEkXjcOWaSZqWrhUc9l0XDB0Fxh 7MdG4LFaWUcmx0bX+p/l3k9OEGcS1d8KnktZOff7/RMInInkmVjAq+yK5PNSdUCLimMM 5wlQ== 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=Y9khthVfHnCrDcmB7umyIfdh/AF8R+W392YGSWgDNv3yCPtZ+zAJvJ/rS6CQwR2rG3 15oBj0Qq1XyonxxdNQV48CsHl+mDjVG90m4TYL0/bq9/EoleGfOqlMwmfElSEMVC2CYt Hi6mNA3viOVOwceyh3zcUGH76T9jZunxg/yniscaqDAMOy7WWZ5yXlesrdYPyEChYkTv 9S0nvcENGozGcHk3C0YQ4dRxMfOq2xeUxHaN7pgf7blTM19CmS2/i17DYhxxiGW6h2ZX 1BhwpRgcTW9HeAdsLQ05gxZslFKkm9LRcxr2ECYeGGMiZfesO4UrfNJDyBmuV0wZwtGY EVpw== X-Forwarded-Encrypted: i=1; AL+hErGHtENMOmYfygm1D0gZT0gTPiifDBJzuHxg3l1NP6MSaTs4UjPAV3uhZyIyCuzeTeg0WlvER55J6w==@kvack.org X-Gm-Message-State: APuU4Z+bMtlEP9732GJKk44XBQRJWcP+T/j/4ogHPTLOLju7d5ejuP90 uDdGPEnkzXIxT830M19TP6QJhqXsMCxlJpVr3gx4CYRuyLmqWWcQW1/PRlFhuUq6RAs= X-Gm-Gg: AZFdTZetEOPYFbZ9wRFU4AJvASdEb/LsGXLkb6IjEDYDO0gFdDcrRrwcabL5rqjjwUD y6BSY4kBH85+67U+rcdLH3zGREXBRRgflOGSVzPVumDyEQzFSuWvUdW++zMmeDaC4DCnUlFwzJz 5zKdURhI7T9qeUHnQPn2TTywj+hN/eA4uv2dcUVG/QVJvfwyeh4n1e4aaiConEdzfz4PIKjw61G wNyTN1iTnQk4zLo+kw+C3fARWvOWEyJDqyqm7/JMYkcGAZncFz1AXRZFK6F1k/2oL9HS3g15jjC mA9T5Yx4PlOU3AMWk5xoeIjKHB2BYfbUTQzuuQaDyfETx1EK9ApacjYfuyv3p30oQ382aMCs8DZ CgaJbWyr8Osf81F7uuhvK4dQON/BVGFSyGunPqeJ/R0ht6+TaGTQYjbPavm7O19MdR06qaaW5PC 8kkaOeZ5JJeNtvKw7oB+JyFnvL5G1bfH+MNQxnAaN5HAyBE4tMPfpeWhVqVao6aikBcpqKjoJze ZwTLi98g0vFZA2osEvRiO6bA76QZvV1QCHteg04wT7wtaoEE1afDBTpdHA/5yJnq5+4bqOftfpb bKuA 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-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 856C74000A 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_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Stat-Signature: yh4ryjogztnhbyg7hxognzwsdey9y57a X-HE-Tag: 1796131318-986206 X-HE-Meta: U2FsdGVkX1+vlycSpox1Fk5OSDI6jro1uL0/C4PMQEcGIEDJ2D1mCPBsTVISalXJW4/UHPgiNZ9/1KN4Ha206NBAaSlUf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Uza5ZkdqLFmtxaH2LXEqiU9jB1TcO/XCto2LKquSsbh0r7wuLh0sZ6bUSOk7WwtZ3d2vPM9q0GKoVd8TjzaecvbtErZeBJ2jXVNnJ5v2Xn4mlxny41rQnNvli8wMkUWNyGx6dv4O7ZLlAB3SYiF16u6pomN8j9FtJdMTMR3z5w6xRgVZECLqhr5NyMMBKZJPMPyGQgS/hr2VImsmGtOXt7bPwgQUbTxVJwuIr/6yXkDjKCl5Q0CtxRKxR8GanaMa05FJQBeTFcF/Y/JTvJgrZVR+k9MsVahCUX+kWAfyApaaQQ/uvbkqK+QKWSDubq8lC7DsJ0gBJR8FHoOebvUS7QhUVX8LtRvQ/uA7GYmBYW+O99RXzoxxs0+Ur9L5CkJcFs3vLf9zn/gQAvuQaiHv35EhMZJXbB2W6ut/W4LAy6d8Pbd4oJU Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: 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