Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1916674rwd; Tue, 13 Jun 2023 16:46:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ka7/JqclnQgxyG9J3BSWcWBoeE0kh9+05cHNk6g/Zxlf7t1H91n8fLOROlBD7Mfrmh2Ym X-Received: by 2002:a17:907:9342:b0:973:8198:bbfb with SMTP id bv2-20020a170907934200b009738198bbfbmr16070378ejc.31.1686699996275; Tue, 13 Jun 2023 16:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686699996; cv=none; d=google.com; s=arc-20160816; b=whFxSSy49IvNFq/cLoYMLaM6FKlRtdmgJTkth7LwOF68buLLqzG4n6Q569S2er6JZk MZJrwmdzspyUSR+PmcPS7cvgAYT7pcQhUX7S+9wUnAjrgmlwJPggD9zi7LsS+6iw3tt+ /w0vkiBMJ3+Hiu8OkpDwt9tGqqPCLUrP94T8J0M/n6MqVvcX8grt+D1arKEXosFWps+M cyrKdC+Abq/TzsoeZ3IiRzfB6DgAVsXTCUUZrecl/GMN/SEMtg5aVQ5Q2MN7jlIlBB7v kh0PuD/ajcPhlZRKX2+XhldT2sRUf3o9giVumDRbMuLNkfjYR0HErb+vT3VIRT0eAFK+ jbAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=yamwFyBvrdZRw7MmNaK/oFEbdYjxMOiCQipNsVidBdY=; b=byP8AiPZy1zAkarjOsjfkCm+hz8lzncpZtrNL4NMdMxCZdp0QXD3+IZvXJQgWmX5do 7brrYGXOjWU+QpxKJwMFSWOa3hpnLb3q0353Kc12C0w8QK4znqBsfjRTVQXPb3X2hMam kf/a+fLrTUf5NTYuB1lRSJ8hLCdILlmWDkGGQjsPjEvuRFTjsckkReM+BgY4h1QlmDQk nzJW7xHzeZj/a/Kzpk4aUG58qC0bQTXX4C4wRLxOIeFQ0s7nVnve9Gg02IZPrV5JHz4C L4pDA6E5tlbYt0/bhi8ln4EnsBBHirCFkU/2G6nv7fQSXToSvkU5pJ284qOYR3w87Io0 jy9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cWEYDV+d; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020a1709065f9600b009771da50823si6906238eju.388.2023.06.13.16.46.11; Tue, 13 Jun 2023 16:46:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=cWEYDV+d; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240180AbjFMXlo (ORCPT + 99 others); Tue, 13 Jun 2023 19:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241084AbjFMXkQ (ORCPT ); Tue, 13 Jun 2023 19:40:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9D3C172A; Tue, 13 Jun 2023 16:39:48 -0700 (PDT) Message-ID: <20230613224545.902376621@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686699587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=yamwFyBvrdZRw7MmNaK/oFEbdYjxMOiCQipNsVidBdY=; b=cWEYDV+dY5cYnXMn2IADOGSloCc3OH/wIBg2KCcN3a1GBDYZK5rpVXHTSZSSIN/yhfKD9K 8XlUkdVuOUDM59G936HR6j4FbZOl2H5DewIOODAfyBkMcjXYqaEOYz/MpDOMYJNz57yWmE pQuBR5WiKkJFnGdKlDddnv9zw7hZeJIARpezajt4Bxgjut4M5LbDIuiqMY9bB9AEE/tjF2 M3UtuoWNv4dZOFpHAQNjDR5yhYPWMZDbscvMZlYp80E0Kn79G2MbnY46KVamXyOzw6l6qg nQzjxn74Ci53FU7fX+qNLFBzEJ36NVdF92GK9x6ZIJWM70t4Jn1qeXdK4q0VTg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686699587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=yamwFyBvrdZRw7MmNaK/oFEbdYjxMOiCQipNsVidBdY=; b=4Jqf4+d+0ak1Fk64uiL4SdD5UndpKcuYFGikhaVTmOBL0kGv65OkEbKG0c8uYhV9hqzAUy LBd8FLWl65qGHGAQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Nikolay Borisov , "Ahmed S. Darwish" , Arnd Bergmann , Russell King , linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, Huacai Chen , WANG Xuerui , loongarch@lists.linux.dev, Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , linux-sh@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Richard Henderson , "James E.J. Bottomley" , Michael Ellerman , Chris Zankel , Tom Lendacky Subject: [patch 17/17] x86/fpu: Move FPU initialization into arch_cpu_finalize_init() References: <20230613223827.532680283@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Wed, 14 Jun 2023 01:39:46 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Initializing the FPU during the early boot process is a pointless exercise. Early boot is convoluted and fragile enough. Nothing requires that the FPU is set up early. It has to be initialized before fork_init() because the task_struct size depends on the FPU register buffer size. Move the initialization to arch_cpu_finalize_init() which is the perfect place to do so. No functional change. This allows to remove quite some of the custom early command line parsing, but that's subject to the next installment. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1604,8 +1604,6 @@ static void __init early_identify_cpu(st sld_setup(c); - fpu__init_system(); - #ifdef CONFIG_X86_32 /* * Regardless of whether PCID is enumerated, the SDM says @@ -2287,8 +2285,6 @@ void cpu_init(void) doublefault_init_cpu_tss(); - fpu__init_cpu(); - if (is_uv_system()) uv_cpu_init(); @@ -2304,6 +2300,7 @@ void cpu_init_secondary(void) */ cpu_init_exception_handling(); cpu_init(); + fpu__init_cpu(); } #endif @@ -2396,6 +2393,13 @@ void __init arch_cpu_finalize_init(void) '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); } + /* + * Must be before alternatives because it might set or clear + * feature bits. + */ + fpu__init_system(); + fpu__init_cpu(); + alternative_instructions(); if (IS_ENABLED(CONFIG_X86_64)) {