From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751709AbeFEGAY (ORCPT ); Tue, 5 Jun 2018 02:00:24 -0400 Received: from mga12.intel.com ([192.55.52.136]:51543 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbeFEGAX (ORCPT ); Tue, 5 Jun 2018 02:00:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,477,1520924400"; d="scan'208";a="46484721" Subject: Re: [PATCH v3]: perf record: enable arbitrary event names thru name= modifier To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Namhyung Kim , Andi Kleen , linux-kernel , linux-perf-users@vger.kernel.org References: <20180604075600.GA10484@krava> <20180604135849.GE3397@kernel.org> <3269ec8e-88b0-8254-6419-da1896c083df@linux.intel.com> <20180604142340.GJ3397@kernel.org> <20180604145844.GL3397@kernel.org> <80a37269-e54d-0992-712a-ee72555a04d4@linux.intel.com> <20180604191659.GM3397@kernel.org> From: Alexey Budankov Message-ID: <34a15f46-0358-930b-4b73-29290d15280f@linux.intel.com> Date: Tue, 5 Jun 2018 09:00:17 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180604191659.GM3397@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 04.06.2018 22:16, Arnaldo Carvalho de Melo wrote: > Em Mon, Jun 04, 2018 at 06:22:43PM +0300, Alexey Budankov escreveu: >> On 04.06.2018 17:58, Arnaldo Carvalho de Melo wrote: >>> Em Mon, Jun 04, 2018 at 05:51:03PM +0300, Alexey Budankov escreveu: >>>> event names quoted there. If such cases were pointed out then they also >>>> could be addressed along with the unit/regression testing mentioned above. > >>> So lests stick to just the unit/regression testing, can you take a look >>> at that? > >> Sure. Is it enough to run perf record with some quoted event name to make >> sure it runs successfully? > > I mentioned tools/perf/tests/attr/, for checking if the perf_event_attr > was setup the way you intended, and tools/perf/tests/parse-events.c, > which probably is what we want here, see, for instance, this cset I've > added recently to have we testing intel_pt event parsing: > > $ git show b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6 > commit b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6 > Author: Arnaldo Carvalho de Melo > Date: Fri May 11 11:48:54 2018 -0300 > > perf tests parse-events: Add intel_pt parse test > > To avoid regressions such as the one fixed by 4a35a9027f64 ("Revert > "perf pmu: Fix pmu events parsing rule""), where '-e intel_pt//u' got > broken, with this new entry in this 'perf tests' subtest, we would have > caught it before pushing upstream. > > Acked-by: Jiri Olsa > Cc: Adrian Hunter > Cc: Alexander Shishkin > Cc: Andi Kleen > Cc: David Ahern > Cc: Jiri Olsa > Cc: Kan Liang > Cc: Namhyung Kim > Cc: Peter Zijlstra > Cc: Wang Nan > Link: https://lkml.kernel.org/n/tip-kw62fys9bwdgsp722so2ln1l@git.kernel.org > Signed-off-by: Arnaldo Carvalho de Melo > > diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c > index 18b06444f230..6829dd416a99 100644 > --- a/tools/perf/tests/parse-events.c > +++ b/tools/perf/tests/parse-events.c > @@ -1309,6 +1309,14 @@ static int test__checkevent_config_cache(struct perf_evlist *evlist) > return 0; > } > > +static int test__intel_pt(struct perf_evlist *evlist) > +{ > + struct perf_evsel *evsel = perf_evlist__first(evlist); > + > + TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0); > + return 0; > +} > + > static int count_tracepoints(void) > { > struct dirent *events_ent; > @@ -1637,6 +1645,11 @@ static struct evlist_test test__events[] = { > .check = test__checkevent_config_cache, > .id = 51, > }, > + { > + .name = "intel_pt//u", > + .check = test__intel_pt, > + .id = 52, > + }, > }; > > static struct evlist_test test__events_pmu[] = { > > See also this one: > > static int > test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist) > { > struct perf_evsel *evsel = perf_evlist__first(evlist); > > TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); > TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); > TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); > TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); > > return test__checkevent_breakpoint_rw(evlist); > } > { > .name = "mem:0/4:rw:u", > .check = test__checkevent_breakpoint_len_rw_modifier, > .id = 44 > }, > > > I.e. have as many TEST_ASSERT_VAL as you need, checking how parsing the > event name ends up setting up the evsel, evlist and perf_event_attr. Ok, I see. But please expect delay in delivery since I am on vacations till 06/18. Thanks, Alexey > > - Arnaldo >