From patchwork Tue Dec 20 06:36:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 34929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2813648wrn; Mon, 19 Dec 2022 23:04:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf79aTOY3QNd5ngJ5uE/6S72+/ymDHLaI2/Ucwjz+2jb3L0aOzv8Vl3PJ/zQbhGvNuqnKgz0 X-Received: by 2002:a05:6a20:c518:b0:ad:f82d:78ad with SMTP id gm24-20020a056a20c51800b000adf82d78admr26991240pzb.46.1671519843577; Mon, 19 Dec 2022 23:04:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671519843; cv=none; d=google.com; s=arc-20160816; b=tgJs1ZSp36qTTHjjzdUA+dwfy5reiGuzM9O3+qmaceTFSRqB1eNkqX6a8CRljTeeIf GE0JVeuQWNtsQ3umlRUvN6vbFxQZfelvGKm6vvwio8XboFy/CxCZkx60kPKptjXhusYU Rkj+cvQ2TExNvkxnoBCGCPgfwMSCaxczSf4vG1lIU/LBLog/azGEAtUeFkIFPZSCWINu p3A6DlhM2afyCQLTE6PF04ihCL6+s3hVqDtIL+JUiItjXaa+UWDCr8V53pMpIuCLX/Cx IBPIvmRsqbmj+eHkI9CBM2vd26wQG6yKzrwv2rzCEHubdrjHCAemkINdY83K4gHfEoOl jAOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XXjEU6qMByx5QO7JjJt3X3mCti19Z6v7TtMpdJMirjw=; b=LY71ZiIhS3TJTuASmIY7oj9Ivfj5EnG48OgVQ2YCtKgoeaiaMWVcoX3OM012GZlnzD OWYmkQKqibxZUWZxtqpNK/scl2t/L+s7F8JjUWo3I7k0KPMr38GMnY6/YqSFnmo+hDKS qmkrdCskFYiESaIH7CsuuzEX+ejDcq79q6V54kk78WMgNzz1OjxeIayIOSY6n3s7WHMi QajWycgwrkkznc4f//r5RSKfizIUFzpc4Aifji28M7wi2DQdJStzUw5ROJMFjcXG5Qpg kslWrnZzmMBHF9O1GKtqx2Ov+pTine4TrfnmbFsVR76hdwAJlkyjIeU0tXKCS31P2pHG UbmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXRAP5+n; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a63cd11000000b0047780dc6a67si13060224pgg.370.2022.12.19.23.03.50; Mon, 19 Dec 2022 23:04:03 -0800 (PST) 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=@intel.com header.s=Intel header.b=nXRAP5+n; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbiLTHDR (ORCPT + 99 others); Tue, 20 Dec 2022 02:03:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbiLTHBi (ORCPT ); Tue, 20 Dec 2022 02:01:38 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCEEB15828; Mon, 19 Dec 2022 23:01:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671519696; x=1703055696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=itDwNcmuOavaLbxBus/tcxgByCKbUIXcxoUL6CHXDYI=; b=nXRAP5+nQHfjuE3qu6ylwfOwQv7rjWkinxcQhDQiH3RdQIBpXlNPmPNj hDk6t4gdCmkBmUzJsBSEqZppRW6oUfqJ5FUyTVpSO9dI2JlxQiLsRjfVv 2RkIAt7WyXkOiZCD/S7pCJIWy8qTapa6piRWK5lRaOL9S+crXLgPU1uMD VAwMxWV6/2DXbxfLM9q3owHOfWvUx/NnwJP+Uu+CYzcYhhdF8ws4HRatF BJcO/f09yNWSqut8NcRIrNzPbmp7yGEvXXVcMAbtcIV9w++K2gQ9YDBIt 21HD3dWQy144gL+a5iboSgGH3479qk7K1XM2BVixVjFxTey6FLtU6ed7o w==; X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="302972042" X-IronPort-AV: E=Sophos;i="5.96,258,1665471600"; d="scan'208";a="302972042" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2022 23:01:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10566"; a="644326481" X-IronPort-AV: E=Sophos;i="5.96,258,1665471600"; d="scan'208";a="644326481" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga007.jf.intel.com with ESMTP; 19 Dec 2022 23:01:14 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com Subject: [RFC PATCH 16/32] x86/fred: reserve space for the FRED stack frame Date: Mon, 19 Dec 2022 22:36:42 -0800 Message-Id: <20221220063658.19271-17-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221220063658.19271-1-xin3.li@intel.com> References: <20221220063658.19271-1-xin3.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE 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?1752715591550932580?= X-GMAIL-MSGID: =?utf-8?q?1752715591550932580?= From: "H. Peter Anvin (Intel)" When using FRED, reserve space at the top of the stack frame, just like i386 does. A future version of FRED might have dynamic frame sizes, though, in which case it might be necessary to make TOP_OF_KERNEL_STACK_PADDING a variable instead of a constant. Signed-off-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li --- arch/x86/include/asm/thread_info.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index f0cb881c1d69..fea0e69fc3d4 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -31,7 +31,9 @@ * In vm86 mode, the hardware frame is much longer still, so add 16 * bytes to make room for the real-mode segments. * - * x86_64 has a fixed-length stack frame. + * x86-64 has a fixed-length stack frame, but it depends on whether + * or not FRED is enabled. Future versions of FRED might make this + * dynamic, but for now it is always 2 words longer. */ #ifdef CONFIG_X86_32 # ifdef CONFIG_VM86 @@ -39,8 +41,12 @@ # else # define TOP_OF_KERNEL_STACK_PADDING 8 # endif -#else -# define TOP_OF_KERNEL_STACK_PADDING 0 +#else /* x86-64 */ +# ifdef CONFIG_X86_FRED +# define TOP_OF_KERNEL_STACK_PADDING (2*8) +# else +# define TOP_OF_KERNEL_STACK_PADDING 0 +# endif #endif /*