Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1626515pxj; Wed, 19 May 2021 10:05:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY86Py++c9rYCERrrB0FJqljr4mLLCSasBwpBM9t/g0E4HSX9Ir2U4TRc9hFY9Ww+CRDrM X-Received: by 2002:a17:906:3411:: with SMTP id c17mr179329ejb.332.1621443919446; Wed, 19 May 2021 10:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621443919; cv=none; d=google.com; s=arc-20160816; b=NiSpM3TZFAkYOVeQ8yHTzRQF6W3ZfKFPABlswSCBKVHAy02I9tM5wCLtRpF5edTKVd mUOkNO4LdG4i3SFu80JndWobnfgFl32PDqea2B49jmxog4SlbS6ZQIYAV1xjxvlzdl3P ynyvCgc6JOZ9W9egHn2i26Kk/sD6e6pVPDZ7vlE8pwf4RYijDHxV+/+RtyvAJjG8XE9l mXqfuRL+GyGeKoH9rfRjnIGkwsoKi94K5bW1DnKbqdC0kgab2iUS3+Tf2ob/Lm2oxkZb WVj78vLQh4lLRjEIBXzLNqU4Q/KwyL4t39yxA5Yr8XQPR8hG5UWfppe6NbyBptyeXrUy iHCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rE0H/Q8Q6VqgkakFnqfCmtWgnwAxCYwxpU5NtXrvg74=; b=rq8VjudFKaZQnNpDGiTFEi7poFoHku9rZAGqZeuGEYIhWBblu2qt0/QFUivZA+FeKw H4ok/LHKsGBe+0I6AgNm//1ltKmUDIDLM8YR3kmunH3ql1GKHjdl/sSX+jasKebT4YHe f9w7S2XNVSJ3SLt8z3OmGc0TSv++TrRv/lvZZPiullhtWV8j+RmUApWniKxYhRf4U4q9 y77u0KW+6zvrfkpD/SsrYxqySSvO6liBCIY60cHaiNGHPuAbv53/JFCU5Dn1GdmYCvEm 5/4OPiwKj8p/BXm59J/y2x30EUNiEiqCIiIHJV6OdG6fpcUC3NoYe3wxyEx7EftAny4F VZhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uoKTY8wJ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si208654ejc.744.2021.05.19.10.04.54; Wed, 19 May 2021 10:05:19 -0700 (PDT) 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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uoKTY8wJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346948AbhERIiu (ORCPT + 99 others); Tue, 18 May 2021 04:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242786AbhERIij (ORCPT ); Tue, 18 May 2021 04:38:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E56A7C061756; Tue, 18 May 2021 01:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rE0H/Q8Q6VqgkakFnqfCmtWgnwAxCYwxpU5NtXrvg74=; b=uoKTY8wJ0J2QhESQcCp1nc+dx0 nBG2Usoew0Pen9rl9x6RfuuHFM/NY/cgXAVlZy5qpOjopGDmEoKyxJDaer4p6Jp/9NA5X2v0YHQLw eqBHcA6z+YGN2YS/bToxNQl6b2wtls11XdoHyuKIVm0gLn0QaFQRsCnK+uylwo7EOWtP9C0/rG2+N ZJRNlihnCbbu7HgedvF+CLAdde7UxiEQGdjqWY6ZAEnOQR2wp6BkJJRUtiQK/CKqVFbCyfYOa2f/1 ztmhLgrUQdPhfYXeQhkP0B6vDU5qdWdVPgRLiG+jkOiCBp8wh84i4sWQlthUkzvX+puNAe9stUGUs 1or3bmGQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1livC5-00Do8E-Cq; Tue, 18 May 2021 08:35:26 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 7C107300233; Tue, 18 May 2021 10:35:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5AEAB2BE6E843; Tue, 18 May 2021 10:35:09 +0200 (CEST) Date: Tue, 18 May 2021 10:35:09 +0200 From: Peter Zijlstra To: "Xu, Like" Cc: Paolo Bonzini , Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , ak@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Like Xu Subject: Re: [PATCH v6 05/16] KVM: x86/pmu: Introduce the ctrl_mask value for fixed counter Message-ID: References: <20210511024214.280733-1-like.xu@linux.intel.com> <20210511024214.280733-6-like.xu@linux.intel.com> <1fb87ea1-d7e6-0ca3-f3ed-4007a7e5a7d7@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1fb87ea1-d7e6-0ca3-f3ed-4007a7e5a7d7@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 18, 2021 at 03:55:13PM +0800, Xu, Like wrote: > On 2021/5/17 16:18, Peter Zijlstra wrote: > > On Tue, May 11, 2021 at 10:42:03AM +0800, Like Xu wrote: > > > The mask value of fixed counter control register should be dynamic > > > adjusted with the number of fixed counters. This patch introduces a > > > variable that includes the reserved bits of fixed counter control > > > registers. This is needed for later Ice Lake fixed counter changes. > > > > > > Co-developed-by: Luwei Kang > > > Signed-off-by: Luwei Kang > > > Signed-off-by: Like Xu > > > --- > > > arch/x86/include/asm/kvm_host.h | 1 + > > > arch/x86/kvm/vmx/pmu_intel.c | 6 +++++- > > > 2 files changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > > index 55efbacfc244..49b421bd3dd8 100644 > > > --- a/arch/x86/include/asm/kvm_host.h > > > +++ b/arch/x86/include/asm/kvm_host.h > > > @@ -457,6 +457,7 @@ struct kvm_pmu { > > > unsigned nr_arch_fixed_counters; > > > unsigned available_event_types; > > > u64 fixed_ctr_ctrl; > > > + u64 fixed_ctr_ctrl_mask; > > > u64 global_ctrl; > > > u64 global_status; > > > u64 global_ovf_ctrl; > > > diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c > > > index d9dbebe03cae..ac7fe714e6c1 100644 > > > --- a/arch/x86/kvm/vmx/pmu_intel.c > > > +++ b/arch/x86/kvm/vmx/pmu_intel.c > > > @@ -400,7 +400,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > > > case MSR_CORE_PERF_FIXED_CTR_CTRL: > > > if (pmu->fixed_ctr_ctrl == data) > > > return 0; > > > - if (!(data & 0xfffffffffffff444ull)) { > > > + if (!(data & pmu->fixed_ctr_ctrl_mask)) { > > Don't we already have hardware with more than 3 fixed counters? > > Yes, so we update this mask based on the value of pmu->nr_arch_fixed_counters: Yes, I saw that, but the Changelog makes it appear this is only relevant to ice lake, which I think is not fully correct.