From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Tom Rix" <trix@redhat.com>,
"Roberto Sassu" <roberto.sassu@huawei.com>,
"Quentin Monnet" <quentin@isovalent.com>,
"Andres Freund" <andres@anarazel.de>,
"Tiezhu Yang" <yangtiezhu@loongson.cn>,
"Pavithra Gurushankar" <gpavithrasha@gmail.com>,
"Yang Jihong" <yangjihong1@huawei.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Leo Yan" <leo.yan@linaro.org>, "Martin Liška" <mliska@suse.cz>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
llvm@lists.linux.dev, "Stephane Eranian" <eranian@google.com>
Subject: Re: [PATCH v1 12/13] tools headers: Make the difference output easier to read
Date: Mon, 13 Mar 2023 16:35:42 -0300 [thread overview]
Message-ID: <ZA97DiLTzFyFpKVE@kernel.org> (raw)
In-Reply-To: <20230311065753.3012826-13-irogers@google.com>
Em Fri, Mar 10, 2023 at 10:57:52PM -0800, Ian Rogers escreveu:
> Add failures to an array and display it before exiting. Before:
>
> ```
> Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
> diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
> Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
> diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
> ...
> ```
>
> After:
> ```
> Warning: Kernel ABI header differences:
> tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
> tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
I use that diff line to cut and paste, check the errors, etc.
- Arnaldo
> ...
> ```
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/check-headers.sh | 229 ++++++++++++++++++++----------------
> 1 file changed, 125 insertions(+), 104 deletions(-)
>
> diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
> index eacca9a874e2..f848b425d936 100755
> --- a/tools/perf/check-headers.sh
> +++ b/tools/perf/check-headers.sh
> @@ -1,113 +1,121 @@
> -#!/bin/sh
> +#!/bin/bash
> # SPDX-License-Identifier: GPL-2.0
>
> -FILES='
> -include/uapi/linux/const.h
> -include/uapi/drm/drm.h
> -include/uapi/drm/i915_drm.h
> -include/uapi/linux/fadvise.h
> -include/uapi/linux/fcntl.h
> -include/uapi/linux/fs.h
> -include/uapi/linux/fscrypt.h
> -include/uapi/linux/kcmp.h
> -include/uapi/linux/kvm.h
> -include/uapi/linux/in.h
> -include/uapi/linux/mount.h
> -include/uapi/linux/openat2.h
> -include/uapi/linux/perf_event.h
> -include/uapi/linux/prctl.h
> -include/uapi/linux/sched.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
> -include/vdso/bits.h
> -include/linux/const.h
> -include/vdso/const.h
> -include/linux/hash.h
> -include/linux/list-sort.h
> -include/uapi/linux/hw_breakpoint.h
> -arch/x86/include/asm/disabled-features.h
> -arch/x86/include/asm/required-features.h
> -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
> -arch/x86/tools/gen-insn-attr-x86.awk
> -arch/arm/include/uapi/asm/perf_regs.h
> -arch/arm64/include/uapi/asm/perf_regs.h
> -arch/mips/include/uapi/asm/perf_regs.h
> -arch/powerpc/include/uapi/asm/perf_regs.h
> -arch/s390/include/uapi/asm/perf_regs.h
> -arch/x86/include/uapi/asm/perf_regs.h
> -arch/x86/include/uapi/asm/kvm.h
> -arch/x86/include/uapi/asm/kvm_perf.h
> -arch/x86/include/uapi/asm/svm.h
> -arch/x86/include/uapi/asm/unistd.h
> -arch/x86/include/uapi/asm/vmx.h
> -arch/powerpc/include/uapi/asm/kvm.h
> -arch/s390/include/uapi/asm/kvm.h
> -arch/s390/include/uapi/asm/kvm_perf.h
> -arch/s390/include/uapi/asm/ptrace.h
> -arch/s390/include/uapi/asm/sie.h
> -arch/arm/include/uapi/asm/kvm.h
> -arch/arm64/include/uapi/asm/kvm.h
> -arch/arm64/include/uapi/asm/unistd.h
> -arch/alpha/include/uapi/asm/errno.h
> -arch/mips/include/asm/errno.h
> -arch/mips/include/uapi/asm/errno.h
> -arch/parisc/include/uapi/asm/errno.h
> -arch/powerpc/include/uapi/asm/errno.h
> -arch/sparc/include/uapi/asm/errno.h
> -arch/x86/include/uapi/asm/errno.h
> -include/asm-generic/bitops/arch_hweight.h
> -include/asm-generic/bitops/const_hweight.h
> -include/asm-generic/bitops/__fls.h
> -include/asm-generic/bitops/fls.h
> -include/asm-generic/bitops/fls64.h
> -include/linux/coresight-pmu.h
> -include/uapi/asm-generic/errno.h
> -include/uapi/asm-generic/errno-base.h
> -include/uapi/asm-generic/ioctls.h
> -include/uapi/asm-generic/mman-common.h
> -include/uapi/asm-generic/unistd.h
> -'
> -
> -SYNC_CHECK_FILES='
> -arch/x86/include/asm/inat.h
> -arch/x86/include/asm/insn.h
> -arch/x86/lib/inat.c
> -arch/x86/lib/insn.c
> -'
> +YELLOW='\033[0;33m'
> +NC='\033[0m' # No Color
> +
> +declare -a FILES
> +FILES=(
> + "include/uapi/linux/const.h"
> + "include/uapi/drm/drm.h"
> + "include/uapi/drm/i915_drm.h"
> + "include/uapi/linux/fadvise.h"
> + "include/uapi/linux/fcntl.h"
> + "include/uapi/linux/fs.h"
> + "include/uapi/linux/fscrypt.h"
> + "include/uapi/linux/kcmp.h"
> + "include/uapi/linux/kvm.h"
> + "include/uapi/linux/in.h"
> + "include/uapi/linux/mount.h"
> + "include/uapi/linux/openat2.h"
> + "include/uapi/linux/perf_event.h"
> + "include/uapi/linux/prctl.h"
> + "include/uapi/linux/sched.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"
> + "include/vdso/bits.h"
> + "include/linux/const.h"
> + "include/vdso/const.h"
> + "include/linux/hash.h"
> + "include/linux/list-sort.h"
> + "include/uapi/linux/hw_breakpoint.h"
> + "arch/x86/include/asm/disabled-features.h"
> + "arch/x86/include/asm/required-features.h"
> + "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"
> + "arch/x86/tools/gen-insn-attr-x86.awk"
> + "arch/arm/include/uapi/asm/perf_regs.h"
> + "arch/arm64/include/uapi/asm/perf_regs.h"
> + "arch/mips/include/uapi/asm/perf_regs.h"
> + "arch/powerpc/include/uapi/asm/perf_regs.h"
> + "arch/s390/include/uapi/asm/perf_regs.h"
> + "arch/x86/include/uapi/asm/perf_regs.h"
> + "arch/x86/include/uapi/asm/kvm.h"
> + "arch/x86/include/uapi/asm/kvm_perf.h"
> + "arch/x86/include/uapi/asm/svm.h"
> + "arch/x86/include/uapi/asm/unistd.h"
> + "arch/x86/include/uapi/asm/vmx.h"
> + "arch/powerpc/include/uapi/asm/kvm.h"
> + "arch/s390/include/uapi/asm/kvm.h"
> + "arch/s390/include/uapi/asm/kvm_perf.h"
> + "arch/s390/include/uapi/asm/ptrace.h"
> + "arch/s390/include/uapi/asm/sie.h"
> + "arch/arm/include/uapi/asm/kvm.h"
> + "arch/arm64/include/uapi/asm/kvm.h"
> + "arch/arm64/include/uapi/asm/unistd.h"
> + "arch/alpha/include/uapi/asm/errno.h"
> + "arch/mips/include/asm/errno.h"
> + "arch/mips/include/uapi/asm/errno.h"
> + "arch/parisc/include/uapi/asm/errno.h"
> + "arch/powerpc/include/uapi/asm/errno.h"
> + "arch/sparc/include/uapi/asm/errno.h"
> + "arch/x86/include/uapi/asm/errno.h"
> + "include/asm-generic/bitops/arch_hweight.h"
> + "include/asm-generic/bitops/const_hweight.h"
> + "include/asm-generic/bitops/__fls.h"
> + "include/asm-generic/bitops/fls.h"
> + "include/asm-generic/bitops/fls64.h"
> + "include/linux/coresight-pmu.h"
> + "include/uapi/asm-generic/errno.h"
> + "include/uapi/asm-generic/errno-base.h"
> + "include/uapi/asm-generic/ioctls.h"
> + "include/uapi/asm-generic/mman-common.h"
> + "include/uapi/asm-generic/unistd.h"
> +)
> +
> +declare -a SYNC_CHECK_FILES
> +SYNC_CHECK_FILES=(
> + "arch/x86/include/asm/inat.h"
> + "arch/x86/include/asm/insn.h"
> + "arch/x86/lib/inat.c"
> + "arch/x86/lib/insn.c"
> +)
>
> # These copies are under tools/perf/trace/beauty/ as they are not used to in
> # building object files only by scripts in tools/perf/trace/beauty/ to generate
> # tables that then gets included in .c files for things like id->string syscall
> # tables (and the reverse lookup as well: string -> id)
>
> -BEAUTY_FILES='
> -include/linux/socket.h
> -'
> +declare -a BEAUTY_FILES
> +BEAUTY_FILES=(
> + "include/linux/socket.h"
> +)
> +
> +declare -a FAILURES
>
> check_2 () {
> - file1=$1
> - file2=$2
> + tools_file=$1
> + orig_file=$2
>
> shift
> shift
>
> - cmd="diff $* $file1 $file2 > /dev/null"
> + cmd="diff $* $tools_file $orig_file > /dev/null"
>
> - test -f $file2 && {
> - eval $cmd || {
> - echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
> - echo diff -u $file1 $file2
> - }
> - }
> + if [ -f "$orig_file" ] && ! eval "$cmd"
> + then
> + FAILURES+=(
> + "$tools_file $orig_file"
> + )
> + fi
> }
>
> check () {
> @@ -115,7 +123,7 @@ check () {
>
> shift
>
> - check_2 tools/$file $file $*
> + check_2 "tools/$file" "$file" $*
> }
>
> beauty_check () {
> @@ -123,23 +131,29 @@ beauty_check () {
>
> shift
>
> - check_2 tools/perf/trace/beauty/$file $file $*
> + check_2 "tools/perf/trace/beauty/$file" "$file" $*
> }
>
> # Check if we have the kernel headers (tools/perf/../../include), else
> # we're probably on a detached tarball, so no point in trying to check
> # differences.
> -test -d ../../include || exit 0
> +if ! [ -d ../../include ]
> +then
> + echo -e "${YELLOW}Warning${NC}: Skipped check-headers due to missing ../../include"
> + exit 0
> +fi
>
> cd ../..
>
> # simple diff check
> -for i in $FILES; do
> - check $i -B
> +for i in "${FILES[@]}"
> +do
> + check "$i" -B
> done
>
> -for i in $SYNC_CHECK_FILES; do
> - check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
> +for i in "${SYNC_CHECK_FILES[@]}"
> +do
> + check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
> done
>
> # diff with extra ignore lines
> @@ -160,8 +174,9 @@ check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/s
> check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
> check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
>
> -for i in $BEAUTY_FILES; do
> - beauty_check $i -B
> +for i in "${BEAUTY_FILES[@]}"
> +do
> + beauty_check "$i" -B
> done
>
> # check duplicated library files
> @@ -169,3 +184,9 @@ check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
> check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
>
> cd tools/perf
> +
> +echo -e "${YELLOW}Warning${NC}: Kernel ABI header differences:"
> +for i in "${FAILURES[@]}"
> +do
> + echo " $i"
> +done
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>
--
- Arnaldo
next prev parent reply other threads:[~2023-03-13 19:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-11 6:57 [PATCH v1 00/13] Perf tool build improvements Ian Rogers
2023-03-11 6:57 ` [PATCH v1 01/13] perf build: Support python/perf.so testing Ian Rogers
2023-03-11 6:57 ` [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL Ian Rogers
2023-03-13 20:19 ` Arnaldo Carvalho de Melo
2023-03-13 20:27 ` Ian Rogers
2023-03-13 20:34 ` Arnaldo Carvalho de Melo
2023-03-13 20:59 ` Arnaldo Carvalho de Melo
2023-03-13 21:05 ` Arnaldo Carvalho de Melo
2023-03-11 6:57 ` [PATCH v1 03/13] perf build: Remove unused HAVE_GLIBC_SUPPORT Ian Rogers
2023-03-11 6:57 ` [PATCH v1 04/13] perf build: Error if no libelf and NO_LIBELF isn't set Ian Rogers
2023-03-13 19:45 ` Arnaldo Carvalho de Melo
2023-03-13 20:18 ` Ian Rogers
2023-03-11 6:57 ` [PATCH v1 05/13] perf util: Remove weak sched_getcpu Ian Rogers
2023-03-11 6:57 ` [PATCH v1 06/13] perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set Ian Rogers
2023-03-11 6:57 ` [PATCH v1 07/13] perf build: Make binutil libraries opt in Ian Rogers
2023-03-13 19:37 ` Arnaldo Carvalho de Melo
2023-03-11 6:57 ` [PATCH v1 08/13] tools build: Add feature test for abi::__cxa_demangle Ian Rogers
2023-03-11 6:57 ` [PATCH v1 09/13] perf symbol: Add abi::__cxa_demangle C++ demangling support Ian Rogers
2023-03-30 14:08 ` James Clark
2023-03-30 16:50 ` Ian Rogers
2023-03-30 19:03 ` Ian Rogers
2023-03-31 9:27 ` James Clark
2023-03-11 6:57 ` [PATCH v1 10/13] perf build: Switch libpfm4 to opt-out rather than opt-in Ian Rogers
2023-03-11 6:57 ` [PATCH v1 11/13] perf build: If libtraceevent isn't present error the build Ian Rogers
2023-03-11 6:57 ` [PATCH v1 12/13] tools headers: Make the difference output easier to read Ian Rogers
2023-03-13 19:35 ` Arnaldo Carvalho de Melo [this message]
2023-03-13 20:14 ` Ian Rogers
2023-03-11 6:57 ` [PATCH v1 13/13] perf build: Remove redundant NO_NEWT build option Ian Rogers
2023-03-14 12:11 ` [PATCH v1 00/13] Perf tool build improvements Arnaldo Carvalho de Melo
2023-03-14 12:12 ` Arnaldo Carvalho de Melo
2023-03-14 12:27 ` Arnaldo Carvalho de Melo
2023-03-14 12:29 ` Arnaldo Carvalho de Melo
2023-03-14 12:21 ` Adrian Hunter
2023-03-14 12:28 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZA97DiLTzFyFpKVE@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=andres@anarazel.de \
--cc=eranian@google.com \
--cc=gpavithrasha@gmail.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=mliska@suse.cz \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=quentin@isovalent.com \
--cc=roberto.sassu@huawei.com \
--cc=trix@redhat.com \
--cc=yangjihong1@huawei.com \
--cc=yangtiezhu@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.