Skip to contentSkip to conversation

Move some more header copies to tools/perf/trace/beauty/

PATCH In review Arnaldo Carvalho de Melo 2 participants 6 messages Mar 14, 2024 1 message not in the archive perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

cover Move some more header copies to tools/perf/trace/beauty/

From: Arnaldo Carvalho de Melo <[email protected]>

Hi,

Move a few more files that is used just by scrappers.

- Arnaldo

Arnaldo Carvalho de Melo (3):
perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory
used to build perf
perf beauty: Move uapi/sound/asound.h copy out of the directory used
to build perf
perf beauty: Move arch/x86/include/asm/irq_vectors.h copy out of the
directory used to build perf

 tools/perf/Makefile.perf                      | 19 +++++++++++--------
 tools/perf/check-headers.sh                   |  6 +++---
 .../arch/x86/include/asm/irq_vectors.h        |  0
 .../beauty}/include/uapi/linux/usbdevice_fs.h |  0
 .../trace/beauty}/include/uapi/sound/asound.h |  0
 tools/perf/trace/beauty/sndrv_ctl_ioctl.sh    |  4 ++--
 tools/perf/trace/beauty/sndrv_pcm_ioctl.sh    |  4 ++--
 .../beauty/tracepoints/x86_irq_vectors.sh     |  6 +++---
 tools/perf/trace/beauty/usbdevfs_ioctl.sh     |  6 +++---
 9 files changed, 24 insertions(+), 21 deletions(-)
 rename tools/{ => perf/trace/beauty}/arch/x86/include/asm/irq_vectors.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/sound/asound.h (100%)
Signature · 1 line
2.43.2
author maintainer
#1 lore raw

PATCH 1/3 perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory used to build perf

From: Arnaldo Carvalho de Melo <[email protected]>

It is mostly used only to generate string tables, not to build perf, so move it to the tools/perf/trace/beauty/include/ hierarchy, that is used just for scrapping.

This is a something that should've have happened, as happened with the linux/socket.h scrapper, do it now as Ian suggested while doing an audit/refactor session in the headers used by perf.

No other tools/ living code uses it, just <linux/usbdevice_fs.h> coming from either 'make install_headers' or from the system /usr/include/ directory.

---
 tools/perf/Makefile.perf                                    | 4 ++--
 tools/perf/check-headers.sh                                 | 2 +-
 .../trace/beauty}/include/uapi/linux/usbdevice_fs.h         | 0
 tools/perf/trace/beauty/usbdevfs_ioctl.sh                   | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)
 rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
tools/perf/Makefile.perf +2 -2
index 523c3b7d6c9d3f51..53ec3765b4b2bd1b 100644
@@ -623,8 +623,8 @@ $(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl)
 usbdevfs_ioctl_array := $(beauty_ioctl_outdir)/usbdevfs_ioctl_array.c
 usbdevfs_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/usbdevfs_ioctl.sh
 
