linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Alexei Budankov <abudankov@huawei.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
	Michael Petlan <mpetlan@redhat.com>,
	Ian Rogers <irogers@google.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [BUG] jevents problem when cross building Re: [PATCH 2/3] perf tools: Allow to enable/disable events via control file
Date: Thu, 10 Dec 2020 19:57:26 +0000	[thread overview]
Message-ID: <650baaf2-36b6-a9e2-ff49-963ef864c1f3@huawei.com> (raw)
In-Reply-To: <1a608e92-d0d0-2e5e-ba7e-e9fa2e02b0f9@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 4120 bytes --]

On 10/12/2020 18:27, John Garry wrote:
>> Its unpublished, I'll send it to the tmp.perf/core branch now.
> 
> I use cross-compile for arm64 to build, and it's ok.
> 
> I notice that the failures are for architectures which don't have an 
> entry under pmu-events/arch, so maybe we're missing some 'weak' 
> definition of pmu_sys_event_tables.
> 
> I'll check now.
> 

Hi Arnaldo,

Can you try this on top:

----8<-----

 From 201aa2cb7bc8723765afd84a5d3972248af0f0a1 Mon Sep 17 00:00:00 2001
From: John Garry <john.garry@huawei.com>
Date: Thu, 10 Dec 2020 19:45:14 +0000
Subject: [PATCH] perf jevents: Add system events table for empty mapping

For architectures which have no PMU event lists - like arm32 - an empty
mapping table is printed. This is how the "pmu_events_map" symbol -
referenced in util/pmu.c::perf_pmu__find_map() - is created for those
architectures.

Since pmu-events.c now includes a new table - "pmu_sys_event_tables" -
which is also referenced from util/pmu.c, also add this for the empty
mappings.

Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/tools/perf/pmu-events/jevents.c 
b/tools/perf/pmu-events/jevents.c
index e930096ad713..28e20d9ec0f5 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -816,19 +816,30 @@ static void print_mapping_test_table(FILE *outfp)
  	fprintf(outfp, "},\n");
  }

+static void print_system_event_mapping_table_prefix(FILE *outfp)
+{
+	fprintf(outfp, "\nstruct pmu_sys_events pmu_sys_event_tables[] = {");
+}
+
+static void print_system_event_mapping_table_suffix(FILE *outfp)
+{
+	fprintf(outfp, "\n\t{\n\t\t.table = 0\n\t},");
+
+	fprintf(outfp, "\n};\n");
+}
+
  static int process_system_event_tables(FILE *outfp)
  {
  	struct sys_event_table *sys_event_table;

-	fprintf(outfp, "\nstruct pmu_sys_events pmu_sys_event_tables[] = {");
+	print_system_event_mapping_table_prefix(outfp);

  	list_for_each_entry(sys_event_table, &sys_event_tables, list) {
  		fprintf(outfp, "\n\t{\n\t\t.table = %s,\n\t},",
  			sys_event_table->soc_id);
  	}
-	fprintf(outfp, "\n\t{\n\t\t.table = 0\n\t},");

-	fprintf(outfp, "\n};\n");
+	print_system_event_mapping_table_suffix(outfp);

  	return 0;
  }
@@ -938,6 +949,9 @@ static void create_empty_mapping(const char 
*output_file)
  	fprintf(outfp, "#include \"pmu-events/pmu-events.h\"\n");
  	print_mapping_table_prefix(outfp);
  	print_mapping_table_suffix(outfp);
+	print_system_event_mapping_table_prefix(outfp);
+	print_system_event_mapping_table_suffix(outfp);
+
  	fclose(outfp);
  }

---->8----

Obviously I never tested building for one of test architectures which 
does not use PMU events - sorry!

I'll review this more tomorrow.

Thanks!


> 
>>
>> More results from testing:
>>
>>    59    13.57 ubuntu:16.04-x-arm            : FAIL 
>> arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 
>> 20160609
>>
>> [perfbuilder@five ~]$ tail -20 dm.log/ubuntu\:16.04-x-arm
>>    CC       /tmp/build/perf/util/expr.o
>>    LD       /tmp/build/perf/util/intel-pt-decoder/perf-in.o
>>    LD       /tmp/build/perf/util/perf-in.o
>>    LD       /tmp/build/perf/perf-in.o
>>    LINK     /tmp/build/perf/perf
>> /tmp/build/perf/perf-in.o: In function `pmu_for_each_sys_event':
>> /git/linux/tools/perf/util/pmu.c:816: undefined reference to 
>> `pmu_sys_event_tables'
>> /git/linux/tools/perf/util/pmu.c:816: undefined reference to 
>> `pmu_sys_event_tables'
>> /tmp/build/perf/perf-in.o: In function `pmu_add_sys_aliases':
>> /git/linux/tools/perf/util/pmu.c:886: undefined reference to 
>> `pmu_sys_event_tables'
>> /git/linux/tools/perf/util/pmu.c:886: undefined reference to 
>> `pmu_sys_event_tables'
>> collect2: error: ld returned 1 exit status
>> Makefile.perf:659: recipe for target '/tmp/build/perf/perf' failed
>> make[2]: *** [/tmp/build/perf/perf] Error 1
>> Makefile.perf:232: recipe for target 'sub-make' failed
>> make[1]: *** [sub-make] Error 2
>> Makefile:69: recipe for target 'all' failed
>> make: *** [all] Error 2
>> make: Leaving directory '/git/linux/tools/perf'
>> + exit 1 


