From patchwork Tue Aug 6 20:41:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13755301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 321B0C52D71 for ; Tue, 6 Aug 2024 20:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4Ur9ffgtS293kHeqWh95GzK+LVZaaw/JPRsyPh7Ult4=; b=zyZ/i2zmQGqSC1yu0WTbg+I0xo YtGZ4tYVA3cmetFac4DgnFjGw7hnproVnYjzPY1lcHyYFLLduGvfhqjNk1IqGe9JnH6VPtvKhzAsC RvWucruiXpSNiWULk4gQrA7gDpK2r3TpdXCI+qgU+w7AFKYoi/wNpPEzei62gAGvujpr2lKthH3OI 2HACufqgtsoSR5j8n6laHC2g0gxyMRMp6nt9q75yywanhw7oJYdKmaOUaL010vaY5exuCa+Fi22DS cAP7mA1ZVhbdJgAqNnM4DvmvJcNPkYo/W4gpX5yIxeoAtvRlVv6U6fdebNNs33oTYdeQZ7KP5/1Ha BWYap2Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbR4o-00000002rud-3uZe; Tue, 06 Aug 2024 20:46:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbR0N-00000002qQs-1dHU for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2024 20:42:04 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 57FAAFEC; Tue, 6 Aug 2024 13:42:28 -0700 (PDT) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BACDD3F766; Tue, 6 Aug 2024 13:42:00 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Namhyung Kim , Ian Rogers , Adrian Hunter , James Clark , Suzuki K Poulose , Mike Leach , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Liang, Kan" Cc: Leo Yan Subject: [PATCH v1 8/9] perf intel-pt: Remove the 'pmu_type' field Date: Tue, 6 Aug 2024 21:41:29 +0100 Message-Id: <20240806204130.720977-9-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240806204130.720977-1-leo.yan@arm.com> References: <20240806204130.720977-1-leo.yan@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_134203_546160_2265C60B X-CRM114-Status: GOOD ( 13.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the evsel__is_aux_event() function to detect the enabled AUX events. The 'pmu_type' field is not used, remove it. Signed-off-by: Leo Yan --- tools/perf/util/intel-pt.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c index 1608d0e38679..69b664059c2d 100644 --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -84,7 +84,6 @@ struct intel_pt { unsigned int br_stack_sz; unsigned int br_stack_sz_plus; int have_sched_switch; - u32 pmu_type; u64 kernel_start; u64 switch_ip; u64 ptss_ip; @@ -1020,10 +1019,11 @@ static bool intel_pt_pgd_ip(uint64_t ip, void *data) return __intel_pt_pgd_ip(ip, data) > 0; } -static bool intel_pt_get_config(struct intel_pt *pt, - struct perf_event_attr *attr, u64 *config) +static bool intel_pt_get_config(struct evsel *evsel, u64 *config) { - if (attr->type == pt->pmu_type) { + struct perf_event_attr *attr = &evsel->core.attr; + + if (evsel__is_aux_event(evsel)) { if (config) *config = attr->config; return true; @@ -1037,7 +1037,7 @@ static bool intel_pt_exclude_kernel(struct intel_pt *pt) struct evsel *evsel; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, NULL) && + if (intel_pt_get_config(evsel, NULL) && !evsel->core.attr.exclude_kernel) return false; } @@ -1053,7 +1053,7 @@ static bool intel_pt_return_compression(struct intel_pt *pt) return true; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config) && + if (intel_pt_get_config(evsel, &config) && (config & pt->noretcomp_bit)) return false; } @@ -1066,7 +1066,7 @@ static bool intel_pt_branch_enable(struct intel_pt *pt) u64 config; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config) && + if (intel_pt_get_config(evsel, &config) && (config & INTEL_PT_CFG_PASS_THRU) && !(config & INTEL_PT_CFG_BRANCH_EN)) return false; @@ -1080,7 +1080,7 @@ static bool intel_pt_disabled_tnt(struct intel_pt *pt) u64 config; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config) && + if (intel_pt_get_config(evsel, &config) && config & INTEL_PT_CFG_TNT_DIS) return true; } @@ -1100,7 +1100,7 @@ static unsigned int intel_pt_mtc_period(struct intel_pt *pt) config >>= 1; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config)) + if (intel_pt_get_config(evsel, &config)) return (config & pt->mtc_freq_bits) >> shift; } return 0; @@ -1118,7 +1118,7 @@ static bool intel_pt_timeless_decoding(struct intel_pt *pt) evlist__for_each_entry(pt->session->evlist, evsel) { if (!(evsel->core.attr.sample_type & PERF_SAMPLE_TIME)) return true; - if (intel_pt_get_config(pt, &evsel->core.attr, &config)) { + if (intel_pt_get_config(evsel, &config)) { if (config & pt->tsc_bit) timeless_decoding = false; else @@ -1133,7 +1133,7 @@ static bool intel_pt_tracing_kernel(struct intel_pt *pt) struct evsel *evsel; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, NULL) && + if (intel_pt_get_config(evsel, NULL) && !evsel->core.attr.exclude_kernel) return true; } @@ -1150,7 +1150,7 @@ static bool intel_pt_have_tsc(struct intel_pt *pt) return false; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config)) { + if (intel_pt_get_config(evsel, &config)) { if (config & pt->tsc_bit) have_tsc = true; else @@ -1166,7 +1166,7 @@ static bool intel_pt_have_mtc(struct intel_pt *pt) u64 config; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config) && + if (intel_pt_get_config(evsel, &config) && (config & pt->mtc_bit)) return true; } @@ -1191,7 +1191,7 @@ static u64 intel_pt_ctl(struct intel_pt *pt) u64 config; evlist__for_each_entry(pt->session->evlist, evsel) { - if (intel_pt_get_config(pt, &evsel->core.attr, &config)) + if (intel_pt_get_config(evsel, &config)) return config; } return 0; @@ -3703,13 +3703,12 @@ static void intel_pt_set_event_name(struct evlist *evlist, u64 id, } } -static struct evsel *intel_pt_evsel(struct intel_pt *pt, - struct evlist *evlist) +static struct evsel *intel_pt_evsel(struct evlist *evlist) { struct evsel *evsel; evlist__for_each_entry(evlist, evsel) { - if (evsel->core.attr.type == pt->pmu_type && evsel->core.ids) + if (evsel__is_aux_event(evsel) && evsel->core.ids) return evsel; } @@ -3720,7 +3719,7 @@ static int intel_pt_synth_events(struct intel_pt *pt, struct perf_session *session) { struct evlist *evlist = session->evlist; - struct evsel *evsel = intel_pt_evsel(pt, evlist); + struct evsel *evsel = intel_pt_evsel(evlist); struct perf_event_attr attr; u64 id; int err; @@ -4219,7 +4218,6 @@ int intel_pt_process_auxtrace_info(union perf_event *event, pt->session = session; pt->machine = &session->machines.host; /* No kvm support */ pt->auxtrace_type = auxtrace_info->type; - pt->pmu_type = auxtrace_info->priv[INTEL_PT_PMU_TYPE]; pt->tc.time_shift = auxtrace_info->priv[INTEL_PT_TIME_SHIFT]; pt->tc.time_mult = auxtrace_info->priv[INTEL_PT_TIME_MULT]; pt->tc.time_zero = auxtrace_info->priv[INTEL_PT_TIME_ZERO];