Re: [PATCH] perf jevents: Fix sys_event_tables to be freed like arch_std_events

From: John Garry
Date: Tue Sep 28 2021 - 09:29:09 EST


On 28/09/2021 14:22, Arnaldo Carvalho de Melo wrote:
jevents-y += json.o jsmn.o jevents.o
-HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
+HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include -Wall -Wextra
pmu-events-y += pmu-events.o
JDIR = pmu-events/arch/$(SRCARCH)
JSON = $(shell [ -d $(JDIR) ] && \
⬢[acme@toolbox perf]$

I get this before applying Xu's patch:

LINK /tmp/build/perf/libbpf.a
pmu-events/jevents.c: In function ‘save_arch_std_events’:
pmu-events/jevents.c:473:39: warning: unused parameter ‘data’ [-Wunused-parameter]
473 | static int save_arch_std_events(void *data, struct json_event *je)
| ~~~~~~^~~~
At top level:
pmu-events/jevents.c:93:13: warning: ‘free_sys_event_tables’ defined but not used [-Wunused-function]
93 | static void free_sys_event_tables(void)
| ^~~~~~~~~~~~~~~~~~~~~


-------------------------------------

I'll add this to perf/core, as this isn't a strict fix, so can wait for
v5.16.

Hi Arnaldo,

OK, would you also consider reusing CFLAGS:

--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -9,10 +9,12 @@ JSON = $(shell [ -d $(JDIR) ] && \
JDIR_TEST = pmu-events/arch/test
JSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \
find $(JDIR_TEST) -name '*.json')
-
+HOSTCFLAGS_jevents += $(CFLAGS)

I tried it, and there are more things to fix for jevents.o. Let me know your preference and if any help required to fix any errors up.

Thanks!