Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp127086imj; Thu, 14 Feb 2019 16:54:18 -0800 (PST) X-Google-Smtp-Source: AHgI3IYGl1CadARhgyDEWFZGmVcb/Qkkzoiepv/yyGYA5s2meBKlXrP1mJWiHYeIgQjafC75/pWT X-Received: by 2002:a63:6ac5:: with SMTP id f188mr2715682pgc.165.1550192058085; Thu, 14 Feb 2019 16:54:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550192058; cv=none; d=google.com; s=arc-20160816; b=Gag+7vJhJ0JoSSPNROJQd7haXUXJmp+c47ktbRrrMKt0JTyZD9e+JSpZJtdKRpLEiz 79GIlUejO1G9VVgdTWkKudVuSEczFdiBGUbFHpC0r0YmD7Q8Jok8yEJkrdkV23tTRULa mJ/USzpHCzE2gIJRio8XTDUs58a8XDZEcRg5LNLWmHfSTEFXDZejNAbEsc+ttMMHKLm5 MqiRRp85BFfV5AyytFl3qcOgHPDOilwHevatPjowNOMNCzN6XDiVr0BTQ/8Iig/RGV2d DFWfSWw5yXDESeeWHoX8+DjTh2QOy1JugENeddHaVP0LfoVeurwScePOqeCJSrl0Vaf+ qZNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4OXWB0NFlXy+18FxDQJRtQR81eDV0jcdI7jXd4lEoqM=; b=oqCmaoekDKb7XTZo1nh4L8yvFF+sbognCIMin3PNdINwMlRkOyPm/77z1m8TQyTXDa F051pHgsQaOuI8TLlSRrkRegmAs9bS3IuMIRAid3ofCVzSfjEllSq1VdeA89b1d34BwS zIvlTCLEmVfLCaKXrNDC5LCseCaOQWckxNV0lQ8WSXmOriYUIts49vqnVAK8ncW2yERv +eFcy/941LBafk7C3aIaBP4HPo79/S+1zAoppwCs9MQIbTlU40rqoEuKSJYgBCbG4oSr rbbZKSDKoVR/cmSYhvjwl39N5SwzJDkgrB75BHuoe1COapr7H0N14pkIrroOVt4f9NQU CRhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id r7si3794716pfb.237.2019.02.14.16.54.02; Thu, 14 Feb 2019 16:54:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2407944AbfBNQbt (ORCPT + 99 others); Thu, 14 Feb 2019 11:31:49 -0500 Received: from mga01.intel.com ([192.55.52.88]:27965 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfBNQbs (ORCPT ); Thu, 14 Feb 2019 11:31:48 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 08:31:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,369,1544515200"; d="scan'208";a="116227432" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by orsmga006.jf.intel.com with ESMTP; 14 Feb 2019 08:31:48 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id 0386D301247; Thu, 14 Feb 2019 08:31:47 -0800 (PST) Date: Thu, 14 Feb 2019 08:31:47 -0800 From: Andi Kleen To: Wei Wang Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, peterz@infradead.org, kan.liang@intel.com, mingo@redhat.com, rkrcmar@redhat.com, like.xu@intel.com, jannh@google.com, arei.gonglei@huawei.com, jmattson@google.com Subject: Re: [PATCH v5 12/12] KVM/VMX/vPMU: support to report GLOBAL_STATUS_LBRS_FROZEN Message-ID: <20190214163147.GL16922@tassilo.jf.intel.com> References: <1550135174-5423-1-git-send-email-wei.w.wang@intel.com> <1550135174-5423-13-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1550135174-5423-13-git-send-email-wei.w.wang@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static void intel_pmu_get_global_status(struct kvm_pmu *pmu, > + struct msr_data *msr_info) > +{ > + u64 guest_debugctl, freeze_lbr_bits = DEBUGCTLMSR_FREEZE_LBRS_ON_PMI | > + DEBUGCTLMSR_LBR; > + > + if (!pmu->global_status) { > + msr_info->data = 0; > + return; > + } > + > + msr_info->data = pmu->global_status; > + if (pmu->version >= 4) { > + guest_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); > + if ((guest_debugctl & freeze_lbr_bits) == freeze_lbr_bits) It should only check for the freeze bit, the freeze bit can be set even when LBRs are disabled. Also you seem to set the bit unconditionally? That doesn't seem right. It should only be set after an overflow. So the PMI injection needs to set it. -Andi