From patchwork Mon Oct 17 13:47:32 2022 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: 3466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1458429wrs; Mon, 17 Oct 2022 06:50:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CcW5RO2JwFn1H8y5t/QrNDDXot7vaT+UHwtvxdO7Pn+ZIu9L6cg6FuOMip76voWWpfFtF X-Received: by 2002:a17:902:778f:b0:17f:8347:ff83 with SMTP id o15-20020a170902778f00b0017f8347ff83mr11898955pll.146.1666014626440; Mon, 17 Oct 2022 06:50:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666014626; cv=none; d=google.com; s=arc-20160816; b=XiUGRJdUknCAOJtJzdF9LvBCvFCGBtj2sTA0YBYxZFWYLLLQTm/8B99q1AyqmpIsxw Isduc24dgpQjgkBA8HR6lyFhsz2QFTixhlSwQWsivFDVRynHlV5pfs+Slx3/AVuUXKQG evd0QSl+t+kvGL95f2IP/wc+LhZHKK0ofVprw2zN0VqN+u/k7YoouVT64JAf4oNZKEEQ ElmsBnUYPrpicrLf95jaeHakeLLGnhjQaeIDgZ94Eu+59s1xDLZ3kYQYS4z7WGRS0/wx Gm1/s81Ngg9rJezNwOka0u3rCok21/48Alzkn6A6aLHH3rPqDPe7iBD6Snl7rzSBGv21 2QXQ== 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=RYRgwFQgQpDYP5WecjoI1bYhBCL6RdxmeiLAElFhWwY=; b=zVRvTOubToEnJ3hunV7qwEdJVQeiLpHbI0EGBsl9bKX/tS5C1Gn6vpUUTC+kOVc+tt VQ6w7hLDJ7VPQVJz8Y/Z2CIkO80xG9m3zg9uff2bEGhQ7p+dUpOP9Um2GvlT7pgc+2j5 UDaNXZLzYy5pObUjLB6Ol1JvQXwxlAVj9ugSiylRM8nD4hl0xGhGavIOdG1UpKqcd2i3 H8X8V+t7S92mmM/lwIiOTOy3FC6Ccq0OoJNXLbHQmORfePDKj5Ki29TMlT2kriuxR9vR 3LYzLF2Q4zMCobtvkdq5nHlsMd0RNrtZL8xf6Qd/5ZJA2HpAW1WnfcVly7BlUENwLynk yCCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=u7WleTcU; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a170902ce9100b0017e90e88875si9746118plg.384.2022.10.17.06.50.10; Mon, 17 Oct 2022 06:50:26 -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=u7WleTcU; 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 S229973AbiJQNrl (ORCPT + 99 others); Mon, 17 Oct 2022 09:47:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiJQNrg (ORCPT ); Mon, 17 Oct 2022 09:47:36 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 433AC58DD7; Mon, 17 Oct 2022 06:47:35 -0700 (PDT) Date: Mon, 17 Oct 2022 13:47:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666014453; 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=RYRgwFQgQpDYP5WecjoI1bYhBCL6RdxmeiLAElFhWwY=; b=u7WleTcURbWvLQy7LWzgcd8+NqDyStSfsOUENOo9jiBro87pyyfm9obL092LSBswvrZzUW ecpArw43LdKd542EooWeLRfj9aY6QP2d81yUifrtbJ4Spfz2P4AelTV7LNw0iGqyhrT7ie JIYVvoAHqiKzWoQLYa4Mi03nD4bn95wrXlfV+v591IKKeBVoaRdYpvPi/08zeXiD3Ms+Dq MDe5KOWNcmdgXQWmjJFhwA7FNjO7YqvuJ7p5wtIcCxbu0LtPdS2FoyhK/aTy7AHYMbms2P v/dwmxQAiCpPo5bjQZTh86omZAVYHbyvFz/SrLuZK9SNW/XwEKC90pxBZ3fYiA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666014453; 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=RYRgwFQgQpDYP5WecjoI1bYhBCL6RdxmeiLAElFhWwY=; b=syq4pA0mfazDEMp5le6CZeJxDOcIP5nKqScoiImN5ec//N+Cxtkyg4cBG7sSdcKRV+t0hO XNMvQ7RVODzcIuCg== From: "tip-bot2 for Chang S. Bae" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/fpu: Configure init_fpstate attributes orderly Cc: "Chang S. Bae" , Thomas Gleixner , neelnatu@google.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220824191223.1248-2-chang.seok.bae@intel.com> References: <20220824191223.1248-2-chang.seok.bae@intel.com> MIME-Version: 1.0 Message-ID: <166601445264.401.13144053597878691608.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 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?1746942952962187612?= X-GMAIL-MSGID: =?utf-8?q?1746942952962187612?= The following commit has been merged into the x86/urgent branch of tip: Commit-ID: c32d7cab57e3a77af8ecc17cde7a5761a26483b8 Gitweb: https://git.kernel.org/tip/c32d7cab57e3a77af8ecc17cde7a5761a26483b8 Author: Chang S. Bae AuthorDate: Wed, 24 Aug 2022 12:12:21 -07:00 Committer: Thomas Gleixner CommitterDate: Mon, 17 Oct 2022 15:44:25 +02:00 x86/fpu: Configure init_fpstate attributes orderly The init_fpstate setup code is spread out and out of order. The init image is recorded before its scoped features and the buffer size are determined. Determine the scope of init_fpstate components and its size before recording the init state. Also move the relevant code together. Signed-off-by: Chang S. Bae Signed-off-by: Thomas Gleixner Acked-by: neelnatu@google.com Link: https://lore.kernel.org/r/20220824191223.1248-2-chang.seok.bae@intel.com --- arch/x86/kernel/fpu/init.c | 8 -------- arch/x86/kernel/fpu/xstate.c | 6 +++++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 621f4b6..8946f89 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -210,13 +210,6 @@ static void __init fpu__init_system_xstate_size_legacy(void) fpstate_reset(¤t->thread.fpu); } -static void __init fpu__init_init_fpstate(void) -{ - /* Bring init_fpstate size and features up to date */ - init_fpstate.size = fpu_kernel_cfg.max_size; - init_fpstate.xfeatures = fpu_kernel_cfg.max_features; -} - /* * Called on the boot CPU once per system bootup, to set up the initial * FPU state that is later cloned into all processes: @@ -236,5 +229,4 @@ void __init fpu__init_system(struct cpuinfo_x86 *c) fpu__init_system_xstate_size_legacy(); fpu__init_system_xstate(fpu_kernel_cfg.max_size); fpu__init_task_struct_size(); - fpu__init_init_fpstate(); } diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index c834015..f0ce106 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -360,7 +360,7 @@ static void __init setup_init_fpu_buf(void) print_xstate_features(); - xstate_init_xcomp_bv(&init_fpstate.regs.xsave, fpu_kernel_cfg.max_features); + xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures); /* * Init all the features state with header.xfeatures being 0x0 @@ -875,6 +875,10 @@ void __init fpu__init_system_xstate(unsigned int legacy_size) update_regset_xstate_info(fpu_user_cfg.max_size, fpu_user_cfg.max_features); + /* Bring init_fpstate size and features up to date */ + init_fpstate.size = fpu_kernel_cfg.max_size; + init_fpstate.xfeatures = fpu_kernel_cfg.max_features; + setup_init_fpu_buf(); /*