Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3232964pxb; Tue, 20 Apr 2021 03:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUFe5XH+sGZLYrEQpeZm/NWqm+XtIVcslc0MkRT/u8L0tUimYCNLDdnhfwk+Or1AMPghL6 X-Received: by 2002:aa7:c3ca:: with SMTP id l10mr23130450edr.55.1618915744812; Tue, 20 Apr 2021 03:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618915744; cv=none; d=google.com; s=arc-20160816; b=N3kRXDDJv3MklW+jsx6bT2rrt3nyn3sZ2avT0ACF+/BZGKiQGUYQmI0PMVuzx6V2o/ JPaUNIpNE9sxvMSxuJGvNQzODPluWb+gH40+xt9x/4jJFiURYhR+wbiOTsNtDsjJmT8l P4RVIg3DjQc58z6+0Gk/ZI+GHsIeicdyG95d2BOg8Zg2T5nnn4lttI9ZiSSbor4LXC41 faK+GIomyC2P+ASrzqgO3k8QT3ubq6BIyt87gLkFBJ5OXBwfDfzeUIr4BXmNk/WC9uFD tgg1sEsNmMFkZPuJglB0kU2V+LQ8SIoVJTauB4Dw8TVqw43z/BdK9vNKk3ukuaVSoGBz RRDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=NLmVmR/FMbrFBUFyVKQGXOG90bNyLkxW7lhJieuuxGM=; b=jqy+Kmvg8D+L/D9uDY1epyXOE9UOwl1+huAhN37yPxq0JiFnOaCnfmj+VQEQrVdomj dexVwaQXE/4iuLXL0rUcyI4D/6mG3hkg1bOVa/CbyGgPVif7CBGF/YhbHZDdOI1kS5hl LCIvHIlcrJemc4aQrpwwPrIiMUjlIQoYTAerqCtOWZUy5/W/1/POxCohC7uQttzQdpQo 7UPFetDGbDh3JiNnLaPz4lVv/HWC9x9TPu3E4YJgzrE4CTO21ZajPCZP5JGnXG4qH3/N JV0uymUz2/P1FAavSBTJvqb7jgq8U9eF9lD/H3021kKdHKlHua+1b1DSEPmiVtDcwF6S gpGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qoJxkr8J; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy6si14548625ejc.261.2021.04.20.03.48.41; Tue, 20 Apr 2021 03:49:04 -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=@linutronix.de header.s=2020 header.b=qoJxkr8J; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232091AbhDTKrx (ORCPT + 99 others); Tue, 20 Apr 2021 06:47:53 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51694 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbhDTKrR (ORCPT ); Tue, 20 Apr 2021 06:47:17 -0400 Date: Tue, 20 Apr 2021 10:46:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618915605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NLmVmR/FMbrFBUFyVKQGXOG90bNyLkxW7lhJieuuxGM=; b=qoJxkr8Ju/uNNCqV20GqXbLb9+Q5NkhjtgN+Lmytrxt6xTo/SXe6wXbPe+K38AW0etiAww /i55urp0gS/PooqXj+cHXNAPbib3kXW7OAmmIWejEqeaMg3DKiTaeP90NN3Jpej0XdeDUu 72v+Fe9O36BJUZOPkwc2OMmz13qLIDqzqSMaZxOel0x3RveMIO8cNrl1Mtju98K1cS4AdH zNRHUncGs2R/uqqXIZZQaXX/kMuAJJC+dHfzLmpRmElSXzncIMqjKDTlhZ9VaVJ4gf8ipk gNPT2DjBM+eVSMe5KP86qZMk8fb++KKghOruVRENFIWdIfNmd95/QBu96YA4kg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618915605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NLmVmR/FMbrFBUFyVKQGXOG90bNyLkxW7lhJieuuxGM=; b=WqH+2K1Kotq+U1fM9+SiCdFdTOKT5ugHDvE1Og+x4PE1CItjPIV7ic7aZosc2qc/Xy/i91 6QhGr57hHQpjJ/Bg== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86: Factor out x86_pmu_show_pmu_cap Cc: Kan Liang , "Peter Zijlstra (Intel)" , Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1618237865-33448-16-git-send-email-kan.liang@linux.intel.com> References: <1618237865-33448-16-git-send-email-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <161891560460.29796.11163420194789025178.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: e11c1a7eb302ac8f6f47c18fa662546405a5fd83 Gitweb: https://git.kernel.org/tip/e11c1a7eb302ac8f6f47c18fa662546405a5fd83 Author: Kan Liang AuthorDate: Mon, 12 Apr 2021 07:30:55 -07:00 Committer: Peter Zijlstra CommitterDate: Mon, 19 Apr 2021 20:03:27 +02:00 perf/x86: Factor out x86_pmu_show_pmu_cap The PMU capabilities are different among hybrid PMUs. Perf should dump the PMU capabilities information for each hybrid PMU. Factor out x86_pmu_show_pmu_cap() which shows the PMU capabilities information. The function will be reused later when registering a dedicated hybrid PMU. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andi Kleen Link: https://lkml.kernel.org/r/1618237865-33448-16-git-send-email-kan.liang@linux.intel.com --- arch/x86/events/core.c | 25 ++++++++++++++++--------- arch/x86/events/perf_event.h | 3 +++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index ed8dcfb..2e7ae52 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1976,6 +1976,20 @@ static void _x86_pmu_read(struct perf_event *event) x86_perf_event_update(event); } +void x86_pmu_show_pmu_cap(int num_counters, int num_counters_fixed, + u64 intel_ctrl) +{ + pr_info("... version: %d\n", x86_pmu.version); + pr_info("... bit width: %d\n", x86_pmu.cntval_bits); + pr_info("... generic registers: %d\n", num_counters); + pr_info("... value mask: %016Lx\n", x86_pmu.cntval_mask); + pr_info("... max period: %016Lx\n", x86_pmu.max_period); + pr_info("... fixed-purpose events: %lu\n", + hweight64((((1ULL << num_counters_fixed) - 1) + << INTEL_PMC_IDX_FIXED) & intel_ctrl)); + pr_info("... event mask: %016Lx\n", intel_ctrl); +} + static int __init init_hw_perf_events(void) { struct x86_pmu_quirk *quirk; @@ -2036,15 +2050,8 @@ static int __init init_hw_perf_events(void) pmu.attr_update = x86_pmu.attr_update; - pr_info("... version: %d\n", x86_pmu.version); - pr_info("... bit width: %d\n", x86_pmu.cntval_bits); - pr_info("... generic registers: %d\n", x86_pmu.num_counters); - pr_info("... value mask: %016Lx\n", x86_pmu.cntval_mask); - pr_info("... max period: %016Lx\n", x86_pmu.max_period); - pr_info("... fixed-purpose events: %lu\n", - hweight64((((1ULL << x86_pmu.num_counters_fixed) - 1) - << INTEL_PMC_IDX_FIXED) & x86_pmu.intel_ctrl)); - pr_info("... event mask: %016Lx\n", x86_pmu.intel_ctrl); + x86_pmu_show_pmu_cap(x86_pmu.num_counters, x86_pmu.num_counters_fixed, + x86_pmu.intel_ctrl); if (!x86_pmu.read) x86_pmu.read = _x86_pmu_read; diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index d8c448b..a3534e3 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -1092,6 +1092,9 @@ void x86_pmu_enable_event(struct perf_event *event); int x86_pmu_handle_irq(struct pt_regs *regs); +void x86_pmu_show_pmu_cap(int num_counters, int num_counters_fixed, + u64 intel_ctrl); + extern struct event_constraint emptyconstraint; extern struct event_constraint unconstrained;