Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3083612rwb; Mon, 15 Aug 2022 17:43:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR7398mXPyiiONVUN7z5rrUsGSMHr5nkc6aocMK41J7mw411/UV5DDu9+L65rT7UkDwiVjPb X-Received: by 2002:a17:90a:e7c2:b0:1f5:85ab:938c with SMTP id kb2-20020a17090ae7c200b001f585ab938cmr31371958pjb.133.1660610619409; Mon, 15 Aug 2022 17:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610619; cv=none; d=google.com; s=arc-20160816; b=PaAI+EadwYlyiIhiih+Kskze4JWTXW0TiaCSdVAcOyy3eperC3ItGHiqhBYEiMrgIy u0A+xSoCvKhoobW2wkFRznYkb/ggFvW3WC0IjQ/zR11PYzstnGuuZP+lP6Qs26e84BBW gSNOh64VYz75dUDYo1WBXItuA7OlKozQviqaC4QBOyxs7rkdsMpha75lh9ISC4O+00I/ SVOgttPk9CBqMajwSp9ZriRhKMiq+tLDEX3YHkU5aZmSdRnBuWyHz+V0Z5AIZ0fWChGW GyuJ3/L2IUGEYG7NL/E6warJqndWFif5CrH6hicdhQtfnoHQEOl155iw4Bt1GwQ7uM+4 /xLg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=njUbnnVV2/Zp2e1rPTy/D4MGLZ4bBaxWkRgKvnuVWSA=; b=z3miPRyqP9SLqfZ05pq5bpCj6TPM5FEgCjn3wv4d2E0wee2UZIp9BhKUww4NpLp6zS c3ls0umSi+KYF6swuF1pU/AfpY1PaakIIo5kCE7wkAc9D1tdZYm+yyR8qEurXS7m58V0 6P8kXalp3HVFHkOOU+uOsMBqj3EhoHpsD990vp2epNlgMpXOJHU2xfBCOIlNvVuQ9MTU RxToamWjGuI2TBqoGTG1tFhz7VXkPWm3HDFT+rrK3TPOvoek8X6i9CiZ4+UE/74HxgG/ YAebfbIWmvSRCJBFWwlfMkqXYKz3EdH765V2xtJc+XSrBALQuReUP3P+UCNxm8fvTBlF 5cng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Sq5JOao/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k7-20020a170902c40700b001677fa2026asi14223142plk.609.2022.08.15.17.43.28; Mon, 15 Aug 2022 17:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Sq5JOao/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233413AbiHOXc2 (ORCPT + 99 others); Mon, 15 Aug 2022 19:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343991AbiHOX0K (ORCPT ); Mon, 15 Aug 2022 19:26:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044387FE77; Mon, 15 Aug 2022 13:06:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1DEAB80EA8; Mon, 15 Aug 2022 20:06:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03928C433C1; Mon, 15 Aug 2022 20:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593993; bh=7OXU0rqd51gmgEtu/3maRQVaWYMA60F/ZGx4Urwez44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sq5JOao/AOlGeSJNHzyaf/r7uxeAe6Q1J5UvdPOx/w7X8k6QGFxt4Y5nvGqwEr00q LzDNXBk89PRiakYrjxM9s/girzl/p9296YArY4SnoZSA0XcNShx7YIg3fxuYAZQ9uf iQoKHA3/PH0WGYeb/6M7vRbots9Qh8DNyp38sBrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Like Xu , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 1039/1095] KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesnt support global_ctrl Date: Mon, 15 Aug 2022 20:07:18 +0200 Message-Id: <20220815180512.079838805@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Like Xu [ Upstream commit 98defd2e17803263f49548fea930cfc974d505aa ] MSR_CORE_PERF_GLOBAL_CTRL is introduced as part of Architecture PMU V2, as indicated by Intel SDM 19.2.2 and the intel_is_valid_msr() function. So in the absence of global_ctrl support, all PMCs are enabled as AMD does. Signed-off-by: Like Xu Message-Id: <20220509102204.62389-1-likexu@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/vmx/pmu_intel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index cd2d0454f8b0..2cbd5f183ab5 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -98,6 +98,9 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc) { struct kvm_pmu *pmu = pmc_to_pmu(pmc); + if (pmu->version < 2) + return true; + return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); } -- 2.35.1