[-- Attachment #2: 0001-perf-jevents-Add-system-events-table-for-empty-mappi.patch --]
[-- Type: text/plain, Size: 2120 bytes --]

From 201aa2cb7bc8723765afd84a5d3972248af0f0a1 Mon Sep 17 00:00:00 2001
From: John Garry <john.garry@huawei.com>
Date: Thu, 10 Dec 2020 19:45:14 +0000
Subject: [PATCH] perf jevents: Add system events table for empty mapping

For architectures which have no PMU event lists - like arm32 - an empty
mapping table is printed. This is how the "pmu_events_map" symbol -
referenced in util/pmu.c::perf_pmu__find_map() - is created for those
architectures.

Since pmu-events.c now includes a new table - "pmu_sys_event_tables" -
which is also referenced from util/pmu.c, also add this for the empty
mappings.

Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index e930096ad713..28e20d9ec0f5 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -816,19 +816,30 @@ static void print_mapping_test_table(FILE *outfp)
 	fprintf(outfp, "},\n");
 }
 
+static void print_system_event_mapping_table_prefix(FILE *outfp)
+{
+	fprintf(outfp, "\nstruct pmu_sys_events pmu_sys_event_tables[] = {");
+}
+
+static void print_system_event_mapping_table_suffix(FILE *outfp)
+{
+	fprintf(outfp, "\n\t{\n\t\t.table = 0\n\t},");
+
+	fprintf(outfp, "\n};\n");
+}
+
 static int process_system_event_tables(FILE *outfp)
 {
 	struct sys_event_table *sys_event_table;
 
-	fprintf(outfp, "\nstruct pmu_sys_events pmu_sys_event_tables[] = {");
+	print_system_event_mapping_table_prefix(outfp);
 
 	list_for_each_entry(sys_event_table, &sys_event_tables, list) {
 		fprintf(outfp, "\n\t{\n\t\t.table = %s,\n\t},",
 			sys_event_table->soc_id);
 	}
-	fprintf(outfp, "\n\t{\n\t\t.table = 0\n\t},");
 
-	fprintf(outfp, "\n};\n");
+	print_system_event_mapping_table_suffix(outfp);
 
 	return 0;
 }
@@ -938,6 +949,9 @@ static void create_empty_mapping(const char *output_file)
 	fprintf(outfp, "#include \"pmu-events/pmu-events.h\"\n");
 	print_mapping_table_prefix(outfp);
 	print_mapping_table_suffix(outfp);
+	print_system_event_mapping_table_prefix(outfp);
+	print_system_event_mapping_table_suffix(outfp);
+
 	fclose(outfp);
 }
 
-- 
2.26.2


  reply	other threads:[~2020-12-10 19:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 17:05 [PATCH 0/3] perf tools: Allow to enable/disable events via control pipe Jiri Olsa
2020-12-06 17:05 ` [PATCH 1/3] perf tools: Add evlist__disable_evsel/evlist__enable_evsel Jiri Olsa
2020-12-07 17:12   ` Alexei Budankov
2020-12-06 17:05 ` [PATCH 2/3] perf tools: Allow to enable/disable events via control file Jiri Olsa
2020-12-07 17:02   ` Alexei Budankov
2020-12-10 16:24     ` Jiri Olsa
2020-12-10 17:15       ` Arnaldo Carvalho de Melo
2020-12-10 17:19         ` Arnaldo Carvalho de Melo
2020-12-10 17:26           ` [BUG] jevents problem when cross building " Arnaldo Carvalho de Melo
2020-12-10 17:44             ` John Garry
2020-12-10 18:17               ` Arnaldo Carvalho de Melo
2020-12-10 18:27                 ` John Garry
2020-12-10 19:57                   ` John Garry [this message]
2020-12-16 11:41                     ` John Garry
2020-12-16 14:01                       ` Arnaldo Carvalho de Melo
2020-12-10 18:06       ` Jiri Olsa
2020-12-10 18:20         ` Alexei Budankov
2020-12-10 18:27           ` Arnaldo Carvalho de Melo
2020-12-10 18:32           ` Alexei Budankov
2020-12-06 17:05 ` [PATCH 3/3] perf tools: Allow to list " Jiri Olsa
2020-12-07 16:28   ` Arnaldo Carvalho de Melo
2020-12-07 17:09     ` Alexei Budankov
2020-12-07 19:53       ` Jiri Olsa
2020-12-07 19:51     ` Jiri Olsa
2020-12-07 13:25 ` [PATCH 0/3] perf tools: Allow to enable/disable events via control pipe Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=650baaf2-36b6-a9e2-ff49-963ef864c1f3@huawei.com \
    --to=john.garry@huawei.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=abudankov@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).