Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1132809pxb; Thu, 4 Mar 2021 04:17:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyk01EiEIhtv2f0mAQxK2KCArGhw10OpRZ0OpL32JTMC+llTCUwMqipRjskSqwFmJPPw3jf X-Received: by 2002:a17:906:25c4:: with SMTP id n4mr3918212ejb.359.1614860274924; Thu, 04 Mar 2021 04:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614860274; cv=none; d=google.com; s=arc-20160816; b=eQZCSf18CcETsV53zqKYM/UJxSVDNKstaATiXhmwt1zqNVNnZkrGBjFbtgUG/2V6Lk 02jmMJaOPIyi6L6P3yxdHaSQSawHC26Vte3LHKsednxYB8g/hGGiXI0XmWr6+nQEvHIa wzKnmFINyOcyqijNMcdbw9vfbKzX2iGby4g2d5evTBedyeBXZUVHp6Owjg3z4pYbWnDQ Xkc539EmzCukYKfv7yh0DmdFhUGFxdMvMVBkEzsDfd2zp3OKemqUHlpy3D3UMhvbN0IP Td2xu+ZRp6tyC8wtfrw6vLQy/Zt5XQwZoY4MD6eJKNjw+f03krI2HQMClmZVKuiU6oYE /hKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EK8LKNqmhy5x5LGHLejHKmLyx1MsPWviMZPTqKPSEvc=; b=Z2m6sTuNjQNSMvC2P6EoFmrecKvVvNRTsV6HcrZHm5PK/XGKbAcQy1qM503o7um3P0 3JDyRgSf+8WNotFfKwtNuRLVh7Xzr1+/flvZmMQAj6U3H0TlGU3PaMdyVrVYmeu0Ctt/ nOkH7Ts6GqfiAmmh5cgpF8YWu2ELxHxHFBVum6omoDn8Ij3rGhMb0UnoySwnEQBFQ8/y wpGDRBXa9FpynLLdNPDGlHJXzmS2wlalpQuWc/N+gq7RdPbRF0ReCAToE3u+DoWAy+Ot W11GDKwDy0+j+ecAQ2nMwVE7ALSWWwQIbxHHRxPdyM/mgYYOnZsupr+rBYre0uDwfBee dTQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="JAljs/qn"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb4si16399863ejb.642.2021.03.04.04.17.32; Thu, 04 Mar 2021 04:17:54 -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; dkim=pass header.i=@google.com header.s=20161025 header.b="JAljs/qn"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386725AbhCCSqG (ORCPT + 99 others); Wed, 3 Mar 2021 13:46:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236768AbhCCR1W (ORCPT ); Wed, 3 Mar 2021 12:27:22 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E7EBC061763 for ; Wed, 3 Mar 2021 09:26:13 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id e9so4774863pjj.0 for ; Wed, 03 Mar 2021 09:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EK8LKNqmhy5x5LGHLejHKmLyx1MsPWviMZPTqKPSEvc=; b=JAljs/qnOK5jykvYwB6CxVcKXYmcriiOHnXg+2p/0p+pr1G9jTezxPcXNnfUkuF0u6 K/gVGL85aHy4UOB9QVbFAJgBq9wGhyEJjMXDjn1Df1LlYWauOVLOuKG6nuERLGdqtrv2 2VBT4jEcYz4L1TaZTN0gkWkq9IXNMUX83aTipLspLO2xUxVy6SdyO2uxyzAIpx1W+Gjy hmoD8h3c8uNaGjUMGQPyqOxkravbrA43rCMhX8jabm4CDuqT6Pxa3Y2c9CEAONqGI8fz A0hibh7eoiujKp4rxdjoJ61sXj9OfgRvu0qgsZe2FwMJSkSBDC4DyZAVPen/txEjeohY FE8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EK8LKNqmhy5x5LGHLejHKmLyx1MsPWviMZPTqKPSEvc=; b=j9j/ztbBS6+mhjNYeou5EfMzHUK/+L+GcblcaqQzntfTQKPoFvuKCapg0I3E0Rv4jE +bcq3ljfoy8awArUw7WjvtCwtKo3CiFYTI5Qa7pVM//Bufg5RW6G0Lc4wlxa10Wz8Wdt wuBNvLcF9zmOokiZd+UCr1exsMYlcUaFFijNdOOfBZp6K3V8/PFzsLOXPTxRf+njOjb+ rQY7ot0CQKKTuDjBJse+UD6UVVSrdsIr3VAySAZXtwIVeh4ZvV1InPN3YOLlZAXaiQLg vptTf7js/BLt2CpaiIcjxH3z20npEnHDHvhMQ7wcMuOZQ//UNNgLbvXUTjp/CLV/DN5N HinQ== X-Gm-Message-State: AOAM531+OsRa6OWyTmNrO5H37ksaBjSqkxWXWo1YqcTSqRwK2tO2+lN5 /7sG9JO2iQjRLNRtA7+hcrzswg== X-Received: by 2002:a17:902:f68c:b029:e5:ca30:8657 with SMTP id l12-20020a170902f68cb02900e5ca308657mr251635plg.78.1614792372514; Wed, 03 Mar 2021 09:26:12 -0800 (PST) Received: from google.com ([2620:15c:f:10:805d:6324:3372:6183]) by smtp.gmail.com with ESMTPSA id v26sm24500719pff.195.2021.03.03.09.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 09:26:11 -0800 (PST) Date: Wed, 3 Mar 2021 09:26:05 -0800 From: Sean Christopherson To: Like Xu 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 Subject: Re: [PATCH v3 7/9] KVM: vmx/pmu: Add Arch LBR emulation and its VMCS field Message-ID: References: <20210303135756.1546253-1-like.xu@linux.intel.com> <20210303135756.1546253-8-like.xu@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210303135756.1546253-8-like.xu@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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 >