Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2260997pxm; Fri, 4 Mar 2022 12:33:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+TFBhWFMjgAZAB/qARtSRwxsVvwQA5qD/joo238tnXKHEe1IxB/Rc3k3H7qpR+APCfX73 X-Received: by 2002:a05:6a00:8d3:b0:4f6:76a1:4890 with SMTP id s19-20020a056a0008d300b004f676a14890mr264429pfu.55.1646426025671; Fri, 04 Mar 2022 12:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646426025; cv=none; d=google.com; s=arc-20160816; b=t1saz5abk1W1wxd/1LNuu48uMj0wXtppH0eRqFlI+PPybkQHOilT1HZy5Ze6NaCqCV 6tBfBi62ByRyQtDnE/V6WfK1h5JfyvGRBSUKV5nYuRCbpbZgPpPlAclffBOrE7DrKNYo rCiEyvSyU08ovYt2R3kGp1FcgU60EnuqV4XDaTZj6VdezSq/Ng0CiQ+3CMcDwNBMNc/G dOLxSafoc6ZaUr+Lr92o89kNIN8RtaITlLqufJAqub1GD503SxuZfLhueDsC7DESG3p2 1Z8kbFYkfqYVeOZxAePTSWlqU6XcEvNXehiBavwjPkUcw5fj95NFZs6gCEMWmqkHoISH EuSA== 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=d/YRTSW90a4KLUhI+cHQOdHmcR2yzLFocqFioBP4kEo=; b=inH8bb2KNWaDp7ss+wEi8eKsoOxYZCet8Ck+iGKnvrePmr8lgUl0HD+xspXDVDiA7a 1SnfSFufRtR4clKUUDOeffaUAQTCq+IFZ+EjzLig4CanFobHKwShS9Or5rIoBVr0DbrN xh8V+eThZHORIdLDNqVrVEqv66MKc2g10XaQC10N8QzsiYttUFKpsKv8bYLCTakJa6hB ehNuyw24XkqCIfDDhQzcyHaCYXnFELxcO89Rd4VdZrVV3XrTz4etobyZxgqtNfWE8dCa I4M6FSag+OVKvkV4C1pd1PlpIE53Z27yJD6gvpbQ0fFWp6W0+fwPRTNvri03DPn/IiPD VPGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Xm8Ma1Ol; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056a00181200b004bace2132c2si5663046pfa.364.2022.03.04.12.33.29; Fri, 04 Mar 2022 12:33:45 -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=Xm8Ma1Ol; 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 S230350AbiCDUdl (ORCPT + 99 others); Fri, 4 Mar 2022 15:33:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbiCDUcV (ORCPT ); Fri, 4 Mar 2022 15:32:21 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B21E1E745C; Fri, 4 Mar 2022 12:31:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646425892; x=1677961892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=67RfWa608+UmKAYRSQ9bH1wt2NE7G+2gkMQMrYXcuuM=; b=Xm8Ma1OlDXh56FgUQ5Ihm6Ln00omW4Dn6rSHmjrqWZq1GJ36CgZLY/ip dT03RR3Ukt1fqRgVO7SlOVTXUkwr9Nuatc5RZ20zkugN7PBLdddvc1Pl+ EoPlUIROb1IsKm7lELWKhiUDwpH9ycRWiz9UWVGgOFO3PbRVety7z+fle ptt1NWhO4B8ypbKYLhewHz0HZ+ogjSraNddCsN0Xf2IptYrpwy5aI6M/1 0/g1QJnOTOOi3BotGuwRSiKyKTjn3wef8JRgsyPeploqZSfW/ZNVvRbrT iWr8ire2ZdcZqG9JoEEDY2UwWkQnX816dd1nutmNDEkSTaINbVPNwn9G7 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10276"; a="251624272" X-IronPort-AV: E=Sophos;i="5.90,156,1643702400"; d="scan'208";a="251624272" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2022 11:50:35 -0800 X-IronPort-AV: E=Sophos;i="5.90,156,1643702400"; d="scan'208";a="552344476" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2022 11:50:34 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson Subject: [RFC PATCH v5 071/104] KVM: TDX: restore debug store when TD exit Date: Fri, 4 Mar 2022 11:49:27 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 From: Isaku Yamahata Because debug store is clobbered, restore it on TD exit. Signed-off-by: Isaku Yamahata --- arch/x86/events/intel/ds.c | 1 + arch/x86/kvm/vmx/tdx.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 376cc3d66094..cdba4227ad3b 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2256,3 +2256,4 @@ void perf_restore_debug_store(void) wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds); } +EXPORT_SYMBOL_GPL(perf_restore_debug_store); diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index 3cb2fbd1c12c..37cf7d43435d 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -620,6 +620,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) tdx_vcpu_enter_exit(vcpu, tdx); tdx_user_return_update_cache(); + perf_restore_debug_store(); tdx_restore_host_xsave_state(vcpu); tdx->host_state_need_restore = true; -- 2.25.1