From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF61C433E0 for ; Wed, 13 Jan 2021 01:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 693452251F for ; Wed, 13 Jan 2021 01:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727131AbhAMBmW (ORCPT ); Tue, 12 Jan 2021 20:42:22 -0500 Received: from foss.arm.com ([217.140.110.172]:56494 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbhAMBmV (ORCPT ); Tue, 12 Jan 2021 20:42:21 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 884F8101E; Tue, 12 Jan 2021 17:41:35 -0800 (PST) Received: from entos-ampere-02.shanghai.arm.com (entos-ampere-02.shanghai.arm.com [10.169.214.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9F2DB3F70D; Tue, 12 Jan 2021 17:41:29 -0800 (PST) From: Jia He To: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anshuman Khandual , Suzuki K Poulose , Jia He , Mark Rutland , "Gustavo A. R. Silva" , Richard Henderson , Dave Martin , Steven Price , Andrew Morton , Mike Rapoport , Ard Biesheuvel , Gavin Shan , Kefeng Wang , Mark Brown , Marc Zyngier , Cristian Marussi Subject: [RFC PATCH 0/2] Avoid booting stall caused by Date: Wed, 13 Jan 2021 09:40:45 +0800 Message-Id: <20210113014047.14371-1-justin.he@arm.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 moving init_cpu_features() ahead of early_fixmap_init(), we can use cpu_have_const_cap earlier than before. Hence we can avoid this stall by updating arm64_use_ng_mappings. After this patch series, it reduces the kernel boot time from 14.7s to 4.1s: Before: [ 14.757569] Freeing initrd memory: 60752K After: [ 4.138819] Freeing initrd memory: 60752K Set it as RFC because I want to resolve any other points which I have misconerned. Jia He (2): arm64/cpuinfo: Move init_cpu_features() ahead of early_fixmap_init() arm64: kpti: Update arm64_use_ng_mappings before pagetable mapping arch/arm64/include/asm/cpu.h | 1 + arch/arm64/kernel/cpuinfo.c | 13 ++++++++++--- arch/arm64/kernel/setup.c | 18 +++++++++++++----- arch/arm64/kernel/smp.c | 3 +-- 4 files changed, 25 insertions(+), 10 deletions(-) -- 2.17.1