Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1547915rwd; Thu, 1 Jun 2023 18:06:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OyktHTVtYDF7k5fYCnvKNgMUyPOu0Y/ZzQeToQGRPvy6/n0HgI9ONqRmnk6gHkELFok8l X-Received: by 2002:a05:6a20:8f2a:b0:10f:176d:6ae9 with SMTP id b42-20020a056a208f2a00b0010f176d6ae9mr10055545pzk.1.1685667973422; Thu, 01 Jun 2023 18:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685667973; cv=none; d=google.com; s=arc-20160816; b=xWXChQOQ1FoGjBmq5CP5VF9WDLIVFdgM/ax227otX+b37dr1ASx9ZUZlq1Ftzt6oQC 15eI8JUIyFIaDZLb+cjd3+vEpj1nJgMZkO/kk2xgzNGjTUBFLRD4i5ajlcYTBZwEoP1/ QaDQPA+bYfHd2NO+1mfjrbt0WbpCgBC7gq1gH6uWVkH7cw/PcYRt+NVggc6kkM5R6zWJ Vf51ax/gjGelGHalkKZNAj1mNx/Tvbeb3zJQeHaU17og7mGEyhmxNOLsRuOWgjT3uJ6V DF7WpANW3rXeF9CLgYehi6HEw9TzrnAdbrFBt7fkp0M88vKzNwkBEBHOMUfgT1jr2ur5 Ew6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=UwDLvloBHLyRnlYV3ilTxE4DfXWJDonOEINeBkDblso=; b=V5GSN0UFMntAGISbhfx4BpDZpMyTNE3TX/80PRm3/Uqam6EhNBypvR9sjhr6W1BDs/ Az4CJ7R4/GMIwv3XijpsERaijPDTvmqdhdud9CO5AkefIycjKAh96xTYuHvkIRjWbLn6 JxQ2EpaiMPmtYa4RyHZniPZ0QcnF13pL7QwW4UwfIAZPtsnoHxm3OOHlHAWssUo1H8Y/ tmGLXZB/0H/C/8c01nQH44ejDi8UPpMA26E7Xf9bF64XSyHTZAQNgPOam+iq4Hw2Gfn6 JpXNMRBZ3CEW4DJ79YKQUAN6r+CfqNVPIVVOQTXjodvKbZgS9ZCBuFKEaRoyEUKJzllI gxvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b="ioyx/i5E"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a190-20020a6390c7000000b0053f26705a25si103461pge.321.2023.06.01.18.06.00; Thu, 01 Jun 2023 18:06:13 -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=@google.com header.s=20221208 header.b="ioyx/i5E"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232921AbjFBAuq (ORCPT + 99 others); Thu, 1 Jun 2023 20:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbjFBAup (ORCPT ); Thu, 1 Jun 2023 20:50:45 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C91E4 for ; Thu, 1 Jun 2023 17:50:43 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-568fd72993cso50412907b3.1 for ; Thu, 01 Jun 2023 17:50:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685667043; x=1688259043; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=UwDLvloBHLyRnlYV3ilTxE4DfXWJDonOEINeBkDblso=; b=ioyx/i5EjbogKgkMKMycd7DwDlffY7dtgmNR4/95N0IhgC40k/BLk6Q4bWmoDv+vxr GIolc3vF+dr9ORF0r6N6zs1JF4pmqnSWh7zryylKxB8jcVyd7alDEDyxB7pvhiPpHviG JHEPmGctVGXgShujLr2EVSmNDX2A1GSRimJJcDM7U1YjQpsnlHd8iPEzccplQcCqSdcx 7Yvwdihx9U3mylWk6i3/ITuBt8+BzkwP0ZHJYNi8Yzzk3bvTnmP7n+2ZBVwqyR5mp1wC spnnzHQogWGIG8upOOYGiGEEuIx1FPgeRjlyqWyO6B4fLV+u41R8C91SCawHMRYo5MUE ho5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685667043; x=1688259043; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UwDLvloBHLyRnlYV3ilTxE4DfXWJDonOEINeBkDblso=; b=iSFJ7iHLDvEuTI35fr0y6MyaX/f7eVLwWr7VM6nnacBxrvL2x2jqDat2tDfIUb44ef t7QSEGBIpS7rUdRVBLXyRNX+vmxhqfgJdBnAWsUzGW/z4wdLLloVOALdv4yGhaTlB1zY IQLDlsTOjbQGb+mV/QgJ2HA2jUscpXGnRSKDt2vlrw7VqKl7F3ArqywjoVLnUDyjDJj9 gsf55kONTBykkrLuJK2CC7cIDHfohAZJ2H5vqQuTYI7qUVnZTqIaBdTnIQ4RpR+MdK4i Zuyr4FHk0nyx6fTAKWqbVJc7tc+MQ/Ubw+X66Ril2Vqiti94Gt5ufV4ERewEkqZ4khrM ujoQ== X-Gm-Message-State: AC+VfDwk2VnNf4gdrmuWNw4JIpSUIx6+P9hoXmHHKR9kWcQeLaENK59H XkIapHqzVCJeslpnXhF+w8MJZwIy1pA= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:690c:386:b0:561:1494:69f8 with SMTP id bh6-20020a05690c038600b00561149469f8mr2639416ywb.1.1685667042796; Thu, 01 Jun 2023 17:50:42 -0700 (PDT) Date: Thu, 1 Jun 2023 17:50:41 -0700 In-Reply-To: <20230530060423.32361-6-likexu@tencent.com> Mime-Version: 1.0 References: <20230530060423.32361-1-likexu@tencent.com> <20230530060423.32361-6-likexu@tencent.com> Message-ID: Subject: Re: [PATCH v6 05/10] KVM: x86/pmu: Disable vPMU if the minimum num of counters isn't met From: Sean Christopherson To: Like Xu Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Jim Mattson Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 On Tue, May 30, 2023, Like Xu wrote: > According to Intel SDM, "Intel Core Solo and Intel Core Duo processors > support base level functionality identified by version ID of 1. Processors > based on Intel Core microarchitecture support, at a minimum, the base > level functionality of architectural performance monitoring." Those > antique processors mentioned above all had at least two GP counters, > subsequent processors had more and more GP counters, and given KVM's > quirky handling of MSR_P6_PERFCTR0/1, the value of MIN_NR_GP_COUNTERS > for the Intel Arch PMU can safely be 2. Not sure what you mean by "safely", but I don't think this is correct. KVM can, and more importantly has up until this point, supported a vPMU so long as the CPU has at least one counter. Perf's support for P6/Core CPUs does appear to expect and require 2 counters, but unless I'm misreading arch/x86/events/intel/core.c, perf will happily chug along with a single counter when running on a modern CPU. I doubt such a CPU exists in real silicon, but I can certainly imagine a virtual CPU being configured with a single counter, and this change would break such a setup. And *if* we really want to raise the minimum to '2', that should be done in a separate commit. But I don't see any reason to force the issue. No need to send v7 just for this, I can fixup when applying (planning on reviewing the series tomorrow).