From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E549A2309B0 for ; Thu, 28 Aug 2025 17:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756400978; cv=none; b=teAIhS2zXQI1xs9ZYKwLNJ8t9AtD9T7Oe+xUoFq0AbzxTsMg9L84F6aYJlZe+IQrVIdQ81E9DfP0jcrIsPBLqi4z2P2AQ8VgvGXEQwKGxjm7sBmEttM8Uipcx7mnHDYvYKlmN4pGE8ImvcK0Woiz/9BOycqyJb+sUf3myWcf/HI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756400978; c=relaxed/simple; bh=atYDMYqzOJzVcitfyznlT8cS1SLRw7KN+22z43T7QQ0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BpkA8Tj7A6X0P4qTWDc6XmHo8PzNCe+E11PV8+BYej9aIXIUuKEdhuLc3fiHw8SgfvB+3PUWFAfCmT+sOQnNemgwmn7fM2knqMyismjJiGRsQTP9Q7/OP6I1agOkEpI5pZwP4SWYbjudHROefwWuJnZX1T5HntWNm/HNKZBnwU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B923AC4CEEB; Thu, 28 Aug 2025 17:09:36 +0000 (UTC) Date: Thu, 28 Aug 2025 18:09:34 +0100 From: Catalin Marinas To: Ryan Roberts Cc: Yang Shi , will@kernel.org, akpm@linux-foundation.org, Miko.Lenczewski@arm.com, dev.jain@arm.com, scott@os.amperecomputing.com, cl@gentwo.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v6 3/4] arm64: mm: support large block mapping when rodata=full Message-ID: References: <20250805081350.3854670-1-ryan.roberts@arm.com> <20250805081350.3854670-4-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250805081350.3854670-4-ryan.roberts@arm.com> On Tue, Aug 05, 2025 at 09:13:48AM +0100, Ryan Roberts wrote: > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index abd9725796e9..f6cd79287024 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c [...] > @@ -640,6 +857,16 @@ static inline void arm64_kfence_map_pool(phys_addr_t kfence_pool, pgd_t *pgdp) { > > #endif /* CONFIG_KFENCE */ > > +static inline bool force_pte_mapping(void) > +{ > + bool bbml2 = system_capabilities_finalized() ? > + system_supports_bbml2_noabort() : bbml2_noabort_available(); > + > + return (!bbml2 && (rodata_full || arm64_kfence_can_set_direct_map() || > + is_realm_world())) || > + debug_pagealloc_enabled(); > +} > + > static void __init map_mem(pgd_t *pgdp) > { > static const u64 direct_map_end = _PAGE_END(VA_BITS_MIN); > @@ -665,7 +892,7 @@ static void __init map_mem(pgd_t *pgdp) > > early_kfence_pool = arm64_kfence_alloc_pool(); > > - if (can_set_direct_map()) > + if (force_pte_mapping()) > flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; > > /* > @@ -1367,7 +1594,7 @@ int arch_add_memory(int nid, u64 start, u64 size, > > VM_BUG_ON(!mhp_range_allowed(start, size, true)); > > - if (can_set_direct_map()) > + if (force_pte_mapping()) > flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; > > __create_pgd_mapping(swapper_pg_dir, start, __phys_to_virt(start), Not sure this works in a heterogeneous configuration. bbml2_noabort_available() only checks the current/boot CPU which may return true but if secondary CPUs don't have the feature, it results in system_supports_bbml2_noabort() being false with force_pte_mapping() also false in the early map_mem() calls. I don't see a nice solution other than making BBML2 no-abort a boot CPU feature. -- Catalin