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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6AF4BC433E0 for ; Tue, 26 Jan 2021 13:59:21 +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 222EF2255F for ; Tue, 26 Jan 2021 13:59:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 222EF2255F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HgQDuYSynxBQNuiHPerkqqXJH9Q6BaBgsZ3Gfy/H93U=; b=obulmr6efIUGqfHg8JRmqk/5s 7SYx06Tc4gFwtoYU8IGr+9jYKLiW/5HIJpN52MDc8daslPUJMAdJvgK0MbZOIxmsb8hGISrCrzOdL Cjm9qMnSIT4QZ0qmjrt0/fbG6VLfQVv9WDGbD1m277SKR/kQGZM87YjnQ2C8n2lV/x2ucwbwXD/yk BByPEZFuG94OMBaNlYSzSeqZQIWvKoff+NXkMh0FCnOa9THGRPacBu+Jv/n+lG4l81PCYez6SmUpw 2qPrSCgkXpjEVjurngC97m2bnvaqSouKg1IFvOs4XzUnvdgFsQKrh/wesXe/pS7GCYStCOj8EBrgw mmYbEQB1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4OqR-0006Ks-F5; Tue, 26 Jan 2021 13:57:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4OqO-0006KT-KV for linux-arm-kernel@lists.infradead.org; Tue, 26 Jan 2021 13:57:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9B8B42255F; Tue, 26 Jan 2021 13:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611669439; bh=y7F+oWWxh1fjhvS0/oYgJ5q2LarzXJddNMbpoRLzou8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AzigRl4/0g9GQwgdqBXyf3gsHha1GfHYFtbDU3N5jkW26gnAuZrcCF1OuW8D1TPYN jQh5WarDLnJy9ljEhBGhTiUA/fPOy95tClb5YkAi290zspzvb43FUVcMG5uN8XlK2/ 56O9nY0B7Y+/FXDc6MKQxykynjbEzTT2Nx7YVhSORkkZ20UFGeNHSsNAaI3kyO6NT6 mNubMMkYjOQ9QMZV2qdaLXdDB2oXRlrikpKj9G/fXpHGCsof+1JOo+kqDn229E/ZSa HQ6OnnOuRbMEpJOCuM9ibcllbTALw9lwdlLfOQWZCskXhhpnPNJmXBNCk1+MrzJIZY 7o2Ab+wqxH4BA== Date: Tue, 26 Jan 2021 13:57:13 +0000 From: Will Deacon To: Jia He Subject: Re: [RFC PATCH 1/2] arm64/cpuinfo: Move init_cpu_features() ahead of setup.c::early_fixmap_init() Message-ID: <20210126135712.GA29956@willie-the-truck> References: <20210113014047.14371-1-justin.he@arm.com> <20210113014047.14371-2-justin.he@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210113014047.14371-2-justin.he@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210126_085720_834348_8F7BD0BB X-CRM114-Status: GOOD ( 19.77 ) 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 , Gavin Shan , Suzuki K Poulose , Ard Biesheuvel , Catalin Marinas , Anshuman Khandual , Richard Henderson , linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , Mark Brown , Cristian Marussi , Mike Rapoport , Marc Zyngier , Andrew Morton , Steven Price , Dave Martin , linux-arm-kernel@lists.infradead.org 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 On Wed, Jan 13, 2021 at 09:40:46AM +0800, Jia He wrote: > Move init_cpu_features() ahead of setup_arch()->early_fixmap_init(), which > is the preparation work for checking the condition to assign > arm64_use_ng_mappings as cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0). > > Besides, jump_label_init() is also moved ahead because > cpus_have_const_cap() depends on static key enable api. > > Percpu helpers should be avoided in cpuinfo_store_boot_cpu() before percpu > init at main.c::setup_per_cpu_areas() > > Signed-off-by: Jia He > --- > arch/arm64/include/asm/cpu.h | 1 + > arch/arm64/kernel/cpuinfo.c | 13 ++++++++++--- > arch/arm64/kernel/setup.c | 14 +++++++++----- > arch/arm64/kernel/smp.c | 3 +-- > 4 files changed, 21 insertions(+), 10 deletions(-) > > diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h > index 7faae6ff3ab4..59f36f5e3c04 100644 > --- a/arch/arm64/include/asm/cpu.h > +++ b/arch/arm64/include/asm/cpu.h > @@ -63,6 +63,7 @@ DECLARE_PER_CPU(struct cpuinfo_arm64, cpu_data); > > void cpuinfo_store_cpu(void); > void __init cpuinfo_store_boot_cpu(void); > +void __init save_boot_cpuinfo_data(void); > > void __init init_cpu_features(struct cpuinfo_arm64 *info); > void update_cpu_features(int cpu, struct cpuinfo_arm64 *info, > diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c > index 77605aec25fe..f8de5b8bae20 100644 > --- a/arch/arm64/kernel/cpuinfo.c > +++ b/arch/arm64/kernel/cpuinfo.c > @@ -413,9 +413,16 @@ void cpuinfo_store_cpu(void) > > void __init cpuinfo_store_boot_cpu(void) > { > - struct cpuinfo_arm64 *info = &per_cpu(cpu_data, 0); > - __cpuinfo_store_cpu(info); > + __cpuinfo_store_cpu(&boot_cpu_data); > > - boot_cpu_data = *info; > init_cpu_features(&boot_cpu_data); > } > + > +void __init save_boot_cpuinfo_data(void) > +{ > + struct cpuinfo_arm64 *info; > + > + set_my_cpu_offset(per_cpu_offset(smp_processor_id())); > + info = &per_cpu(cpu_data, 0); > + *info = boot_cpu_data; > +} > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index 1a57a76e1cc2..e078ab068f3b 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -297,16 +297,20 @@ void __init __no_sanitize_address setup_arch(char **cmdline_p) > */ > arm64_use_ng_mappings = kaslr_requires_kpti(); > > - early_fixmap_init(); > - early_ioremap_init(); > - > - setup_machine_fdt(__fdt_pointer); > - > /* > * Initialise the static keys early as they may be enabled by the > * cpufeature code and early parameters. > */ > jump_label_init(); I don't think your patch changes this, but afaict jump_label_init() uses per-cpu variables via cpus_read_lock(), yet we don't initialise our offset until later on. Any idea how that works? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel