Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2924343rwb; Mon, 15 Aug 2022 14:09:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7tg7BBJPeaHE589WzNNuD8TLVgmaJCzowwms/ZAaOV/8wWiPrsz7bCKag7/WkFuNVIsYbb X-Received: by 2002:a17:90b:4aca:b0:1f4:ea26:f589 with SMTP id mh10-20020a17090b4aca00b001f4ea26f589mr29232873pjb.142.1660597759032; Mon, 15 Aug 2022 14:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597759; cv=none; d=google.com; s=arc-20160816; b=E7ptHEwTI6F4xkdrML0bHoAIL4Dpo3c2Z9zLHO42REuwDvHJZ+DLREvcUBK1+SSWil 0/cpX6flQDYuvpkx/ZetH78HyRryOcp5G6d49mxEniQv+PoPv2cNMLe9FF9O8AorwNJc ReqIu70h0mhwiGN7CVBrslakMPwhLO5hNKsZ6iikLgTqRl5ZCjFOGTu5XAkSJgQk0Hcu T6gCeOGtwhXncJWqV5X+jTiMtxLkyfBeSa3oImfLruf4+zn0ByeCtyvLRrwP8qhgm/b5 lkfuggxqOZ0z437fbtKpgA2iF1OQBJ2t855JaJnznc5Oc67tZGMRA6L7xTObguxfPlAn 4nxA== 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=yGA76Rp1srfmuvcGS0fdqcMY0ikxoL5465oM6Kfx+wY=; b=vtUs/LZ8xmX8hHQnyTU1KxImhlUQCKL0p7dvKO6Dd+KI6wwHQTh+XFvJmukajLsCY8 7gI9oWIK5OazaFPAnkIwg+efi+C1jXgYJFUp6vTpmsCfbBldiKYYZax6Kf1wxIWlxiwF ntvcT+Ky4pJ3JX5fs/OfunbgUPbzBXcyCEvkMlAeaCWRHY+kzppuheBcMVfjV/AQCmzg cIXzLBc+/ssToSrwYwhd8GeC/cy3vNll9oecxXETF2o57unNKpdSC8stgKhQHjcTvWtS sMb+ecBPA8KSvBMw9MpEKIjPPXjTl7eKxUncln+C7EtCyYbK67AYaOb0aSU+kEOqdPjr hAeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="HtzVKsv/"; 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 x5-20020aa78f05000000b005251a2f06bbsi11393356pfr.59.2022.08.15.14.09.07; Mon, 15 Aug 2022 14:09:19 -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="HtzVKsv/"; 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 S242144AbiHOUAC (ORCPT + 99 others); Mon, 15 Aug 2022 16:00:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241858AbiHOT7G (ORCPT ); Mon, 15 Aug 2022 15:59:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A317796B5; Mon, 15 Aug 2022 11:53:11 -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 716D9B810A6; Mon, 15 Aug 2022 18:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85AD9C433C1; Mon, 15 Aug 2022 18:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589588; bh=WFP8opjL5wR21vO6sG4t40QfsjTNuVfWGHPP07Rlybo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtzVKsv/EIu50ovEQn3dS1UPbheZ2qYSZeHhJGWbv9NFg70W5hWRsTVgf874cVeee uxQylTKNmtR6P2Hihvo72DzgeqnbfTu9Lwn71aSO6xH37PpL1f+5YCRu66sXvsNsUH vgbtuHjBL5XIoc0wgAeoFoFogepf56MGBPSWsKX4= 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.15 734/779] KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesnt support global_ctrl Date: Mon, 15 Aug 2022 20:06:18 +0200 Message-Id: <20220815180408.824384578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 c66edf93e4a8..f9054e7ec89e 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -104,6 +104,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