From patchwork Fri Jun 16 09:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 108974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1196780vqr; Fri, 16 Jun 2023 02:29:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7i3CGHDbR3d6I4eENnJt94akfdqPvlMAA2xnOHrWlYIYDjvg2lm6ykGU/H5w08A+eST1o3 X-Received: by 2002:a05:6808:1919:b0:398:15e7:529f with SMTP id bf25-20020a056808191900b0039815e7529fmr1611591oib.46.1686907758095; Fri, 16 Jun 2023 02:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686907758; cv=none; d=google.com; s=arc-20160816; b=VhGP3WbMBXrx4Lndby0F15ZgmVO8EIV+Crn3s83Yan7oftwe0W1ikkz0Yd1MRt1tWV bTwn+1bbtR5caBk/6sePD9y9j7pHYLEPSUxGWkXqWhA2Qq+I7kWi13s2z4r26uCADspa LLbjGHlsu2jP5EIInEaLhEc6AGUksApziSscoPlgARyJaaIMApsJqo4egVRCnrf5ZrR5 YX0q8Cm6CRr/D7Qqaz8RzhfQZakDyeKviCaiZj5dmiS2L225u2mlgNiZkVGrXboQD+xy wFfn4Ax3meruVFBI/gUjbXnmyUXTrjEoiDQohmlZOlX+A8+0wzg/Nxxdr3xw+ag87rBy bm4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=MjTC0bn1c6tuURZzGvFsI612RvzdiyDdTjdWG5MDlzU=; b=gFOBVy4wAhNBxSIPP9IWiXgDZRpjfSD4W/cnGWnigYMFTOzbUc4iyMzQ5Z7ZXIGET5 Uo2Grl9wnfNDPLVUUtsmhR7iscAbx4y/w7oTxN6EQU81HbN5vdFXVEVy1rfcOsp/zMdD /OZtUHG1Y4oFS9yijuafW9C48x0CPvofwZ5rWqHlCCoD3Nd7lWCBbyfKmCHUcWbileU1 KSNeJAys8c3RUF8+Ox2NxopshYadipfKNJY4Md2onyP0ZvVJbMEQ0ytRSlc3Hh5UJMO+ A0kdItFtvg4tIGjWDa44OazKvR0L1q73gl7Pu4hhN8Gdbss0+2KxndjTEztic38a3c/6 nLYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wF2SmJWu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ezM+NdLb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a17090311d100b001aaea258805si15353060plh.134.2023.06.16.02.29.03; Fri, 16 Jun 2023 02:29:18 -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=wF2SmJWu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ezM+NdLb; 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 S1343880AbjFPJZI (ORCPT + 99 others); Fri, 16 Jun 2023 05:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343991AbjFPJYt (ORCPT ); Fri, 16 Jun 2023 05:24:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3E28271E; Fri, 16 Jun 2023 02:24:43 -0700 (PDT) Date: Fri, 16 Jun 2023 09:24:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686907481; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjTC0bn1c6tuURZzGvFsI612RvzdiyDdTjdWG5MDlzU=; b=wF2SmJWuNppxnWPNrs81++B5IdpKH61pDoL/tR9JOHqjEJ11/n1l9kOUl+fMgrnqxDlmIC O3kJfSi99UVFzWr/CHTxCxSKkvv/pYrCIIkobhmmkKL1NBgcYMvQ/8UjIcZWAeUpjfHPa0 5Un7u52oetO6mciwq2mQ3LCx5HuFcDl3PZYaixL9gGGPF8Bs/StdWXZbQTZm8Kf7J4duXr vXY98MKyEbxZZFdN4Tchya+kHmW18OJhG12M5Y3JfRgQDFrSBTdSgZw0vdfhf/3fxH3UvV zOFEUtuvKYT4+6mxhqowa+7YMnuES9zZY0KqJkBcvpjTO5tdK4rKvAmd6Qsghg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686907481; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjTC0bn1c6tuURZzGvFsI612RvzdiyDdTjdWG5MDlzU=; b=ezM+NdLbqduyvN1oe2vodJ+TxHZ91y5g1UqcEsjacSf7udrLhxZwVLGp7VrOW6RVoKN4uD NN6UEWF2qkSMRuCw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/fpu: Move FPU initialization into arch_cpu_finalize_init() Cc: Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230613224545.902376621@linutronix.de> References: <20230613224545.902376621@linutronix.de> MIME-Version: 1.0 Message-ID: <168690748113.404.13314023725457189436.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768632898043017618?= X-GMAIL-MSGID: =?utf-8?q?1768850989166179996?= The following commit has been merged into the x86/boot branch of tip: Commit-ID: b81fac906a8f9e682e513ddd95697ec7a20878d4 Gitweb: https://git.kernel.org/tip/b81fac906a8f9e682e513ddd95697ec7a20878d4 Author: Thomas Gleixner AuthorDate: Wed, 14 Jun 2023 01:39:46 +02:00 Committer: Thomas Gleixner CommitterDate: Fri, 16 Jun 2023 10:16:01 +02:00 x86/fpu: Move FPU initialization into arch_cpu_finalize_init() 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 Link: https://lore.kernel.org/r/20230613224545.902376621@linutronix.de --- arch/x86/kernel/cpu/common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 2807e5b..46ebdd6 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1604,8 +1604,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) 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)) {