From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 096E0C636CB for ; Mon, 19 Jul 2021 07:13:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E843C61029 for ; Mon, 19 Jul 2021 07:13:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234797AbhGSHQ1 (ORCPT ); Mon, 19 Jul 2021 03:16:27 -0400 Received: from mga04.intel.com ([192.55.52.120]:39757 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234789AbhGSHQ0 (ORCPT ); Mon, 19 Jul 2021 03:16:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10049"; a="209102776" X-IronPort-AV: E=Sophos;i="5.84,251,1620716400"; d="scan'208";a="209102776" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 00:13:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,251,1620716400"; d="scan'208";a="499789742" Received: from michael-optiplex-9020.sh.intel.com (HELO localhost) ([10.239.159.182]) by FMSMGA003.fm.intel.com with ESMTP; 19 Jul 2021 00:13:16 -0700 Date: Mon, 19 Jul 2021 15:27:08 +0800 From: Yang Weijiang To: Jim Mattson Cc: Yang Weijiang , pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com, wei.w.wang@intel.com, like.xu.linux@gmail.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Like Xu Subject: Re: [PATCH v6 04/12] KVM: vmx/pmu: Emulate MSR_ARCH_LBR_DEPTH for guest Arch LBR Message-ID: <20210719072708.GA23208@intel.com> References: <1626425406-18582-1-git-send-email-weijiang.yang@intel.com> <1626425406-18582-5-git-send-email-weijiang.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 16, 2021 at 04:33:36PM -0700, Jim Mattson wrote: > On Fri, Jul 16, 2021 at 1:36 AM Yang Weijiang wrote: > > > > From: Like Xu > > > > The number of Arch LBR entries available is determined by the value > > in host MSR_ARCH_LBR_DEPTH.DEPTH. The supported LBR depth values are > > enumerated in CPUID.(EAX=01CH, ECX=0):EAX[7:0]. For each bit "n" set > > in this field, the MSR_ARCH_LBR_DEPTH.DEPTH value of "8*(n+1)" is > > supported. > > > > On a guest write to MSR_ARCH_LBR_DEPTH, all LBR entries are reset to 0. > > KVM writes guest requested value to the native ARCH_LBR_DEPTH MSR > > (this is safe because the two values will be the same) when the Arch LBR > > records MSRs are pass-through to the guest. > > > > Signed-off-by: Like Xu > > Signed-off-by: Yang Weijiang > > It might be worth noting that KVM_SET_MSRS cannot be used to emulate a > wrmsr instruction in the guest, but maybe that's already implicit. > > Reviewed-by: Jim Mattson Thanks Jim. Yes, guest wrmsr read/write emulation shares none-host initiated path.