Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf beauty: Move prctl.h files (uapi/linux and x86's) copy out of the directory used to build perf

It is used only to generate string tables, not to build perf, so move it
to the tools/perf/trace/beauty/{include,arch}/ hierarchies, that is used
just for scraping.

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.

Suggested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/20240315204835.748716-3-acme@kernel.org
Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+12 -13
tools/arch/x86/include/uapi/asm/prctl.h tools/perf/trace/beauty/arch/x86/include/uapi/asm/prctl.h
tools/include/uapi/linux/prctl.h tools/perf/trace/beauty/include/uapi/linux/prctl.h
+5 -6
tools/perf/Makefile.perf
··· 475 475 beauty_uapi_linux_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/linux/ 476 476 beauty_uapi_sound_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/sound/ 477 477 beauty_arch_asm_dir := $(srctree)/tools/perf/trace/beauty/arch/x86/include/asm/ 478 + beauty_x86_arch_asm_uapi_dir := $(srctree)/tools/perf/trace/beauty/arch/x86/include/uapi/asm/ 478 479 479 480 linux_uapi_dir := $(srctree)/tools/include/uapi/linux 480 481 asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic 481 482 arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/ 482 - x86_arch_asm_uapi_dir := $(srctree)/tools/arch/x86/include/uapi/asm/ 483 483 x86_arch_asm_dir := $(srctree)/tools/arch/x86/include/asm/ 484 484 485 485 beauty_outdir := $(OUTPUT)trace/beauty/generated ··· 617 617 $(Q)$(SHELL) '$(mmap_prot_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@ 618 618 619 619 prctl_option_array := $(beauty_outdir)/prctl_option_array.c 620 - prctl_hdr_dir := $(srctree)/tools/include/uapi/linux/ 621 620 prctl_option_tbl := $(srctree)/tools/perf/trace/beauty/prctl_option.sh 622 621 623 - $(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl) 624 - $(Q)$(SHELL) '$(prctl_option_tbl)' $(prctl_hdr_dir) > $@ 622 + $(prctl_option_array): $(beauty_uapi_linux_dir)/prctl.h $(prctl_option_tbl) 623 + $(Q)$(SHELL) '$(prctl_option_tbl)' $(beauty_uapi_linux_dir) > $@ 625 624 626 625 usbdevfs_ioctl_array := $(beauty_ioctl_outdir)/usbdevfs_ioctl_array.c 627 626 usbdevfs_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/usbdevfs_ioctl.sh ··· 631 632 x86_arch_prctl_code_array := $(beauty_outdir)/x86_arch_prctl_code_array.c 632 633 x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh 633 634 634 - $(x86_arch_prctl_code_array): $(x86_arch_asm_uapi_dir)/prctl.h $(x86_arch_prctl_code_tbl) 635 - $(Q)$(SHELL) '$(x86_arch_prctl_code_tbl)' $(x86_arch_asm_uapi_dir) > $@ 635 + $(x86_arch_prctl_code_array): $(beauty_x86_arch_asm_uapi_dir)/prctl.h $(x86_arch_prctl_code_tbl) 636 + $(Q)$(SHELL) '$(x86_arch_prctl_code_tbl)' $(beauty_x86_arch_asm_uapi_dir) > $@ 636 637 637 638 x86_arch_irq_vectors_array := $(beauty_outdir)/x86_arch_irq_vectors_array.c 638 639 x86_arch_irq_vectors_tbl := $(srctree)/tools/perf/trace/beauty/tracepoints/x86_irq_vectors.sh
+2 -2
tools/perf/check-headers.sh
··· 17 17 "include/uapi/linux/in.h" 18 18 "include/uapi/linux/openat2.h" 19 19 "include/uapi/linux/perf_event.h" 20 - "include/uapi/linux/prctl.h" 21 20 "include/uapi/linux/sched.h" 22 21 "include/uapi/linux/seccomp.h" 23 22 "include/uapi/linux/stat.h" ··· 34 35 "arch/x86/include/asm/inat_types.h" 35 36 "arch/x86/include/asm/emulate_prefix.h" 36 37 "arch/x86/include/asm/msr-index.h" 37 - "arch/x86/include/uapi/asm/prctl.h" 38 38 "arch/x86/lib/x86-opcode-map.txt" 39 39 "arch/x86/tools/gen-insn-attr-x86.awk" 40 40 "arch/arm/include/uapi/asm/perf_regs.h" ··· 91 93 declare -a BEAUTY_FILES 92 94 BEAUTY_FILES=( 93 95 "arch/x86/include/asm/irq_vectors.h" 96 + "arch/x86/include/uapi/asm/prctl.h" 94 97 "include/linux/socket.h" 95 98 "include/uapi/linux/fs.h" 96 99 "include/uapi/linux/mount.h" 100 + "include/uapi/linux/prctl.h" 97 101 "include/uapi/linux/usbdevice_fs.h" 98 102 "include/uapi/sound/asound.h" 99 103 )
+3 -3
tools/perf/trace/beauty/prctl_option.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: LGPL-2.1 3 3 4 - [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 4 + [ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/ 5 5 6 6 printf "static const char *prctl_options[] = {\n" 7 7 regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*/.*)?$' 8 - grep -E $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 8 + grep -E $regex ${beauty_uapi_linux_dir}/prctl.h | grep -v PR_SET_PTRACER | \ 9 9 sed -E "s%$regex%\2 \1%g" | \ 10 10 sort -n | xargs printf "\t[%s] = \"%s\",\n" 11 11 printf "};\n" 12 12 13 13 printf "static const char *prctl_set_mm_options[] = {\n" 14 14 regex='^#[[:space:]]+define[[:space:]]+PR_SET_MM_(\w+)[[:space:]]*([[:digit:]]+).*' 15 - grep -E $regex ${header_dir}/prctl.h | \ 15 + grep -E $regex ${beauty_uapi_linux_dir}/prctl.h | \ 16 16 sed -r "s/$regex/\2 \1/g" | \ 17 17 sort -n | xargs printf "\t[%s] = \"%s\",\n" 18 18 printf "};\n"
+2 -2
tools/perf/trace/beauty/x86_arch_prctl.sh
··· 2 2 # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> 3 3 # SPDX-License-Identifier: LGPL-2.1 4 4 5 - [ $# -eq 1 ] && x86_header_dir=$1 || x86_header_dir=tools/arch/x86/include/uapi/asm/ 5 + [ $# -eq 1 ] && beauty_x86_arch_asm_uapi_dir=$1 || beauty_x86_arch_asm_uapi_dir=tools/perf/trace/beauty/arch/x86/include/uapi/asm/ 6 6 7 - prctl_arch_header=${x86_header_dir}/prctl.h 7 + prctl_arch_header=${beauty_x86_arch_asm_uapi_dir}/prctl.h 8 8 9 9 print_range () { 10 10 idx=$1