Message ID | 20230327075838.5403-23-xin3.li@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1352912vqo; Mon, 27 Mar 2023 01:27:34 -0700 (PDT) X-Google-Smtp-Source: AKy350by9m29DtXbYMc7vDeuM6U6xuft/fE2MHWJexWU8IxTcQ0Iedtg+gtDIU+5VrDXgb02KvSL X-Received: by 2002:a17:907:9626:b0:8a9:e031:c4ae with SMTP id gb38-20020a170907962600b008a9e031c4aemr14000588ejc.2.1679905653853; Mon, 27 Mar 2023 01:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679905653; cv=none; d=google.com; s=arc-20160816; b=FIqRv2n17MCGMk5MxgCuTaskVwP+mWc3kKGgiQhUHwUdGPc+ljQ5rRicERtRGSvdwW aDbLwLlFvkgH+d59flw2oR2P1x0HfJ3kv9J+JeVkR/1/LEZvYGoWMV20YXylY2bAau06 oxJShPHr0ff+zwKtdk+T3UTt+ijPVsl0FYEeSKZ6Qot8wCkSss00TS1pQpqKSVNldTbk IQ6HBRSXvFpIvw3DvbBjCHgTr0PyTlMLhfvF6Vjcp8VAEB8sF9VYXJ02lTQBP1z5n/QT mVr3Z7F2V+2UF8Gtkv5PPeB0KtwTb1qGWQinAkOX5urG4vMflAwUEkPJF4QOyUoP1mzb LxhQ== 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=o/s4OgoBvlYE/i/ueeuD809hBfxz0iI2J7KU1Tu8hr0=; b=Ool6u7C42MhchPvr819R7TbWs/e3O6GlIF8ddTZZoJKRi/YztPwgy0c/14NBBl/WtQ PPJuuIVhuQBsh4g68PK99p9aDgdekXMd/FDecVRnP6Dy91AZGCM+tP5xS4F5K2obOGy/ 3lEsw3T1QEhXhz3HkilOhYUR6GhfmWcHBn0spM+Fnus6lBQ8u7izWkwIxV9nenvuNN4m Gn6juA69zrlU72/2bP5jbYyGrwwCiBLoChPxTiDqZdqWQ5SPEbdC6IP+KimnumjneEw9 7LVirKklXJy6ppUb/SurLunbVE76sqFEWiTrVORLoAk1dhTQcqFoQxQmQxgUdHxZbdCZ qghw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fvgsSzQg; 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 s16-20020a170906061000b008b593e8957esi25160569ejb.884.2023.03.27.01.27.10; Mon, 27 Mar 2023 01:27:33 -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=@intel.com header.s=Intel header.b=fvgsSzQg; 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 S233316AbjC0I0F (ORCPT <rfc822;makky5685@gmail.com> + 99 others); Mon, 27 Mar 2023 04:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbjC0IYz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Mar 2023 04:24:55 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 317E2559F; Mon, 27 Mar 2023 01:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679905479; x=1711441479; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SfNRJW38HST/J2vYBy+d2Rz7YNwfS+VaJzsap6qMLmE=; b=fvgsSzQg2y5+8N4JOrf6ltJVVeIToOnneOUJoxpYYCCUW5KZkhkG9Ocb K7ehhSjB6sbKJqxXc3ZicSKnM4AL9q4QJzgnXMN/DKGZFJULH14eaJqA7 cBDoxuxTgizgE0ywkJJXIMj5494rMjDnshr/E5x14nMgIgeKCMCkQeT1z Y+JZtpPfzNO1v5zYCjHw5SpUrBb3lEHSXWRha0+VEZnqpiRsXGV6/xp8F nECDULAFymj8ZqOn/GW9UXGZNZuwIY1c8UMf5DBX3y3kYH6dMOgIzw6aG vjlzfmtWk4PXfjh3k6lm4VEWzgbc9eU9H2D728oJQ8xjnwr0buOOEO906 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10661"; a="338930315" X-IronPort-AV: E=Sophos;i="5.98,294,1673942400"; d="scan'208";a="338930315" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 01:24:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10661"; a="713787115" X-IronPort-AV: E=Sophos;i="5.98,294,1673942400"; d="scan'208";a="713787115" Received: from unknown (HELO fred..) ([172.25.112.68]) by orsmga008.jf.intel.com with ESMTP; 27 Mar 2023 01:24:37 -0700 From: Xin Li <xin3.li@intel.com> 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, jiangshanlai@gmail.com, shan.kang@intel.com Subject: [PATCH v6 22/33] x86/fred: update MSR_IA32_FRED_RSP0 during task switch Date: Mon, 27 Mar 2023 00:58:27 -0700 Message-Id: <20230327075838.5403-23-xin3.li@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230327075838.5403-1-xin3.li@intel.com> References: <20230327075838.5403-1-xin3.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761508750812979391?= X-GMAIL-MSGID: =?utf-8?q?1761508750812979391?= |
Series |
x86: enable FRED for x86-64
|
|
Commit Message
Li, Xin3
March 27, 2023, 7:58 a.m. UTC
From: "H. Peter Anvin (Intel)" <hpa@zytor.com> MSR_IA32_FRED_RSP0 is used during ring 3 event delivery, and needs to be updated to point to the top of next task stack during task switch. Update MSR_IA32_FRED_RSP0 with WRMSR instruction for now, and will use WRMSRNS/WRMSRLIST for performance once it gets upstreamed. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com> Tested-by: Shan Kang <shan.kang@intel.com> Signed-off-by: Xin Li <xin3.li@intel.com> --- arch/x86/include/asm/switch_to.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h index 5c91305d09d2..00fd85abc1d2 100644 --- a/arch/x86/include/asm/switch_to.h +++ b/arch/x86/include/asm/switch_to.h @@ -68,9 +68,16 @@ static inline void update_task_stack(struct task_struct *task) #ifdef CONFIG_X86_32 this_cpu_write(cpu_tss_rw.x86_tss.sp1, task->thread.sp0); #else - /* Xen PV enters the kernel on the thread stack. */ - if (cpu_feature_enabled(X86_FEATURE_XENPV)) + if (cpu_feature_enabled(X86_FEATURE_FRED)) { + /* + * Will use WRMSRNS/WRMSRLIST for performance once it's upstreamed. + */ + wrmsrl(MSR_IA32_FRED_RSP0, + task_top_of_stack(task) + TOP_OF_KERNEL_STACK_PADDING); + } else if (cpu_feature_enabled(X86_FEATURE_XENPV)) { + /* Xen PV enters the kernel on the thread stack. */ load_sp0(task_top_of_stack(task)); + } #endif }