Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3100378rwb; Mon, 15 Aug 2022 18:06:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7S09U1pKOzdU2DwtSw4mUnPd/RcGc7qO6DD+seirivEhmuUBDJfAsV7lJDKdYZf9Ifub0p X-Received: by 2002:a17:907:6088:b0:733:1435:fb07 with SMTP id ht8-20020a170907608800b007331435fb07mr12078568ejc.306.1660611987854; Mon, 15 Aug 2022 18:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611987; cv=none; d=google.com; s=arc-20160816; b=nRbh/nXbiQu7z6OHYix5PFCU/jNFEW8iEtWXhS4+ysJarFy/B4MtoEhFl8ZSRZNsOe PJflwgn+Lhg9mpzY5jTNuEjWFJZJDlHA2yN33ccbjt3rYpkiNBQHCN//hHLN5mwxgln2 Dx6LjzGsn3y2ReYIyT2X7umjGv1PbsAYY14THiRbEavdWMAhvHn4q4hH+q0wTuDmiUgV HDCIWc8LaVb7vMWjgKUzyszv9D9arDVwgQJn1KsSDVZaVodvF1IG82cwytkQXNGOTlvU NC3t//pNn97jZSvOyxUhldvAcuduA4tzrGrvTb1+cwTFTxEYXPdMjUvxdOEZhs14L7EN YdEA== 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=T/wrChQNunc4XcQ0+6RUqbZT4rL1OyXEajVhNdfyLTM=; b=eqSP2yyQh3AKrMBnOsciZcXT9CeHdoK5sLr1FZ6jWx6O4pJjipCyLHtezSG9IlCefg ZRbi4KjRt1qXzM2jOJiQTwM4nbo3DN6z1JjfO56rIQdQ4nCZrHVUrgUpeZyMtUp1leF6 +qnqjtRxs2Cyks345D96jw1GWyrU6+TGf+jrZwvNA3BQwNT7c7f8XioGffpPPS7j8WVH 2fQZXJRnA+rHL/l3a9EM4M/+quCOFTm6Uhi7HSWnjwED/xR1Pxfb3I7k0iDvU43zYcTL WAUblbb38zp2AnfkOaq/lusRWRiSlv1rJZez1DNsqFDLJ5p1rNqMHOcB/4wIewjq/Ka/ phlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eo8ad7ee; 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 ne18-20020a1709077b9200b0073860fb87ddsi2732673ejc.487.2022.08.15.18.05.59; Mon, 15 Aug 2022 18:06:27 -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=eo8ad7ee; 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 S1343995AbiHPBCr (ORCPT + 99 others); Mon, 15 Aug 2022 21:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347124AbiHPA5K (ORCPT ); Mon, 15 Aug 2022 20:57:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7AF19F4A0; Mon, 15 Aug 2022 13:48:39 -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 88A03B8114A; Mon, 15 Aug 2022 20:48:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEE34C433C1; Mon, 15 Aug 2022 20:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596516; bh=MNbRGbvKx0Fc3/CMG/a0YCGf2f9m+V0seGwzfqfY6lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eo8ad7eeuSTefL7kaQBld7takvdyk3sOUM/vCGt7vr4Zy3jOkq7whOZSsfDHP/xHz JXtxCC2g5pYFET/7a83xcrUgs8dEtZLZW5WImr7nbVuLCFif0nTz18O9brVvU+bWoL wQyzyJRvVUYIsnBnSQrOl4VWTdck69QtfwkQ0Z7o= 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.19 1104/1157] KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesnt support global_ctrl Date: Mon, 15 Aug 2022 20:07:40 +0200 Message-Id: <20220815180524.429254962@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 2696b16f9283..8faac421171f 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