-$(usbdevfs_ioctl_array): $(linux_uapi_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
-	$(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(linux_uapi_dir) > $@
+$(usbdevfs_ioctl_array): $(beauty_uapi_linux_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
+	$(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(beauty_uapi_linux_dir) > $@
 
 x86_arch_prctl_code_array := $(beauty_outdir)/x86_arch_prctl_code_array.c
 x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh
tools/perf/check-headers.sh +1 -1
index c2c26d6b87ef52f9..356ddb76a9541018 100755
@@ -21,7 +21,6 @@ FILES=(
   "include/uapi/linux/sched.h"
   "include/uapi/linux/seccomp.h"
   "include/uapi/linux/stat.h"
-  "include/uapi/linux/usbdevice_fs.h"
   "include/uapi/linux/vhost.h"
   "include/uapi/sound/asound.h"
   "include/linux/bits.h"
@@ -98,6 +97,7 @@ BEAUTY_FILES=(
   "include/linux/socket.h"
   "include/uapi/linux/fs.h"
   "include/uapi/linux/mount.h"
+  "include/uapi/linux/usbdevice_fs.h"
 )
 
 declare -a FAILURES
tools/perf/trace/beauty/include/uapi/linux/usbdevice_fs.h renamed from tools/include/uapi/linux/usbdevice_fs.h +0 -0
similarity index 100%
rename from tools/include/uapi/linux/usbdevice_fs.h
rename to tools/perf/trace/beauty/include/uapi/linux/usbdevice_fs.h
tools/perf/trace/beauty/usbdevfs_ioctl.sh +3 -3
index b39cfb3720b80624..12a30a9a8e0c8f44 100755
@@ -1,21 +1,21 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1
 
-[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
+[ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
 
 # also as:
 # #define USBDEVFS_CONNINFO_EX(len)  _IOC(_IOC_READ, 'U', 32, len)
 
 printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
-grep -E "$regex" ${header_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \
+grep -E "$regex" ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \
 	sed -r "s/$regex/\4 \1/g"	| \
 	sort | xargs printf "\t[%s] = \"%s\",\n"
 printf "};\n\n"
 printf "#if 0\n"
 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
-grep -E $regex ${header_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \
+grep -E $regex ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \
 	sed -r "s/$regex/\2 \1/g"	| \
 	sort | xargs printf "\t[%s] = \"%s\",\n"
 printf "};\n"
Signature · 1 line
2.43.2
author maintainer
#2 lore raw

PATCH 2/3 perf beauty: Move uapi/sound/asound.h copy out of the directory used to build perf

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

It is used only to generate string tables, not to build perf, so move it to the tools/perf/trace/beauty/include/ hierarchy, that is used just for scrapping.

This is a something that should've have happened, as happened with the linux/socket.h scrapper, do it now as Ian suggested while doing an audit/refactor session in the headers used by perf.

---
 tools/perf/Makefile.perf                                 | 9 +++++----
 tools/perf/check-headers.sh                              | 2 +-
 .../{ => perf/trace/beauty}/include/uapi/sound/asound.h  | 0
 tools/perf/trace/beauty/sndrv_ctl_ioctl.sh               | 4 ++--
 tools/perf/trace/beauty/sndrv_pcm_ioctl.sh               | 4 ++--
 5 files changed, 10 insertions(+), 9 deletions(-)
 rename tools/{ => perf/trace/beauty}/include/uapi/sound/asound.h (100%)
tools/perf/Makefile.perf +5 -4
index 53ec3765b4b2bd1b..757777d968602ded 100644
@@ -473,6 +473,7 @@ arm64-sysreg-defs-clean:
 
 beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/
 beauty_uapi_linux_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/linux/
+beauty_uapi_sound_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/sound/
 linux_uapi_dir := $(srctree)/tools/include/uapi/linux
 asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic
 arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/
@@ -526,15 +527,15 @@ sndrv_ctl_ioctl_array := $(beauty_ioctl_outdir)/sndrv_ctl_ioctl_array.c
 sndrv_ctl_hdr_dir := $(srctree)/tools/include/uapi/sound
 sndrv_ctl_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_ctl_ioctl.sh
 
-$(sndrv_ctl_ioctl_array): $(sndrv_ctl_hdr_dir)/asound.h $(sndrv_ctl_ioctl_tbl)
-	$(Q)$(SHELL) '$(sndrv_ctl_ioctl_tbl)' $(sndrv_ctl_hdr_dir) > $@
+$(sndrv_ctl_ioctl_array): $(beauty_uapi_sound_dir)/asound.h $(sndrv_ctl_ioctl_tbl)
+	$(Q)$(SHELL) '$(sndrv_ctl_ioctl_tbl)' $(beauty_uapi_sound_dir) > $@
 
 sndrv_pcm_ioctl_array := $(beauty_ioctl_outdir)/sndrv_pcm_ioctl_array.c
 sndrv_pcm_hdr_dir := $(srctree)/tools/include/uapi/sound
 sndrv_pcm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/sndrv_pcm_ioctl.sh
 
-$(sndrv_pcm_ioctl_array): $(sndrv_pcm_hdr_dir)/asound.h $(sndrv_pcm_ioctl_tbl)
-	$(Q)$(SHELL) '$(sndrv_pcm_ioctl_tbl)' $(sndrv_pcm_hdr_dir) > $@
+$(sndrv_pcm_ioctl_array): $(beauty_uapi_sound_dir)/asound.h $(sndrv_pcm_ioctl_tbl)
+	$(Q)$(SHELL) '$(sndrv_pcm_ioctl_tbl)' $(beauty_uapi_sound_dir) > $@
 
 kcmp_type_array := $(beauty_outdir)/kcmp_type_array.c
 kcmp_hdr_dir := $(srctree)/tools/include/uapi/linux/
tools/perf/check-headers.sh +1 -1
index 356ddb76a9541018..93ad7a787a19d550 100755
@@ -22,7 +22,6 @@ FILES=(
   "include/uapi/linux/seccomp.h"
   "include/uapi/linux/stat.h"
   "include/uapi/linux/vhost.h"
-  "include/uapi/sound/asound.h"
   "include/linux/bits.h"
   "include/vdso/bits.h"
   "include/linux/const.h"
@@ -98,6 +97,7 @@ BEAUTY_FILES=(
   "include/uapi/linux/fs.h"
   "include/uapi/linux/mount.h"
   "include/uapi/linux/usbdevice_fs.h"
+  "include/uapi/sound/asound.h"
 )
 
 declare -a FAILURES
tools/perf/trace/beauty/include/uapi/sound/asound.h renamed from tools/include/uapi/sound/asound.h +0 -0
similarity index 100%
rename from tools/include/uapi/sound/asound.h
rename to tools/perf/trace/beauty/include/uapi/sound/asound.h
tools/perf/trace/beauty/sndrv_ctl_ioctl.sh +2 -2
index e0803b9575932420..572939a1288455a4 100755
@@ -1,9 +1,9 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1
 
-[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/sound/
+[ $# -eq 1 ] && beauty_uapi_sound_dir=$1 || beauty_uapi_sound_dir=tools/perf/trace/beauty/include/uapi/sound/
 
 printf "static const char *sndrv_ctl_ioctl_cmds[] = {\n"
-grep "^#define[\t ]\+SNDRV_CTL_IOCTL_" $header_dir/asound.h | \
+grep "^#define[\t ]\+SNDRV_CTL_IOCTL_" $beauty_uapi_sound_dir/asound.h | \
 	sed -r 's/^#define +SNDRV_CTL_IOCTL_([A-Z0-9_]+)[\t ]+_IO[RW]*\( *.U., *(0x[[:xdigit:]]+),?.*/\t[\2] = \"\1\",/g'
 printf "};\n"
tools/perf/trace/beauty/sndrv_pcm_ioctl.sh +2 -2
index 7a464a7bf91399bf..33afae9a1c07ca5e 100755
@@ -1,9 +1,9 @@
 #!/bin/sh
 # SPDX-License-Identifier: LGPL-2.1
 
-[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/sound/
+[ $# -eq 1 ] && beauty_uapi_sound_dir=$1 || beauty_uapi_sound_dir=tools/perf/trace/beauty/include/uapi/sound/
 
 printf "static const char *sndrv_pcm_ioctl_cmds[] = {\n"
-grep "^#define[\t ]\+SNDRV_PCM_IOCTL_" $header_dir/asound.h | \
+grep "^#define[\t ]\+SNDRV_PCM_IOCTL_" $beauty_uapi_sound_dir/asound.h | \
 	sed -r 's/^#define +SNDRV_PCM_IOCTL_([A-Z0-9_]+)[\t ]+_IO[RW]*\( *.A., *(0x[[:xdigit:]]+),?.*/\t[\2] = \"\1\",/g'
 printf "};\n"
Signature · 1 line
2.43.2
author maintainer
#3 lore raw

PATCH 3/3 perf beauty: Move arch/x86/include/asm/irq_vectors.h copy out of the directory used to build perf

In reply to Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

It is used only to generate string tables, not to build perf, so move it to the tools/perf/trace/beauty/include/ hierarchy, that is used just for scrapping.

This is a something that should've have happened, as happened with the linux/socket.h scrapper, do it now as Ian suggested while doing an audit/refactor session in the headers used by perf.

No other tools/ living code uses it.

---
 tools/perf/Makefile.perf                                    | 6 ++++--
 tools/perf/check-headers.sh                                 | 2 +-
 .../trace/beauty}/arch/x86/include/asm/irq_vectors.h        | 0
 tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh      | 6 +++---
 4 files changed, 8 insertions(+), 6 deletions(-)
 rename tools/{ => perf/trace/beauty}/arch/x86/include/asm/irq_vectors.h (100%)
tools/perf/Makefile.perf +4 -2
index 757777d968602ded..c75342b21089fc6f 100644
@@ -474,6 +474,8 @@ arm64-sysreg-defs-clean:
 beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/
 beauty_uapi_linux_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/linux/
 beauty_uapi_sound_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/sound/
+beauty_arch_asm_dir := $(srctree)/tools/perf/trace/beauty/arch/x86/include/asm/
+
 linux_uapi_dir := $(srctree)/tools/include/uapi/linux
 asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic
 arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/
@@ -636,8 +638,8 @@ $(x86_arch_prctl_code_array): $(x86_arch_asm_uapi_dir)/prctl.h $(x86_arch_prctl_
 x86_arch_irq_vectors_array := $(beauty_outdir)/x86_arch_irq_vectors_array.c
 x86_arch_irq_vectors_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh
 
-$(x86_arch_irq_vectors_array): $(x86_arch_asm_dir)/irq_vectors.h $(x86_arch_irq_vectors_tbl)
-	$(Q)$(SHELL) '$(x86_arch_irq_vectors_tbl)' $(x86_arch_asm_dir) > $@
+$(x86_arch_irq_vectors_array): $(beauty_arch_asm_dir)/irq_vectors.h $(x86_arch_irq_vectors_tbl)
+	$(Q)$(SHELL) '$(x86_arch_irq_vectors_tbl)' $(beauty_arch_asm_dir) > $@
 
 x86_arch_MSRs_array := $(beauty_outdir)/x86_arch_MSRs_array.c
 x86_arch_MSRs_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_msr.sh
tools/perf/check-headers.sh +1 -1
index 93ad7a787a19d550..b35eba5e99c8d91f 100755
@@ -34,7 +34,6 @@ FILES=(
   "arch/x86/include/asm/cpufeatures.h"
   "arch/x86/include/asm/inat_types.h"
   "arch/x86/include/asm/emulate_prefix.h"
-  "arch/x86/include/asm/irq_vectors.h"
   "arch/x86/include/asm/msr-index.h"
   "arch/x86/include/uapi/asm/prctl.h"
   "arch/x86/lib/x86-opcode-map.txt"
@@ -93,6 +92,7 @@ SYNC_CHECK_FILES=(
 
 declare -a BEAUTY_FILES
 BEAUTY_FILES=(
+  "arch/x86/include/asm/irq_vectors.h"
   "include/linux/socket.h"
   "include/uapi/linux/fs.h"
   "include/uapi/linux/mount.h"
tools/perf/trace/beauty/arch/x86/include/asm/irq_vectors.h renamed from tools/arch/x86/include/asm/irq_vectors.h +0 -0
similarity index 100%
rename from tools/arch/x86/include/asm/irq_vectors.h
rename to tools/perf/trace/beauty/arch/x86/include/asm/irq_vectors.h
tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh +3 -3
index 87dc68c7de0c297e..d8e927dd2bb75c41 100755
@@ -3,12 +3,12 @@
 # (C) 2019, Arnaldo Carvalho de Melo <[email protected]>
 
 if [ $# -ne 1 ] ; then
-	arch_x86_header_dir=tools/arch/x86/include/asm/
+	beauty_arch_asm_dir=tools/perf/trace/beauty/arch/x86/include/asm/
 else
-	arch_x86_header_dir=$1
+	beauty_arch_asm_dir=$1
 fi
 
-x86_irq_vectors=${arch_x86_header_dir}/irq_vectors.h
+x86_irq_vectors=${beauty_arch_asm_dir}/irq_vectors.h
 
 # FIRST_EXTERNAL_VECTOR is not that useful, find what is its number
 # and then replace whatever is using it and that is useful, which at
Signature · 1 line
2.43.2
reviewer
#4 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 6 lines · Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Hi,

Move a few more files that is used just by scrappers.

Thanks Arnaldo! A nit, could you change s/scrapp/scrap/g in the commit messages - scrapping is throwing away, you mean scraping :-)

Ian

Quoted 27 lines

- Arnaldo

Arnaldo Carvalho de Melo (3):
perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory
used to build perf
perf beauty: Move uapi/sound/asound.h copy out of the directory used
to build perf
perf beauty: Move arch/x86/include/asm/irq_vectors.h copy out of the
directory used to build perf

 tools/perf/Makefile.perf                      | 19 +++++++++++--------
 tools/perf/check-headers.sh                   |  6 +++---
 .../arch/x86/include/asm/irq_vectors.h        |  0
 .../beauty}/include/uapi/linux/usbdevice_fs.h |  0
 .../trace/beauty}/include/uapi/sound/asound.h |  0
 tools/perf/trace/beauty/sndrv_ctl_ioctl.sh    |  4 ++--
 tools/perf/trace/beauty/sndrv_pcm_ioctl.sh    |  4 ++--
 .../beauty/tracepoints/x86_irq_vectors.sh     |  6 +++---
 tools/perf/trace/beauty/usbdevfs_ioctl.sh     |  6 +++---
 9 files changed, 24 insertions(+), 21 deletions(-)
 rename tools/{ => perf/trace/beauty}/arch/x86/include/asm/irq_vectors.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/sound/asound.h (100%)

--
2.43.2

A message that is not in the archive (sent off-list or not yet received): CA+JHD93osaLDZurWep=ie5Rnshk-T8i8ZnLrneVfeQ6eNAaKJA@mail.gmail.com

reviewer Reviewed-by
#6 lore raw
Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 10 lines · Ian Rogers
Quoted 6 lines · Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <[email protected]>

Hi,

Move a few more files that is used just by scrappers.

Quoted 7 lines
Quoted 2 lines

Thanks Arnaldo! A nit, could you change s/scrapp/scrap/g in the commit messages - scrapping is throwing away, you mean scraping :-)

Sure, learned the difference an extra p makes :-)

Can I take this as an acked-by?

Yep.

Thanks,
Ian

Quoted 32 lines

- Arnaldo

Quoted 30 lines

Ian

Quoted 27 lines

- Arnaldo

Arnaldo Carvalho de Melo (3):
perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory
used to build perf
perf beauty: Move uapi/sound/asound.h copy out of the directory used
to build perf
perf beauty: Move arch/x86/include/asm/irq_vectors.h copy out of the
directory used to build perf

 tools/perf/Makefile.perf                      | 19 +++++++++++--------
 tools/perf/check-headers.sh                   |  6 +++---
 .../arch/x86/include/asm/irq_vectors.h        |  0
 .../beauty}/include/uapi/linux/usbdevice_fs.h |  0
 .../trace/beauty}/include/uapi/sound/asound.h |  0
 tools/perf/trace/beauty/sndrv_ctl_ioctl.sh    |  4 ++--
 tools/perf/trace/beauty/sndrv_pcm_ioctl.sh    |  4 ++--
 .../beauty/tracepoints/x86_irq_vectors.sh     |  6 +++---
 tools/perf/trace/beauty/usbdevfs_ioctl.sh     |  6 +++---
 9 files changed, 24 insertions(+), 21 deletions(-)
 rename tools/{ => perf/trace/beauty}/arch/x86/include/asm/irq_vectors.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
 rename tools/{ => perf/trace/beauty}/include/uapi/sound/asound.h (100%)

--
2.43.2