From: Jia He <justin.he@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Anshuman Khandual <anshuman.khandual@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Jia He <justin.he@arm.com>, Mark Rutland <mark.rutland@arm.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Richard Henderson <richard.henderson@linaro.org>,
Dave Martin <Dave.Martin@arm.com>,
Steven Price <steven.price@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
Gavin Shan <gshan@redhat.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
Mark Brown <broonie@kernel.org>, Marc Zyngier <maz@kernel.org>,
Cristian Marussi <cristian.marussi@arm.com>
Subject: [RFC PATCH 2/2] arm64: kpti: Update arm64_use_ng_mappings before pagetable mapping
Date: Wed, 13 Jan 2021 09:40:47 +0800 [thread overview]
Message-ID: <20210113014047.14371-3-justin.he@arm.com> (raw)
In-Reply-To: <20210113014047.14371-1-justin.he@arm.com>
There is a 10s stall in idmap_kpti_install_ng_mappings when kernel boots
on a Ampere EMAG server.
Commit f992b4dfd58b ("arm64: kpti: Add ->enable callback to remap
swapper using nG mappings") updates the nG bit runtime if kpti is required.
But things get worse if rodata=full in map_mem(). NO_BLOCK_MAPPINGS |
NO_CONT_MAPPINGS is required when creating pagetable mapping. Hence all
ptes are fully mapped in this case. On a Ampere EMAG server with 256G
memory(pagesize=4k), it causes the 10s stall.
After previous commit moving init_cpu_features(), we can use
cpu_have_const_cap earlier than before. Hence we can avoid this stall
by updating arm64_use_ng_mappings.
Signed-off-by: Jia He <justin.he@arm.com>
---
arch/arm64/kernel/setup.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e078ab068f3b..51098ceb7159 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -306,6 +306,10 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p)
/* Init the cpu feature codes for boot cpu */
cpuinfo_store_boot_cpu();
+ /* ARM64_UNMAP_KERNEL_AT_EL0 cap can be updated in cpuinfo_store_boot_cpu() */
+ if (!arm64_use_ng_mappings)
+ arm64_use_ng_mappings = cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0);
+
early_fixmap_init();
early_ioremap_init();
--
2.17.1
next prev parent reply other threads:[~2021-01-13 1:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 1:40 [RFC PATCH 0/2] Avoid booting stall caused by Jia He
2021-01-13 1:40 ` [RFC PATCH 1/2] arm64/cpuinfo: Move init_cpu_features() ahead of setup.c::early_fixmap_init() Jia He
2021-01-26 13:57 ` Will Deacon
2021-01-26 14:11 ` Mark Rutland
2021-01-13 1:40 ` Jia He [this message]
2021-01-26 14:14 ` [RFC PATCH 2/2] arm64: kpti: Update arm64_use_ng_mappings before pagetable mapping Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210113014047.14371-3-justin.he@arm.com \
--to=justin.he@arm.com \
--cc=Dave.Martin@arm.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=cristian.marussi@arm.com \
--cc=gshan@redhat.com \
--cc=gustavoars@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=richard.henderson@linaro.org \
--cc=rppt@kernel.org \
--cc=steven.price@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=wangkefeng.wang@huawei.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).