Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2615379rdg; Mon, 16 Oct 2023 09:27:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOPZUB4LMBms0WfYFDgSjuT9CjmUtZDc3sqD+MKsbuNtZATXXs0lZoHvm1uhZHw+JaMBGs X-Received: by 2002:a05:6830:1d81:b0:6bd:db8:db with SMTP id y1-20020a0568301d8100b006bd0db800dbmr33594007oti.32.1697473636578; Mon, 16 Oct 2023 09:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697473636; cv=none; d=google.com; s=arc-20160816; b=E8a4Hg5OVUNnL02yvXqGgpCuqurpd/calkWAn58zAbj0fLErxjFbomS8TZdryFlKXc 76L8tG4D3wYzQMHGXfNsbyjNiy7JPl5eA5NjNAKWTujB2ihGzLOgwQ2mdy4uI4EwZq4O 91xYjz93dxRv2AaCfxk+22SkjYJ1Hq/B5VvIcH5Qm2Qes+JJqkUdctJdtqv8497GVjLZ cVnn31I8YQCicFbLScKpnazMspHcmzIbZefci6eSeToWjWhVatWL4mpt9f188K3sDgRt t6Q5mPzlWUe30VRdZLpeCgj4dB+1Bsbj0rgi/VE5IICUNlR9H8HOe8jsPh/ltRYYMQwk Fxyw== 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=H4qn+5706rn58WrHflqYCb9QGpF9farYfDq8OtSjF50=; fh=lRdU2Q/1zx5DcPdZuWBjshA5VT5Oc9cEhB1tCFiV0Nw=; b=wDXmKJRO40wqeQbNvmBE1p4kqDkjPhUJtgnkRp3k5JclrLX5+ejAQxP9jjg63keaXw 1mX4EOVqvi/hZyv/SoKDMUDxjjI0shWmGi4GtO/XFCecMsr3zDgI52OfntjprZCknBkJ vgZOzuUNlm9ajlt0AXghWqLqgHycCySt94bwIf709OQJwd+K56MK8CTW5nKedggEAZK/ W66U1svjTvTv/qBpjchpf02gAKJQC7boOoFal0OJ4E62/zHdHaP/9QhtAGXJdbJaWd9F vkLQJs5xr9zN0Qnl0BJfBxoX0rEHV3K3jO0bGw8TtpdYWgTvcdxVHcHajuT073lwopNI WOGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jgM1t+op; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id by24-20020a056a02059800b005abfb781154si9004966pgb.97.2023.10.16.09.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jgM1t+op; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B405780212C7; Mon, 16 Oct 2023 09:27:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234056AbjJPQ1B (ORCPT + 99 others); Mon, 16 Oct 2023 12:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbjJPQ0f (ORCPT ); Mon, 16 Oct 2023 12:26:35 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0AE210D2; Mon, 16 Oct 2023 09:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697473083; x=1729009083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j8HguG2TjH29g/Wok0EsXBMyZ9vYrKe4chKD+R6EQ2c=; b=jgM1t+opxDX3JtTN5u5nfqvTlHTvm52fZtHWTDSbsDDlkLe+MXhWJBYM MYTOZO6gpT+vrmBdlWWi5qOV9r+QUnPvd8PwqO1XBihZKaFA79wN394Z0 /wmWuybP6yNzBI9C8zsn/JKnhiMBQAQakx7gsEP78Km17ilgYcc/rGBK2 VOdG4zdAGczky573L0cL+UJ8cBx7Whk5dVWZ2SJ1ZyElTxRruR+wtWV7I A5PrLZIYabVlA3Hpv8SlvCTXjSNNj9Phe8sk/zCsbywT70uglwmRAsvb3 OOGIQFEoZwyQ95M65EjUxPmVt79OwH5GJe4nuJId55Bk181c+kJvwHGiF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="364921903" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="364921903" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="846448215" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="846448215" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:53 -0700 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 , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v16 070/116] KVM: TDX: restore debug store when TD exit Date: Mon, 16 Oct 2023 09:14:22 -0700 Message-Id: <98ef065d15d4ab59e9b92932cb197b98f03bb8df.1697471314.git.isaku.yamahata@intel.com> 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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:27:12 -0700 (PDT) From: Isaku Yamahata Because debug store is clobbered, restore it on TD exit. Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- 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 eb8dd8b8a1e8..58e86b726436 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2428,3 +2428,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 e29df39630e8..a4401ae851d4 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -639,6 +639,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) tdx_vcpu_enter_exit(tdx); tdx_user_return_update_cache(vcpu); + perf_restore_debug_store(); tdx_restore_host_xsave_state(vcpu); tdx->host_state_need_restore = true; -- 2.25.1