Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4681349iob; Sun, 8 May 2022 21:48:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCMcu+/H+fPA2wdGayX06AOZpGjt3j7k8L/ZCOIjDDrY5nn+xvifaExBMJ+DUMhnSc8aTz X-Received: by 2002:a17:90b:4a90:b0:1dc:4122:6a70 with SMTP id lp16-20020a17090b4a9000b001dc41226a70mr16051143pjb.216.1652071716797; Sun, 08 May 2022 21:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652071716; cv=none; d=google.com; s=arc-20160816; b=Tu9IagGM0Dx6dEXh273nm8v7SKh7c2wiwCKh0H9bxUIumSZSBsk3GuKRxpsmQ6XTfE I8TfnqG3YCaGv+8NL7IYow2WN7GNEAkSgO3WPgRkARZFmGEWBC91eGrQAaNA/UBl0SVK MgGp48sI7NKdNdqro0dOo4DYNGyFVRcFZBarqQIK3Wy6y6JssWe9RLhvMKnV6reI9QBv yIi5RdhlmUyfGaiF9CraD8Dl8Xu1Tyshj/QZ6zHMBCzDBgYc68gzMDD0xnTynRdfYlol uomdJro+jAQ3MLF4sLjIyzRvlQJQ9NNegXUlq8Uhu19gx4n9ZwMSXPOXJjgZkZbLSAzA wwiA== 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=E1/Qx1jOweMZEWc1c4D62g9fQE+sV5OC1NY+Or5oRJM=; b=ox1IgyKSGB39EKTD7ueVvKf2cDVLvhlRk2oz2zVjnk/UcKe7HoWdv45sogYK1x6vkh G6xNYz41S2JjoIHTLv7Q4Ofq1w0RAfUOyvttnJ9TscH1DmotgW8Mur3Wnl6lBZUiefhH EgeZJPMlOG3LBbDW5fORavCia1txdIjOBvbrCv9lqde4stFgnUV7AcKThLqbHqHcsw3N xKyt1hKMSG2xz21Csh2iSlQOcMdTFfGJ2OUhG6idu4m9EThDablMro64hglIUhHActe0 sOOnDHigRqVBsxNVUzzvd4H8Z3X7pYTfNVBUDxd8aa73C5fT0UMQN7e+AMgoivnXBaOM oRXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kU5folv0; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l15-20020a17090a3f0f00b001d0aa8594besi12812110pjc.25.2022.05.08.21.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:48:36 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kU5folv0; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE89DA147C; Sun, 8 May 2022 21:47:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384114AbiEES1r (ORCPT + 99 others); Thu, 5 May 2022 14:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383190AbiEESTl (ORCPT ); Thu, 5 May 2022 14:19:41 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66CFD38D90; Thu, 5 May 2022 11:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651774552; x=1683310552; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EmTD5xuasLG79hjIVjNHG4j5atRZDi3WJaBWf+tyl5w=; b=kU5folv09sq5Rg6oQyGO00gzff1B57Su4EMVKXAv1x2eGeS/CfYBxkxY H6BGwXFH8r48iZS/7sxiPeAgR8slCnEA/D1CuaEIcqop1sngnbVgu5tZv hFI3qXY6PrH41iLAI7dk5risaJ4eNaKUirlOm3Gk8JE63BFpFo9lB9Uhp xhZdOnSXtx55OGVsAYNbR96VTjwzNXiRAtBwmEZG9znuoh+Z7sgy0h/TM vfS4ss7Ub8A7zog6HjT+2vRBYLXFHQivIdg3fYkoAN+sueM9N96gG1J/x NEC4oovNcRyNGpR/hLYU34FSMu+lQI/c45C7qHLtJ8LFnB8SefFAK8pLY g==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="248113901" X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="248113901" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:51 -0700 X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="665083399" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:51 -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 Subject: [RFC PATCH v6 072/104] KVM: TDX: restore debug store when TD exit Date: Thu, 5 May 2022 11:15:06 -0700 Message-Id: <171422f20eedf32e1099ea52d6102f5571f80850.1651774250.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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: 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 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 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 7af7c84f8891..f92941586b42 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -661,6 +661,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