Re: [PATCH RFC v3 02/12] perf jevents: Add support for system events tables
From: Jiri Olsa
Date: Mon May 11 2020 - 07:01:51 EST
On Thu, May 07, 2020 at 07:57:41PM +0800, John Garry wrote:
SNIP
> + &sys_event_tables);
> + }
> +
> print_events_table_prefix(eventsfp, tblname);
> return 0;
> }
> @@ -1180,7 +1253,6 @@ int main(int argc, char *argv[])
> } else if (rc < 0) {
> /* Make build fail */
> fclose(eventsfp);
> - free_arch_std_events();
> ret = 1;
> goto out_free_mapfile;
> } else if (rc) {
> @@ -1206,27 +1278,31 @@ int main(int argc, char *argv[])
> if (close_table)
> print_events_table_suffix(eventsfp);
>
> - if (!mapfile) {
> - pr_info("%s: No CPU->JSON mapping?\n", prog);
> - goto empty_map;
> + if (mapfile) {
> + if (process_mapfile(eventsfp, mapfile)) {
> + pr_err("%s: Error processing mapfile %s\n", prog,
> + mapfile);
> + /* Make build fail */
> + fclose(eventsfp);
> + ret = 1;
> + }
> + } else {
> + pr_err("%s: No CPU->JSON mapping?\n", prog);
shouldn't we jump to empty_map in here? there still needs to be a
mapfile, right?
jirka
> }
>
> - if (process_mapfile(eventsfp, mapfile)) {
> - pr_info("%s: Error processing mapfile %s\n", prog, mapfile);
> - /* Make build fail */
> + if (process_system_event_tables(eventsfp)) {
> fclose(eventsfp);
> - free_arch_std_events();
> ret = 1;
> }
>
> -
> goto out_free_mapfile;
>
> empty_map:
> fclose(eventsfp);
> create_empty_mapping(output_file);
> - free_arch_std_events();
> out_free_mapfile:
> + free_arch_std_events();
> + free_sys_event_tables();
> free(mapfile);
> return ret;
> }
SNIP