Message ID | 20230302041211.852330-4-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;davidbtadokoro@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Wed, 1 Mar 2023 20:13:03 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-538116920c3so300740977b3.15 for <linux-kernel@vger.kernel.org>; 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 <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Kan Liang <kan.liang@linux.intel.com>, Zhengjun Xing <zhengjun.xing@linux.intel.com>, Ravi Bangoria <ravi.bangoria@amd.com>, Adrian Hunter <adrian.hunter@intel.com>, "Steinar H. Gunderson" <sesse@google.com>, Qi Liu <liuqi115@huawei.com>, Kim Phillips <kim.phillips@amd.com>, Florian Fischer <florian.fischer@muhq.space>, James Clark <james.clark@arm.com>, Suzuki Poulouse <suzuki.poulose@arm.com>, Sean Christopherson <seanjc@google.com>, Leo Yan <leo.yan@linaro.org>, John Garry <john.g.garry@oracle.com>, Kajol Jain <kjain@linux.ibm.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com> Content-Type: text/plain; charset="UTF-8" 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: <linux-kernel.vger.kernel.org> 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?= |
Series |
Better fixes for grouping of events
|
|
Commit Message
Ian Rogers
March 2, 2023, 4:12 a.m. UTC
This allows event parsing to use the evsel__is_aux_event function,
which is important when determining event grouping.
Signed-off-by: Ian Rogers <irogers@google.com>
---
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(-)
Comments
Em Wed, Mar 01, 2023 at 08:12:04PM -0800, Ian Rogers escreveu: > This allows event parsing to use the evsel__is_aux_event function, > which is important when determining event grouping. > > Signed-off-by: Ian Rogers <irogers@google.com> > --- > 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; In this case, can't we do it as: if (intel_pt_pmu == NULL && intel_bts_pmu == NULL) auxtrace__early_init(); To avoid possibly doing the finds again? - Arnaldo > 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); > -- > 2.39.2.722.g9855ee24e9-goog >
On Thu, Mar 2, 2023 at 6:32 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > Em Wed, Mar 01, 2023 at 08:12:04PM -0800, Ian Rogers escreveu: > > This allows event parsing to use the evsel__is_aux_event function, > > which is important when determining event grouping. > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > --- > > 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; > > In this case, can't we do it as: > > if (intel_pt_pmu == NULL && intel_bts_pmu == NULL) > auxtrace__early_init(); > > To avoid possibly doing the finds again? > > - Arnaldo So this code is called after parse events and has the evlist. The early init code is called before parse events so that the aux trace PMUs are flagged for the sake of the is_aux call in evsel__pmu_name, as aux events must be grouped with their different PMU type leader. It won't be possible to combine the calls but I plan to look at restructuring how PMUs are accessed so that searches are less necessary. Thanks, Ian > > 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); > > -- > > 2.39.2.722.g9855ee24e9-goog > > > > -- > > - Arnaldo
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);