Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1229560pxb; Thu, 4 Mar 2021 06:38:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6L1Mh0EevNxdp2wZJFXNmnpxrHTrxKYK476WDiIcwZh/VMdXG//pgGrRG43wbWeNcUIef X-Received: by 2002:a17:906:a3d1:: with SMTP id ca17mr4612563ejb.92.1614868700031; Thu, 04 Mar 2021 06:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614868700; cv=none; d=google.com; s=arc-20160816; b=QmW6KxBThgR/hMdeWDJPZwWpJiNi3rP+/rUIxIB1itUsZYeZn1eW8VuZOjDSmy2zvw qTGkZWn9I+d8Mah3jZWS/Bcurpoz2erdJc6vFEoBP0ygpW8KzXtN3jCW8RY8e1R0Joub kO2yEZB156Ha1SZBs+3ZCR9W1lqr43u1wc/f0J2YS7rODx7CFBTeZK7LXa+dcDOYMSyE kzanoZfTEpluG0YxuuexNOh0GFrOkFwRjlzY57gmyn5b0QS5NyghZMhgrHtsPLqzCTd8 7D3GY78W8uC0aPCaHkfdGURzSDbEgxMcnq8vKn/7p0aM0xDYezqp5m8mBHH7/u0CHHVS UsGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=F1vV2XjLxmdenv4YhC9PDFWIvQKCXPh2o6egVOIeD80=; b=AhD+5AARdB3ZA+/JsYny+HL4RMlx/WjgtmX6yGLiTAv/hQfphGjvYSfjDYOItxD1LA gpqV0nGKzzhAO9pMmFnjQ+tRmZh00vMLAR2Tsr8oRQ2Jf8zqIj4Lce60vgjRY0fpQMJI q92Mvt+uLBcDSfOvHTOcgDzZSu6Mbzwy9l75+J/mvZRj5S0Uvd35qCeLkdezQYU0VQu3 bJHdLKuBvZ+QJYiBebhHs8lF0MsoNjv3gNy35sgEw8eYh444neh2hAapjilLLzTDC3Q2 mXSeugMhPQr/EVgCks4bVpnXUpfhnYK5Eifbuf6XVWxZiz06GaVpErvbMjORqmbn2EbK RF5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si18085987edk.452.2021.03.04.06.37.56; Thu, 04 Mar 2021 06:38:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232128AbhCDDDZ (ORCPT + 99 others); Wed, 3 Mar 2021 22:03:25 -0500 Received: from mga14.intel.com ([192.55.52.115]:17919 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232102AbhCDDDK (ORCPT ); Wed, 3 Mar 2021 22:03:10 -0500 IronPort-SDR: dvQBDC9pkS5tMZJA4Ns29E66bzQIqGTGF42ixSx5E2eQgyKPGzbYsUaB8xmk2PLKi1Mz+JauIw 8VMYfn6y1K1A== X-IronPort-AV: E=McAfee;i="6000,8403,9912"; a="186674934" X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="186674934" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 19:02:29 -0800 IronPort-SDR: Cfmd6zW4Klj1dIlCxFCLxjPUOXywJAhceDtM7lI6c6/ciDnBy44aUlHYVa4arFRrwaMmoD83Oe XLDjK2QQix+g== X-IronPort-AV: E=Sophos;i="5.81,221,1610438400"; d="scan'208";a="400284153" Received: from likexu-mobl1.ccr.corp.intel.com (HELO [10.238.4.93]) ([10.238.4.93]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2021 19:02:25 -0800 Subject: Re: [PATCH v3 7/9] KVM: vmx/pmu: Add Arch LBR emulation and its VMCS field To: Sean Christopherson Cc: Peter Zijlstra , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Kan Liang , Dave Hansen , wei.w.wang@intel.com, Borislav Petkov , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Like Xu References: <20210303135756.1546253-1-like.xu@linux.intel.com> <20210303135756.1546253-8-like.xu@linux.intel.com> From: "Xu, Like" Message-ID: <267c408c-6999-649b-d733-8d64f9cf0594@intel.com> Date: Thu, 4 Mar 2021 11:02:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/4 1:26, Sean Christopherson wrote: > On Wed, Mar 03, 2021, Like Xu wrote: >> New VMX controls bits for Arch LBR are added. When bit 21 in vmentry_ctrl >> is set, VM entry will write the value from the "Guest IA32_LBR_CTL" guest >> state field to IA32_LBR_CTL. When bit 26 in vmexit_ctrl is set, VM exit >> will clear IA32_LBR_CTL after the value has been saved to the "Guest >> IA32_LBR_CTL" guest state field. > ... > >> @@ -2529,7 +2532,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, >> VM_EXIT_LOAD_IA32_EFER | >> VM_EXIT_CLEAR_BNDCFGS | >> VM_EXIT_PT_CONCEAL_PIP | >> - VM_EXIT_CLEAR_IA32_RTIT_CTL; >> + VM_EXIT_CLEAR_IA32_RTIT_CTL | >> + VM_EXIT_CLEAR_IA32_LBR_CTL; > So, how does MSR_ARCH_LBR_CTL get restored on the host? What if the host wants > to keep _its_ LBR recording active while the guest is running? Thank you! I will add "host_lbrctlmsr" field to "struct vcpu_vmx" and repeat the update/get_debugctlmsr() stuff. >> if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS, >> &_vmexit_control) < 0) >> return -EIO; >> @@ -2553,7 +2557,8 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, >> VM_ENTRY_LOAD_IA32_EFER | >> VM_ENTRY_LOAD_BNDCFGS | >> VM_ENTRY_PT_CONCEAL_PIP | >> - VM_ENTRY_LOAD_IA32_RTIT_CTL; >> + VM_ENTRY_LOAD_IA32_RTIT_CTL | >> + VM_ENTRY_LOAD_IA32_LBR_CTL; >> if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS, >> &_vmentry_control) < 0) >> return -EIO; >> -- >> 2.29.2 >>