lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fcba9459-9a5a-44c9-976a-323a6f4e0429@linaro.org>
Date: Wed, 8 Oct 2025 12:10:08 +0100
From: James Clark <james.clark@...aro.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Thomas Richter <tmricht@...ux.ibm.com>,
 Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 Namhyung Kim <namhyung@...nel.org>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
 Xu Yang <xu.yang_2@....com>, Thomas Falcon <thomas.falcon@...el.com>,
 Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org,
 linux-perf-users@...r.kernel.org, Atish Patra <atishp@...osinc.com>,
 Beeman Strong <beeman@...osinc.com>, Leo Yan <leo.yan@....com>,
 Vince Weaver <vincent.weaver@...ne.edu>
Subject: Re: [PATCH v7 05/27] perf jevents: Support copying the source json
 files to OUTPUT



On 05/10/2025 7:24 pm, Ian Rogers wrote:
> The jevents command expects all json files to be organized under a
> single directory. When generating json files from scripts (to reduce
> laborious copy and paste in the json) we don't want to generate the
> json into the source directory if there is an OUTPUT directory
> specified. This change adds a GEN_JSON for this case where the
> GEN_JSON copies the JSON files to OUTPUT, only when OUTPUT is
> specified. The Makefile.perf clean code is updated to clean up this
> directory when present.
> 
> This patch is part of:
> https://lore.kernel.org/lkml/20240926173554.404411-12-irogers@google.com/
> which was similarly adding support for generating json in scripts for
> the consumption of jevents.py.
> 
> Tested-by: Thomas Richter <tmricht@...ux.ibm.com>
> Signed-off-by: Ian Rogers <irogers@...gle.com>

Hi Ian,

This commit breaks the build on x86 for me, but not Arm. I also had to 
do a clean build when bisecting as it seemed to be sticky in some way.

It fails on the empty pmu events file diff check:

diff -u pmu-events/empty-pmu-events.c 
/home/james/workspace/linux/build/local/pmu-events/test-empty-pmu-events.c 
2> 
/home/james/workspace/linux/build/local/pmu-events/empty-pmu-events.log 
|| (cat 
/home/james/workspace/linux/build/local/pmu-events/empty-pmu-events.log 
&& false)
--- pmu-events/empty-pmu-events.c       2025-10-08 11:49:46.341849139 +0100
+++ 
/home/james/workspace/linux/build/local/pmu-events/test-empty-pmu-events.c 
  2025-10-08 11:54:40.619999115 +0100
@@ -19,239 +19,8 @@
  };

  static const char *const big_c_string =
-/* offset=0 */ "software\000"
...

The output continues with the rest of the diff, but I assume it's not 
important to reproduce the issue.

Thanks
James

> ---
>   tools/perf/Makefile.perf    | 21 ++++++++++++++++-----
>   tools/perf/pmu-events/Build | 18 ++++++++++++------
>   2 files changed, 28 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 7d6ac03a7109..278e51e4b5c6 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1272,9 +1272,24 @@ endif # CONFIG_PERF_BPF_SKEL
>   bpf-skel-clean:
>   	$(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) $(SKEL_OUT)/vmlinux.h
>   
> +pmu-events-clean:
> +ifeq ($(OUTPUT),)
> +	$(call QUIET_CLEAN, pmu-events) $(RM) \
> +		pmu-events/pmu-events.c \
> +		pmu-events/metric_test.log \
> +		pmu-events/test-empty-pmu-events.c \
> +		pmu-events/empty-pmu-events.log
> +else # When an OUTPUT directory is present, clean up the copied pmu-events/arch directory.
> +	$(call QUIET_CLEAN, pmu-events) $(RM) -r $(OUTPUT)pmu-events/arch \
> +		$(OUTPUT)pmu-events/pmu-events.c \
> +		$(OUTPUT)pmu-events/metric_test.log \
> +		$(OUTPUT)pmu-events/test-empty-pmu-events.c \
> +		$(OUTPUT)pmu-events/empty-pmu-events.log
> +endif
> +
>   clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean \
>   		arm64-sysreg-defs-clean fixdep-clean python-clean bpf-skel-clean \
> -		tests-coresight-targets-clean
> +		tests-coresight-targets-clean pmu-events-clean
>   	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive \
>   		$(OUTPUT)perf-iostat $(LANG_BINDINGS)
>   	$(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '*.a' -delete -o \
> @@ -1287,10 +1302,6 @@ clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-clean $(
>   		$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
>   		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
>   		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
> -		$(OUTPUT)pmu-events/pmu-events.c \
> -		$(OUTPUT)pmu-events/test-empty-pmu-events.c \
> -		$(OUTPUT)pmu-events/empty-pmu-events.log \
> -		$(OUTPUT)pmu-events/metric_test.log \
>   		$(OUTPUT)$(fadvise_advice_array) \
>   		$(OUTPUT)$(fsconfig_arrays) \
>   		$(OUTPUT)$(fsmount_arrays) \
> diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
> index 32f387d48908..1503a16e662a 100644
> --- a/tools/perf/pmu-events/Build
> +++ b/tools/perf/pmu-events/Build
> @@ -1,7 +1,6 @@
>   pmu-events-y	+= pmu-events.o
>   JDIR		=  pmu-events/arch/$(SRCARCH)
> -JSON		=  $(shell [ -d $(JDIR) ] &&				\
> -			find $(JDIR) -name '*.json' -o -name 'mapfile.csv')
> +JSON		=  $(shell find pmu-events/arch -name *.json -o -name *.csv)
>   JDIR_TEST	=  pmu-events/arch/test
>   JSON_TEST	=  $(shell [ -d $(JDIR_TEST) ] &&			\
>   			find $(JDIR_TEST) -name '*.json')
> @@ -29,13 +28,20 @@ $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
>   	$(call rule_mkdir)
>   	$(Q)$(call echo-cmd,gen)cp $< $@
>   else
> +# Copy checked-in json for generation.
> +$(OUTPUT)pmu-events/arch/%: pmu-events/arch/%
> +	$(call rule_mkdir)
> +	$(Q)$(call echo-cmd,gen)cp $< $@
> +
> +GEN_JSON = $(patsubst %,$(OUTPUT)%,$(JSON))
> +
>   $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY)
>   	$(call rule_mkdir)
>   	$(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false)
>   
> -$(TEST_EMPTY_PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG)
> +$(TEST_EMPTY_PMU_EVENTS_C): $(GEN_JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG)
>   	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none pmu-events/arch $@
> +	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none $(OUTPUT)pmu-events/arch $@
>   
>   $(EMPTY_PMU_EVENTS_TEST_LOG): $(EMPTY_PMU_EVENTS_C) $(TEST_EMPTY_PMU_EVENTS_C)
>   	$(call rule_mkdir)
> @@ -63,10 +69,10 @@ $(OUTPUT)%.pylint_log: %
>   	$(call rule_mkdir)
>   	$(Q)$(call echo-cmd,test)pylint "$<" > $@ || (cat $@ && rm $@ && false)
>   
> -$(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) \
> +$(PMU_EVENTS_C): $(GEN_JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) \
>       $(EMPTY_PMU_EVENTS_TEST_LOG) $(PMU_EVENTS_MYPY_TEST_LOGS) $(PMU_EVENTS_PYLINT_TEST_LOGS)
>   	$(call rule_mkdir)
> -	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@
> +	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) $(OUTPUT)pmu-events/arch $@
>   endif
>   
>   # pmu-events.c file is generated in the OUTPUT directory so it needs a


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