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=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 0AF37C433E0 for ; Wed, 13 Jan 2021 01:44:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B9B2022B37 for ; Wed, 13 Jan 2021 01:44:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9B2022B37 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=K9EWDaAUIX0dyxhC3Gyh96AI1abgFd8wO71SkYZE1mY=; b=wHJOwczxjw6QKbbG5yA+ArxWuo GqoeIEjWUKjAoEYD84cAJPz9q56sNoHRb6kynLrOj/SLgZtKUqiXnRfpYUkSUmUcmPuYbXJ5KCJIx JqKlC1TYdmNK49e0H7yLXpjg5Qw/4ujSmRpHtWNnGfhcJx55pPWUlB8iW1jKxvCRoNrPseCcJC3b+ 9fR+HX09e1rXEyzWy6rumuLcwrnSEUuc6ZaHEilrhCMtPJR7xYWxflU0qnX/VhBG0Y/PqLLoXMEwa yiAtcgTNWmoDtzzqAkA0Z6D1DQeAZ6U5IZC4F9fFzvV1RpQe7IUV23e4RTDTu8P7m6sqqalKjl/zY Q19oveOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzVAS-0006oo-Cv; Wed, 13 Jan 2021 01:41:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzVAO-0006mQ-94 for linux-arm-kernel@lists.infradead.org; Wed, 13 Jan 2021 01:41:45 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210112_204144_501468_8E46A478 X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kefeng Wang , Jia He , Suzuki K Poulose , Ard Biesheuvel , Marc Zyngier , Anshuman Khandual , Richard Henderson , "Gustavo A. R. Silva" , Steven Price , Mark Brown , Cristian Marussi , Gavin Shan , Andrew Morton , Dave Martin , Mike Rapoport MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel