From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F34FE34FF55 for ; Wed, 8 Jul 2026 03:11:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783480307; cv=none; b=iXGFapDSNBttpm/inGJykEsj5hI45neQMd9M7Hg3T8MNE4jB+TWA/IFuNdkzxscmAASceK25psN0LU0+PhdeCp9mrJDoj09p5KJe6/FFKNGSQQdMDwIRAiuuEfXhZWIT0yUUuYS/SnXd2bWcn9iATqWh69jIa49xXb1cqM3KPyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783480307; c=relaxed/simple; bh=O/bUHcYh6LrnfJm45LO5Mn961f3tUmEV8R/NxV8Exws=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=o7Idjq8Fr2Jul1a45tUMG00PPRQdy73FC8+zQK2jAL9mx56Uc5+f0ZVxVcLqbmCj3GpXdzZtGxMiHVCaLmKPGjJerHKnVmwJy2eD9msDebdddPE7ZFnwKc6vt3KrweGZ+2CVnaMjNVNDdTLgnnDFrSizwftzwxhopfpLSwVMPKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jthoughton.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YwSaYelF; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jthoughton.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YwSaYelF" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2ccea73f81bso4132805ad.2 for ; Tue, 07 Jul 2026 20:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783480302; x=1784085102; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=avFc8g+L1eyCm5XCDbsRZSWjyRAAOJ2Cs9ZxfGGqCu0=; b=YwSaYelFxS/q+aFMTelTcGO58zQ+CfrK5EC5eSGBzHhpXSzztmChdaeog66QgCb7SQ A03J0UERTXA3TOi9nHRJe0tjxKoR9pNe0+xdAPeJtrSKjyRNggIbxZZDsrDiwaPcejpg IShLaS8hG3izKScr/4HCgQWWkBeSX9BOUUx1k0OYk/XJSmrSiW/B6Euk1QTAKhthNkou hbLmsE1fwQX39O4JWWQ8ZkZxf5cMswM6m73b3+oXb18rV6DjO5ZRFrpLumBYHCgyBoXh UN/rYKHLDnVe049eEJfR7mB/fmQPgxTpw5PpAYuk8Ixn20eiPwGdVgP/lv+Sq/+zInNi KplA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783480302; x=1784085102; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=avFc8g+L1eyCm5XCDbsRZSWjyRAAOJ2Cs9ZxfGGqCu0=; b=DLIuueWhOHprz9oARqXVCIyVY1DYJk31Q32siKXS1gRU/R7ntfTb685quyuTI5Hke9 guWgUqk4UeGUfvq67523Dt0k6jeEKnp7EczerwLGuc+4ZeSDXISnG8Omr0/O0gas+wRA /dFo87oJ7Nh7vZ5yAaG2Wj6y/6mJNPtpeLJXXQJhNW4zyLTX7NoeucSvTiwwwYaQNaav exDN/ApqSbS6DpZG++uH9i17pwqd/mdKIBvHdOJFkQbBLxI6mgIkxBjkh/fnxisx/D8C m7uKngwNrmuOtXLTC53jLjBp/hAw8TGaoVUIGFkiXtMwl02AupKwaYEGx4PyBrvZ7qK2 g2Uw== X-Forwarded-Encrypted: i=1; AHgh+Rovkjd3pBC1ErQl3lAoLxhBINR06x01LfVXqmT6EcbVaADUCqtyA4SsrbKNDopF2j0K8niLMw9AiUPzp+k=@vger.kernel.org X-Gm-Message-State: AOJu0YzO2pHepsueGtMue1wngwYPR7Fl9C1mGBYh1XqYr+K4vyAX3Lok c5bcem0nPtuvIqMAlcgCNBF5ms7KrXTiElVcRf9+lEaQHPEnWVxQnJ0NQ56/8FyOrnd5k0wDG4/ LztZfpEtgN3yG4j+eWkqtzA== X-Received: from plcs20.prod.google.com ([2002:a17:903:30d4:b0:2c6:a770:7a87]) (user=jthoughton job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:32cb:b0:2ca:53e1:b915 with SMTP id d9443c01a7336-2ccea3b6c11mr7143285ad.14.1783480302107; Tue, 07 Jul 2026 20:11:42 -0700 (PDT) Date: Wed, 8 Jul 2026 03:11:20 +0000 In-Reply-To: <20260708031129.3503195-1-jthoughton@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260708031129.3503195-1-jthoughton@google.com> X-Mailer: git-send-email 2.55.0.795.g602f6c329a-goog Message-ID: <20260708031129.3503195-11-jthoughton@google.com> Subject: [PATCH 10/18] arm64: Support hugetlb vmemmap optimization From: James Houghton To: Will Deacon , Catalin Marinas , Muchun Song , Oscar Salvador Cc: Nikos Nikoleris , Linu Cherian , Mark Rutland , David Hildenbrand , Andrew Morton , Ryan Roberts , Nanyong Sun , Yu Zhao , Frank van der Linden , David Rientjes , James Houghton , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Now that HVO is architecturally sound for arm64, enable support. Add a new Kconfig for this support, as it comes with a regression, described below. Add a comment about BBML2_NOABORT where HVO is relying on it. If a late-onlined CPU does not support HVO (HW AF and BBML2_NOABORT) while all boot CPUs do support HVO, the late CPU won't be onlined after this commit when a kernel is compiled with HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y. Signed-off-by: James Houghton --- arch/arm64/Kconfig | 12 ++++++++++++ mm/hugetlb_vmemmap.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index b3afe0688919..cf4bd6bd7f11 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -259,6 +259,7 @@ config ARM64 select USER_STACKTRACE_SUPPORT select VDSO_GETRANDOM select VMAP_STACK + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if ARM64_WANT_OPTIMIZE_HUGETLB_VMEMMAP help ARM 64-bit (AArch64) Linux support. @@ -1607,6 +1608,17 @@ config ARCH_SPARSEMEM_ENABLE def_bool y select SPARSEMEM_VMEMMAP_ENABLE +config ARM64_WANT_OPTIMIZE_HUGETLB_VMEMMAP + bool "Enable support for HugeTLB Vmemmap Optimization (HVO)" + default n + depends on HUGETLB_PAGE && SPARSEMEM_VMEMMAP && ARM64_HW_AFDBM + help + Enable support for HVO. When enabled, late-onlining of CPUs that do + not support features required by HVO will not be onlined if all boot + CPUs do have such support. + + If unsure, say N + config HW_PERF_EVENTS def_bool y depends on ARM_PMU diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index 21377f795293..977249e22ed0 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -86,6 +86,10 @@ static int vmemmap_split_pmd(pmd_t *pmd, struct page *head, unsigned long start, /* Make pte visible before pmd. See comment in pmd_install(). */ smp_wmb(); + /* + * On arm64, this requires BBML2_NOABORT. Its support has + * already been checked. + */ pmd_populate_kernel(&init_mm, pmd, pgtable); if (!(walk->flags & VMEMMAP_SPLIT_NO_TLB_FLUSH)) flush_tlb_kernel_range(start, start + PMD_SIZE); -- 2.55.0.795.g602f6c329a-goog