Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3233300pxb; Tue, 20 Apr 2021 03:49:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLQ8suv1kk3SfZkOm65AtvwcK9O2Owy6j5C02JXkoQz+SGmWtFtIYuZIlNofAGe/oA2VVK X-Received: by 2002:a05:6402:350:: with SMTP id r16mr23930669edw.227.1618915778914; Tue, 20 Apr 2021 03:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618915778; cv=none; d=google.com; s=arc-20160816; b=dru0p++LY7bdnS/hJwOYgwfCBHeuo5coAwgpj7y+1qqXjGHzu0bVwOpmY2KCaqe6xj bFJEy1m665AOo5JssFJRymWZBGtdWwepLLtgXp4L9ABiPgV2csgU+BqDucoo5guobvN1 G5368gjqAYQdPA0SHiiOdJUbJ+Xr8t1Euzx/oVD81KviwhiQbibtaVIAwmwNsBgem6lI vgWleiL2R3O14XMcw6m8ozc6dueeZ6kVkvvwuF2CONCg6EzKB0hATc6ZVBhKuGLAx+5A 2KnNKeq4gdKLvIuZxf6Ax3xlC7P6Aav2DhVa0XuiShIk6eH+g6c9N7xcGlVwynQEglcn LMbw== 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=ALH6LK+EMDJDxLyp+nFk6oYEXwVFVYbqoxtLCyAxqB4=; b=Kf6GBLAK2O0g2tEjTCPnLNICPNpXKatkFioGG9d5HNyxCtQa3xIHp7ZZtARcjD3KT7 SHhSqkuPVzANbA4GnbTbiAQzkhM7pmjC+ZH1++svuvQNsgswH7wc59w4Y1LH4HfVuWBP OrAo/rxONjKgZwDok1tnvYUokb/lZNf4vujR3IEF3wLr9QW/XlJNVVX+0UdQPPzLdbiy kHmt+W4yGNbOHOn8cCj3gVQ/T79fABdJuDNJbellNFtcbeho0YXtOaGOQgPBQV44wjSR W9f9MPFUSk0jo95384d1xdbywiKrDVBHYEmbvd5gOsLAjbsQ7pOOPgz8AuvpPOtGF3+h I7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="pSzq+O/V"; dkim=neutral (no key) header.i=@linutronix.de header.b=Sr48ROhA; 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 w14si2123390edc.196.2021.04.20.03.49.15; Tue, 20 Apr 2021 03:49:38 -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="pSzq+O/V"; dkim=neutral (no key) header.i=@linutronix.de header.b=Sr48ROhA; 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 S232201AbhDTKsR (ORCPT + 99 others); Tue, 20 Apr 2021 06:48:17 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51708 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbhDTKrT (ORCPT ); Tue, 20 Apr 2021 06:47:19 -0400 Date: Tue, 20 Apr 2021 10:46:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618915607; 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=ALH6LK+EMDJDxLyp+nFk6oYEXwVFVYbqoxtLCyAxqB4=; b=pSzq+O/Vc6rZEV6XOY7KyPFExDkqygJ7tJAbXsGDjff9BP7qrVsKB0MkRT7HHF2gjeISYW Sze2f6+KDmmgwGyrNzTJBV0QFcgnkSd3cb2GgioqcO0NbW8vX36q1OGt9cWshzwBfOnilP dwta9pf2C95t+eHloleQyNxpNYAO5kx35ZoP4LFEIoBFkDN9aUAKIgewYMDvu7c1uTFBrB emTW/9XHr/j1vUYi6p4iKcyaVXWwMHSZinmcL4xxZi4J1BYrPjZp0QEBQ1ynLDwBZNcXhA 8uW0Xe5UBBXlEHXd/8C1I9BLFVbGtkdN2Otolp5yD5c23r+0LgtrtGZMT8opUA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618915607; 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=ALH6LK+EMDJDxLyp+nFk6oYEXwVFVYbqoxtLCyAxqB4=; b=Sr48ROhABa+7/tDvl0AG9Jm2JKCOiVEWAhv3PCThi0un6s/VwLSkTEC+IY50PqbqX0Seqc BGftlBbCrh8IxmDA== 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: Hybrid PMU support for event constraints Cc: Kan Liang , "Peter Zijlstra (Intel)" , Andi Kleen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <1618237865-33448-10-git-send-email-kan.liang@linux.intel.com> References: <1618237865-33448-10-git-send-email-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <161891560686.29796.18068163848465309927.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: 24ee38ffe61a68fc35065fcab1908883a34c866b Gitweb: https://git.kernel.org/tip/24ee38ffe61a68fc35065fcab1908883a34c866b Author: Kan Liang AuthorDate: Mon, 12 Apr 2021 07:30:49 -07:00 Committer: Peter Zijlstra CommitterDate: Mon, 19 Apr 2021 20:03:25 +02:00 perf/x86: Hybrid PMU support for event constraints The events are different among hybrid PMUs. Each hybrid PMU should use its own event constraints. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Andi Kleen Link: https://lkml.kernel.org/r/1618237865-33448-10-git-send-email-kan.liang@linux.intel.com --- arch/x86/events/core.c | 3 ++- arch/x86/events/intel/core.c | 5 +++-- arch/x86/events/intel/ds.c | 5 +++-- arch/x86/events/perf_event.h | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index e8cb892..f92d234 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1518,6 +1518,7 @@ void perf_event_print_debug(void) struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); int num_counters = hybrid(cpuc->pmu, num_counters); int num_counters_fixed = hybrid(cpuc->pmu, num_counters_fixed); + struct event_constraint *pebs_constraints = hybrid(cpuc->pmu, pebs_constraints); unsigned long flags; int idx; @@ -1537,7 +1538,7 @@ void perf_event_print_debug(void) pr_info("CPU#%d: status: %016llx\n", cpu, status); pr_info("CPU#%d: overflow: %016llx\n", cpu, overflow); pr_info("CPU#%d: fixed: %016llx\n", cpu, fixed); - if (x86_pmu.pebs_constraints) { + if (pebs_constraints) { rdmsrl(MSR_IA32_PEBS_ENABLE, pebs); pr_info("CPU#%d: pebs: %016llx\n", cpu, pebs); } diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 4cfc382..447a80f 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -3136,10 +3136,11 @@ struct event_constraint * x86_get_event_constraints(struct cpu_hw_events *cpuc, int idx, struct perf_event *event) { + struct event_constraint *event_constraints = hybrid(cpuc->pmu, event_constraints); struct event_constraint *c; - if (x86_pmu.event_constraints) { - for_each_event_constraint(c, x86_pmu.event_constraints) { + if (event_constraints) { + for_each_event_constraint(c, event_constraints) { if (constraint_match(c, event->hw.config)) { event->hw.flags |= c->flags; return c; diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 312bf3b..f1402bc 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -959,13 +959,14 @@ struct event_constraint intel_spr_pebs_event_constraints[] = { struct event_constraint *intel_pebs_constraints(struct perf_event *event) { + struct event_constraint *pebs_constraints = hybrid(event->pmu, pebs_constraints); struct event_constraint *c; if (!event->attr.precise_ip) return NULL; - if (x86_pmu.pebs_constraints) { - for_each_event_constraint(c, x86_pmu.pebs_constraints) { + if (pebs_constraints) { + for_each_event_constraint(c, pebs_constraints) { if (constraint_match(c, event->hw.config)) { event->hw.flags |= c->flags; return c; diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index b65cf46..34b7fc9 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -648,6 +648,8 @@ struct x86_hybrid_pmu { [PERF_COUNT_HW_CACHE_MAX] [PERF_COUNT_HW_CACHE_OP_MAX] [PERF_COUNT_HW_CACHE_RESULT_MAX]; + struct event_constraint *event_constraints; + struct event_constraint *pebs_constraints; }; static __always_inline struct x86_hybrid_pmu *hybrid_pmu(struct pmu *pmu)