From patchwork Thu Mar 2 04:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 63191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4033198wrd; Wed, 1 Mar 2023 20:15:00 -0800 (PST) X-Google-Smtp-Source: AK7set8q9Zpkf7vnvA60afV2eshko++q/vm8ol5ADIYr8pj6i0bGMVyVuNoF3tAI3N4Vh1p4LVUW X-Received: by 2002:a17:90b:3a87:b0:237:161e:33bc with SMTP id om7-20020a17090b3a8700b00237161e33bcmr10096164pjb.16.1677730500486; Wed, 01 Mar 2023 20:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677730500; cv=none; d=google.com; s=arc-20160816; b=rNCwfZcchjUJFyqESYILl6a0KmvROwy4HLappWoKnWStia7JGhST3DVsUzQ3a/Yj+o q8qpYJn5QxRs+TDUcoVqzHlhQPHfd31+31VgeCU5QE4U1Hu9zV5nqnZabtLmbOAtkWQY lQ3M1XxmTjxybrQ7fagdsNq96RrzbIfps5n9wnxgHHwnNMfykeBbmTaPjxa5ypv8YiKc M/D+rkiP7L+VQnpB+F3OtNU5Ci3abaAh37JXDAiSIOrGSq7jXFGdbIZypHJm3yyMBCMV hj7HLLSPK++LI3lVAOVliCykq/ZakkocmMH8iemFh5I2XWmG/qTD+jrd9jyhUrjk0O99 St1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=6p++g9ByZAXMS3Dvltn2JIvavdr7joQqdokiBOJiUtQ=; b=rD/Mg0saHLFy6MM9horzNBhiIKIMkuiN8YhLpPNhcdyDFRDq9741xdDdwImO0XGKLv Ofbs5rvah8ErW+D2T4HaxB4kXkm9sTTB2Z9gvprkLLGgviEWrMd4rRzptdno75TEUbt9 P/4U9JSYo+hWyB6QX1OgwEVCrzRKiXkZjn688WKKx4zS/+V7aqlDSDHD1N844/LGD7V0 Ej5zFWIRtIL970Sl1kjJI0cs6DoyyKk5QY/gPIFUE7um9zUvFjkS2fI6wn4lWdUYGpVj RW64DIfzRhSOi3VFD32lli6q+J0b8j3wGaqBYnNEavMeWVYlZ3liTM4qt+6h4u5opnLX UZYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qhQeVnOH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a17090adc8200b0022c0049ab90si1310006pjv.95.2023.03.01.20.14.46; Wed, 01 Mar 2023 20:15:00 -0800 (PST) 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=@google.com header.s=20210112 header.b=qhQeVnOH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbjCBENQ (ORCPT + 99 others); Wed, 1 Mar 2023 23:13:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbjCBENG (ORCPT ); Wed, 1 Mar 2023 23:13:06 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C41D62ED71 for ; Wed, 1 Mar 2023 20:13:03 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-538116920c3so300740977b3.15 for ; Wed, 01 Mar 2023 20:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1677730379; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=6p++g9ByZAXMS3Dvltn2JIvavdr7joQqdokiBOJiUtQ=; b=qhQeVnOHT2BT7pic+pk3JZ4w8BJBvzwsXc7rELny5/AvmuDbl8L8m/9wQdEZbB/mor y8TyENCjW7SElSN8lQsKc2GZw71FtlNTvsy20UTGRX+aQuD0Lpbjie2oCldNDKOJPUkP AqnEiJKnc4uCb1wxgEoqDX/E7yf+aSVGur0xN8NGX08f5tMIUldUVoYEAWsdADKukm5o AGp8dZr13hJp/9qHX77kLUed1YdGKRCAws+HL0VtaqjqYhTGUP289mhg6q1hE9q8nQYv q1AGAvSSqvodsspwbFCfCMr7RXv0V2W19Xb8csNp2n9OLoxwp+qkTcwWPxBUZRnxC98x Sp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677730379; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6p++g9ByZAXMS3Dvltn2JIvavdr7joQqdokiBOJiUtQ=; b=UriY3I3HPc3zTM9HvoyGWD7G0q4Tb6id5YZkr+vQXjZuxHWFZPhxv9WQTxxss5Eqba 7cTvipYZvj9KBQw/omiIOyn4FmHzuJHaellsE//rG23Y9RfkcH62VCEzbybJL5zW5QMg /t9T3pR9vOYnxZSTlaUUZvWUNdBw0OCOOwHA8eN6Xsnip7cNCevbS7Ztmr6un8RSel6L q9STDHHO5aQKL+gJrJVF2pZyApPthPz9nhaoodqO+6CV5B4Iz5v3hM+g2qlJZK5TwNQn YvIPE7xSyrM8ihbzO0plE67Y++esvH3bd2WHe23Ys7td2uXpYfAwtRjFA6QDREl1A/ky Vggg== X-Gm-Message-State: AO0yUKXYjXNzQa7YkyScbHQitD7JXrIddDAkfkSymh4t9QTAcgD84Krg bp3+pjJxW8wCUXKyCgW6F2bt2wbuMaI7 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:bdf9:f5cb:d05:c4d5]) (user=irogers job=sendgmr) by 2002:a25:8c0b:0:b0:a20:11a9:bd4a with SMTP id k11-20020a258c0b000000b00a2011a9bd4amr3801540ybl.0.1677730378917; Wed, 01 Mar 2023 20:12:58 -0800 (PST) Date: Wed, 1 Mar 2023 20:12:04 -0800 In-Reply-To: <20230302041211.852330-1-irogers@google.com> Message-Id: <20230302041211.852330-4-irogers@google.com> Mime-Version: 1.0 References: <20230302041211.852330-1-irogers@google.com> X-Mailer: git-send-email 2.39.2.722.g9855ee24e9-goog Subject: [PATCH v1 03/10] perf record: Early auxtrace initialization before event parsing From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kan Liang , Zhengjun Xing , Ravi Bangoria , Adrian Hunter , "Steinar H. Gunderson" , Qi Liu , Kim Phillips , Florian Fischer , James Clark , Suzuki Poulouse , Sean Christopherson , Leo Yan , John Garry , Kajol Jain , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759227937337543597?= X-GMAIL-MSGID: =?utf-8?q?1759227937337543597?= This allows event parsing to use the evsel__is_aux_event function, which is important when determining event grouping. Signed-off-by: Ian Rogers --- tools/perf/arch/x86/util/auxtrace.c | 17 +++++++++++++---- tools/perf/builtin-record.c | 6 ++++++ tools/perf/util/auxtrace.h | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c index 3da506e13f49..de1e4842ea2e 100644 --- a/tools/perf/arch/x86/util/auxtrace.c +++ b/tools/perf/arch/x86/util/auxtrace.c @@ -15,6 +15,19 @@ #include "../../../util/intel-bts.h" #include "../../../util/evlist.h" +void auxtrace__early_init(void) +{ + struct perf_pmu *intel_pt_pmu; + struct perf_pmu *intel_bts_pmu; + + intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME); + if (intel_pt_pmu) + intel_pt_pmu->auxtrace = true; + intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME); + if (intel_bts_pmu) + intel_bts_pmu->auxtrace = true; +} + static struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist, int *err) @@ -26,11 +39,7 @@ struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist, bool found_bts = false; intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME); - if (intel_pt_pmu) - intel_pt_pmu->auxtrace = true; intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME); - if (intel_bts_pmu) - intel_bts_pmu->auxtrace = true; evlist__for_each_entry(evlist, evsel) { if (intel_pt_pmu && evsel->core.attr.type == intel_pt_pmu->type) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8374117e66f6..a0870c076dc0 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -3940,6 +3940,10 @@ static int record__init_thread_masks(struct record *rec) return ret; } +__weak void auxtrace__early_init(void) +{ +} + int cmd_record(int argc, const char **argv) { int err; @@ -3985,6 +3989,8 @@ int cmd_record(int argc, const char **argv) if (err) return err; + auxtrace__early_init(); + argc = parse_options(argc, argv, record_options, record_usage, PARSE_OPT_STOP_AT_NON_OPTION); if (quiet) diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h index 29eb82dff574..49a86aa6ac94 100644 --- a/tools/perf/util/auxtrace.h +++ b/tools/perf/util/auxtrace.h @@ -457,6 +457,8 @@ struct addr_filters { struct auxtrace_cache; +void auxtrace__early_init(void); + #ifdef HAVE_AUXTRACE_SUPPORT u64 compat_auxtrace_mmap__read_head(struct auxtrace_mmap *mm);