Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp989134pxb; Fri, 15 Apr 2022 17:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMliDRgekvkcFG6NnSm16ufVNZV0kpaGWC72y4PJr8mIvpFMbvX0rdvi7+ufyYvOSbQjnp X-Received: by 2002:a17:903:22d0:b0:158:9d42:6af6 with SMTP id y16-20020a17090322d000b001589d426af6mr1188272plg.159.1650069238589; Fri, 15 Apr 2022 17:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650069238; cv=none; d=google.com; s=arc-20160816; b=hPQI5Au2m24rjns+Nrep7Uc3EUxhEZQSMG8HgTx0U2/5Fq0X/pAPcl5IHgExRau5Cb Xwfil0DTzZo0VGzMBu9hH2hfOIGkemxP9q6E4x2qPP4I8WhNVP+vkMgTppS4JDUQ8MDD uZuftyCPOTCDDHAE1Dbqa/w+qrwWBVn8cvAf86NKj4ldeHJ6KIULiFUv80oznHNUTrTN ivcYprKZ4rb2oCLQCUCbB4N9Xd3c9OqILtCuLcOKKi07PBd+iRUUW4s1mSQGoCABbzIF J1kVy2itnwN2/undyioNZNQhvsnc2g4W55PIpLMe8OagXNDNVeJcHgmukb/EnQUElJFz MGPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=08pfEuyLiFmPHxey+T5VgpFceM9bwO2n4GmdqLEQlVc=; b=csUgqZeVI0cCK1M88rHvOv7BLP0WvWKN6UuHzoozA+waK57DM/tc9UbP+4sHg02ip6 P3FfUD+EKS0MFupe5Htb1qpWypiaFu2Sg4UAuXi0vimPmxoBVnXdxc1/o0Kffs84EWwx puhsqFbj+xVwvxSL1qkb0TUj3PrITzSP4HewhwqC68IKRYEL0tTaQTygXPAU/QcOujuw UowbPMKUuIW/MnlGE/10fx7SswWNqvxvNYxwHk3KtMYRw+5qtxHzq0xy/wkmsVrHXxuo zG3zzHdiQevuSwy2NaEAvBFOY2Nmlg+StTdWqHjzqiLKkNCy4k9wly7izx4894ku7Ta6 xQBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GB9aMwZ3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lk18-20020a17090b33d200b001ca9b2f1131si6043037pjb.141.2022.04.15.17.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:33:58 -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=@gmail.com header.s=20210112 header.b=GB9aMwZ3; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5856DF55C0; Fri, 15 Apr 2022 17:30:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354425AbiDOOYw (ORCPT + 99 others); Fri, 15 Apr 2022 10:24:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354478AbiDOOYL (ORCPT ); Fri, 15 Apr 2022 10:24:11 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 946DC69486; Fri, 15 Apr 2022 07:21:33 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id bh17so15604390ejb.8; Fri, 15 Apr 2022 07:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=08pfEuyLiFmPHxey+T5VgpFceM9bwO2n4GmdqLEQlVc=; b=GB9aMwZ3gJcqu2BKR+IN+hR48poSHukDJxGnGzokdAQ+Lndz7ZjWILiFS1UAkXW89+ b6hROebMXuZrFMahuTLeIOJ8t7LAvpzCNRchpEhd5fwfJsRHaauwnmsmooEMWWXZ++yL 3lAHUOOo2gtYAmrvz2d3EWp2TbU/MmHdUlOdK3m6mO+Ey4GUGiF6z54UB7n67Tnoqs5/ wrwsfIHaKVqEziJRb3yKliqUcruYNIO6OKcOyA3Pf09hTTt85XGIL8Qajo8l5nAkZ8+q SJuzDIl26VID/DK+VnlJ5RJP7FYSTMuvjN/FjEENDnxT7MceQMtbQgjAW22wLQZ8xFfT 2RDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=08pfEuyLiFmPHxey+T5VgpFceM9bwO2n4GmdqLEQlVc=; b=SfVaBaVWMmMVwOlR3DtHBDSaPhgodI6fP1nYHZddVe0X1OS05Nu8oJSs0LrCapvoUw rzJpKTkdMir2TvBRFsJN75wbN55W2gqccvdtV99gkgSNRRLKBnYjrWPGIpMNFSg+Cuqm 7ck9/kbY/EWRZDoQKwD9gaYUG7J5xjTv6+dWbcOVjtn9bxHKyv7QMbTjG6R7d/qTsq+m PpVnJwrBJtQFMjO5UE+vhVyD6AkYQQW6BfApbguhw6mfXxXb+B1KiTJwqv5hLxaaDJ7p 9hpjgzRa0wbNEx16AVQEkFgAoDrYnC101SSYDtFi2a/dl5ynMAQKdLxyEHjbPp+qGF4v KIog== X-Gm-Message-State: AOAM532z6NvRS4ipUorPtoQ9UdeFFbXh9U1YZM9qnbqigdTNbSlEIQDB P37A3QO9acMihzOXGZcNYqM= X-Received: by 2002:a17:906:7746:b0:6ce:a12e:489f with SMTP id o6-20020a170906774600b006cea12e489fmr6298375ejn.551.1650032492096; Fri, 15 Apr 2022 07:21:32 -0700 (PDT) Received: from ?IPV6:2001:b07:add:ec09:c399:bc87:7b6c:fb2a? ([2001:b07:add:ec09:c399:bc87:7b6c:fb2a]) by smtp.googlemail.com with ESMTPSA id er15-20020a056402448f00b0042110981d13sm2380526edb.48.2022.04.15.07.21.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Apr 2022 07:21:31 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5fd8d6dd-07be-9bf1-1ad9-5536c4e40182@redhat.com> Date: Fri, 15 Apr 2022 16:20:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v5 071/104] KVM: TDX: restore debug store when TD exit Content-Language: en-US To: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson References: From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 On 3/4/22 20:49, isaku.yamahata@intel.com wrote: > 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; > Reviewed-by: Paolo Bonzini