Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2034249pxb; Mon, 22 Feb 2021 18:29:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+O3F2HPxY1d5bk1tTUQUpGqu2glf1+onBjrQqdqiaN0MOJTT71zxcwtRYp7OU8psINQLo X-Received: by 2002:a17:906:301b:: with SMTP id 27mr19539384ejz.230.1614047367629; Mon, 22 Feb 2021 18:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614047367; cv=none; d=google.com; s=arc-20160816; b=UwRZrJNvZt4FfxrusxknPvi+RiV/YDlm0jDnRYnWBQ6Unp6IyF2K15W2pD7IS90H2c WRKXmvTpGWIQZ5KpKry5SkjqQzNtEKME2rwZwRai59uteOEqVvBXhJFsD1QGEqIDm8gP rbLUF+kAI4hHUyCwn/6AEWfLMjb1Oj0FdzqdERoXeT7m9JG3bR7yFMw8BaR1NUb5FOMi y3ZeWF4BKIloCjhcqo02No806Naw67m8yN6K2WbQs6QzyFuVq6BzIgjA6o6Or6lkxb8e OmsV1beJVBeb69P7QLSuz6bHuV57gqofsNMi/MpeIfu2eOYV6cvRfQhDpvepnh4+C51a x2zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=JhZqzh0ZiM7AuV1bIpKc0dSJWEQS4N5aa8SIR3vTVI4=; b=y9ALGdomBKrVsb8XoSgJp9DkB9Hfd0665G/uzoze+eq/J+UEvqcyGSRP1pHIsXreHr Eveyp+6Rk9VHaRmayxODvggjeTP3+j91wqI9KR6IKaBOXOZSPrfLNIHXxdoVInGVE0d4 2HGqcBpdY0jjXHWBYpYVYb7OFVR56dgd0WKaoz4cYc0mbXJVEWToQDeX5w1b4nb4NiZm ZzrgOFDm1WTT8ov+FVVXsMmfP3Xig3AW1uCuj8Cq1lhUQO5ga9EozlNlJW/WV2WJsTXr PVdd+WbPGlNhOU47vR2y7/57pExzz6NQgv8Me+yZN5GhLGII/oii8dO1umzfECXCDyPS INFA== 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 t16si12743280ejj.217.2021.02.22.18.29.02; Mon, 22 Feb 2021 18:29:27 -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 S230315AbhBWBss (ORCPT + 99 others); Mon, 22 Feb 2021 20:48:48 -0500 Received: from mga01.intel.com ([192.55.52.88]:61186 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbhBWBss (ORCPT ); Mon, 22 Feb 2021 20:48:48 -0500 IronPort-SDR: 7FhznoiHTqU5i/ixzuUKyErezaQgRbIjVK3/13WowIu1j9V2K6gFQLjj4w11wXNaU6YCyDUOHQ yA1o0NOvamGQ== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="204074435" X-IronPort-AV: E=Sophos;i="5.81,198,1610438400"; d="scan'208";a="204074435" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2021 17:47:02 -0800 IronPort-SDR: TnqcXWgI8AzeQoutJT/a0nG3o/Kg5Ru5L7vxJfg/4eMqupzJMgW45FmjKX22B5H/C6J3AOQRzV Cj9N5heluTNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,198,1610438400"; d="scan'208";a="423349289" Received: from clx-ap-likexu.sh.intel.com ([10.239.48.108]) by fmsmga004.fm.intel.com with ESMTP; 22 Feb 2021 17:46:59 -0800 From: Like Xu To: Paolo Bonzini , Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] KVM: vmx/pmu: Fix dummy check if lbr_desc->event is created Date: Tue, 23 Feb 2021 09:39:57 +0800 Message-Id: <20210223013958.1280444-1-like.xu@linux.intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If lbr_desc->event is successfully created, the intel_pmu_create_ guest_lbr_event() will return 0, otherwise it will return -ENOENT, and then jump to LBR msrs dummy handling. Fixes: 1b5ac3226a1a ("KVM: vmx/pmu: Pass-through LBR msrs when the guest LBR event is ACTIVE") Signed-off-by: Like Xu --- arch/x86/kvm/vmx/pmu_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index d1df618cb7de..d6a5fe19ff09 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -320,7 +320,7 @@ static bool intel_pmu_handle_lbr_msrs_access(struct kvm_vcpu *vcpu, if (!intel_pmu_is_valid_lbr_msr(vcpu, index)) return false; - if (!lbr_desc->event && !intel_pmu_create_guest_lbr_event(vcpu)) + if (!lbr_desc->event && intel_pmu_create_guest_lbr_event(vcpu)) goto dummy; /* -- 2.29.2