Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2395712rwb; Mon, 15 Aug 2022 04:54:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4fSsrT2xw7kxvuWxZzYVdHXVcq7PcSp0XgHl3EaBPmR/fioLGtxNc43oVtd+Kq7LRDbsNv X-Received: by 2002:a17:906:eec7:b0:733:189f:b07a with SMTP id wu7-20020a170906eec700b00733189fb07amr10253461ejb.230.1660564463274; Mon, 15 Aug 2022 04:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660564463; cv=none; d=google.com; s=arc-20160816; b=n5EyY7q7dOzVmTOKh6I0aVoc2ogXb2oQAcSgHP3rPQaSgnpSFw3X6gqkpbc9V6cOl+ xByUDF2pTEO14bXiBe7iZBxngVE4OKMJDY1YE9LKUukAGKeXta7x/P3Jy5jqzzK6CMgp 8bWn1WzzOkIeGQ1Y2kju1ulRm/af4S0JkYyPwChNbVigmT0SER6fftezVC3QWe0vD+hI ddEBIgtKU79PKYqu1Lrc8uXYr3eIJVnory/npU6G+EZv0YAcS5PDpvrP+7WR/NswVrjN 0qlkzGsQdzJlOH1b5C4JCzyIAFWKZKfER90PMIUAB+ndVgreqcXLhwwMIWYTk68KUU6o ni5w== 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=AY90FDGrlLVOwMMh0B+hcvwJokTU8oLwiaqpshHftBY=; b=EPFOJ9fWVUSfWQhidXP43/12tz21l9+GKxsx6v5Meay5wIA5rQycoKZNn+Y0FSzW+i ALJL9w4DTctrVoLHBkXY+wWPThZsbODlOXIJ8yoR9WCTRYLNJCHPrJ6JbUQVXsCizH4B 6Zkk/G3ON6mNjaEOdmKzE77Bah/nrLOrBTQlmWDXI02ZPfSct0+O54i7VNGdXTcouKaw 5wG14n8pClVWbgSLdf87DFpdWaBdPP1MZcLlSIYu7NHAUMCmLa42VCu1ifpSYiW2xg3F LP1P+lcozDSeSCZC1U+TleiZkKkXhT/QjkRy5QqvfGO8ABJY9i53CMn+tEhjEX7DD2I2 limA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="DQK7Jm1/"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p34-20020a056402502200b00443ec4b2b34si529470eda.101.2022.08.15.04.53.57; Mon, 15 Aug 2022 04:54:23 -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=@infradead.org header.s=desiato.20200630 header.b="DQK7Jm1/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241189AbiHOLv3 (ORCPT + 99 others); Mon, 15 Aug 2022 07:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231405AbiHOLv1 (ORCPT ); Mon, 15 Aug 2022 07:51:27 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C87D11C929; Mon, 15 Aug 2022 04:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=AY90FDGrlLVOwMMh0B+hcvwJokTU8oLwiaqpshHftBY=; b=DQK7Jm1/Ib1C91LitVokWcZo/V oVPJd4DRpps/JOvj4reIP9SRWHc7vH8/kt6bfBIhA2CziikfwhLmFWrfGd9LjCPElMgA0wfl/ZAto VqTlGrMwjzePCr2Ms4a8PkMR2/YRkF8y7XVaBG6q48OYZ/YafcokcZnr6q7fCdO5qz4pNczQVLaqj Lme7L5sS0Cp+Nx4LN5e/uGAsXle2H+FAj9yQDqaDc3e7dFWLDsSVaDH5m+VkRRYPjzsm1VknVHbKi qEnHfMjvVwrQJJPRrWqGhm3hQjq2ZAO665aPMfTpfJdu41NH96sDIdn5tEGgw9dh1G17JOmZBVyiA 6h126/SA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNYcp-002f5R-LX; Mon, 15 Aug 2022 11:51:20 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id E39CF980153; Mon, 15 Aug 2022 13:51:17 +0200 (CEST) Date: Mon, 15 Aug 2022 13:51:17 +0200 From: Peter Zijlstra To: Like Xu Cc: Paolo Bonzini , Sean Christopherson , Jim Mattson , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Kan Liang Subject: Re: [PATCH v2 1/7] perf/x86/core: Update x86_pmu.pebs_capable for ICELAKE_{X,D} Message-ID: References: <20220721103549.49543-1-likexu@tencent.com> <20220721103549.49543-2-likexu@tencent.com> <959fedce-aada-50e4-ce8d-a842d18439fa@redhat.com> <94e6c414-38e1-ebd7-0161-34548f0b5aae@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <94e6c414-38e1-ebd7-0161-34548f0b5aae@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 On Mon, Aug 15, 2022 at 05:43:34PM +0800, Like Xu wrote: > > diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c > > index 2db93498ff71..b42c1beb9924 100644 > > --- a/arch/x86/events/intel/core.c > > +++ b/arch/x86/events/intel/core.c > > @@ -5933,7 +5933,6 @@ __init int intel_pmu_init(void) > > x86_pmu.pebs_aliases = NULL; > > x86_pmu.pebs_prec_dist = true; > > x86_pmu.lbr_pt_coexist = true; > > - x86_pmu.pebs_capable = ~0ULL; > > x86_pmu.flags |= PMU_FL_HAS_RSP_1; > > x86_pmu.flags |= PMU_FL_PEBS_ALL; > > x86_pmu.get_event_constraints = glp_get_event_constraints; > > @@ -6291,7 +6290,6 @@ __init int intel_pmu_init(void) > > x86_pmu.pebs_aliases = NULL; > > x86_pmu.pebs_prec_dist = true; > > x86_pmu.pebs_block = true; > > - x86_pmu.pebs_capable = ~0ULL; > > x86_pmu.flags |= PMU_FL_HAS_RSP_1; > > x86_pmu.flags |= PMU_FL_NO_HT_SHARING; > > x86_pmu.flags |= PMU_FL_PEBS_ALL; > > @@ -6337,7 +6335,6 @@ __init int intel_pmu_init(void) > > x86_pmu.pebs_aliases = NULL; > > x86_pmu.pebs_prec_dist = true; > > x86_pmu.pebs_block = true; > > - x86_pmu.pebs_capable = ~0ULL; > > x86_pmu.flags |= PMU_FL_HAS_RSP_1; > > x86_pmu.flags |= PMU_FL_NO_HT_SHARING; > > x86_pmu.flags |= PMU_FL_PEBS_ALL; > > diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c > > index ba60427caa6d..e2da643632b9 100644 > > --- a/arch/x86/events/intel/ds.c > > +++ b/arch/x86/events/intel/ds.c > > @@ -2258,6 +2258,7 @@ void __init intel_ds_init(void) > > x86_pmu.drain_pebs = intel_pmu_drain_pebs_icl; > > x86_pmu.pebs_record_size = sizeof(struct pebs_basic); > > if (x86_pmu.intel_cap.pebs_baseline) { > > + x86_pmu.pebs_capable = ~0ULL; > > The two features of "Extended PEBS (about pebs_capable)" and "Adaptive PEBS > (about pebs_baseline)" > are orthogonal, although the two are often supported together. The SDM explicitly states that PEBS Baseline implies Extended PEBS. See 3-19.8 (April 22 edition). The question is if there is hardware that has Extended PEBS but doesn't have Baseline; and I simply don't know and was hoping Kan could find out. That said; the above patch can be further improved by also removing the PMU_FL_PEBS_ALL lines, which is already set by intel_ds_init(). In general though; the point is, we shouldn't be doing the FMS table thing for discoverable features. Having pebs_capable = ~0 and PMU_FL_PEBS_ALL on something with BASELINE set is just wrong.