* [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources
@ 2026-10-21 22:35 Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel Arnaldo Carvalho de Melo
` (11 more replies)
0 siblings, 12 replies; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo
Hi,
The tools/ tree carries copies of kernel headers that are refreshed by
hand: check-headers points at the stale ones, then one looks up the
kernel commits that changed each of them, pastes the relevant bits into
the commit message, regenerates the beauty string tables, builds the
consumers and commits, one header at a time.
This adds tools/perf/scripts/sync-headers.sh, also available as 'make -C
tools/perf sync-headers', and patches 2-12 are what it produced for this
branch: for each stale header it finds the kernel commits since the last
sync, copies the file, runs the beauty scripts before and after for the
beauty copies, builds perf and the other consumers of the header and
creates a commit in the usual format, grouping the headers that share a
consumer, as with the KVM ones.
As for the state of the copies, only two headers are newer in this branch
than in the kernel sources, perf_event.h and perf_regs.h: changes to them
go to tools/ first, with the kernel picking them up later, so the script
checks if the kernel file matches an earlier tools/ state and leaves
those alone.
Best regards,
- Arnaldo
What changed from v1 (e038fb24a0925576):
PATCH 07/12, "perf beauty: Update copy of linux/socket.h with the
kernel sources" [Mahe Tardy, <atk1cuJe3pqUvBya@gmail.com>]:
- Added his Acked-by, no code change.
v1 went out with just the files matching '000*.patch', which stops at
0009, so patches 10/12 to 12/12 were never sent; they are all here now,
sorry about that.
Arnaldo Carvalho de Melo (12):
perf tools: Add script and make target to sync the header copies with
the kernel
tools headers UAPI: Sync linux/if_addr.h with the kernel sources
tools headers UAPI: Sync linux/rtnetlink.h with the kernel sources
tools headers: Sync linux/gfp_types.h with the kernel sources
tools headers x86 cpufeatures: Sync with the kernel sources
tools arch x86: Sync the msr-index.h copy with the kernel sources
perf beauty: Update copy of linux/socket.h with the kernel sources
tools headers: Sync UAPI linux/fcntl.h with the kernel sources
tools headers: Sync UAPI linux/fs.h with the kernel sources
tools headers: Sync UAPI linux/mount.h with the kernel sources
tools headers: Sync UAPI sound/asound.h with kernel sources
tools headers: Sync KVM headers with the kernel sources
tools/arch/arm64/include/uapi/asm/kvm.h | 1 +
tools/arch/powerpc/include/uapi/asm/kvm.h | 18 +
tools/arch/x86/include/asm/cpufeatures.h | 15 +
tools/arch/x86/include/asm/msr-index.h | 9 +-
tools/include/linux/gfp_types.h | 5 +-
tools/include/uapi/linux/if_addr.h | 1 +
tools/include/uapi/linux/kvm.h | 4 +
tools/include/uapi/linux/rtnetlink.h | 25 +
tools/perf/Makefile | 5 +-
tools/perf/Makefile.perf | 3 +
tools/perf/scripts/sync-headers.sh | 1256 +++++++++++++++++
.../perf/trace/beauty/include/linux/socket.h | 11 +-
.../trace/beauty/include/uapi/linux/fcntl.h | 1 +
.../perf/trace/beauty/include/uapi/linux/fs.h | 1 +
.../trace/beauty/include/uapi/linux/mount.h | 1 +
.../trace/beauty/include/uapi/sound/asound.h | 200 +--
16 files changed, 1452 insertions(+), 104 deletions(-)
create mode 100755 tools/perf/scripts/sync-headers.sh
base-commit: 1c90f0a3c8a1c4e38f9edd97af9e20848805a7fb
v1-head: e038fb24a0925576ac82b065f32b3c72bebe4b62
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:53 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources Arnaldo Carvalho de Melo
` (10 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@redhat.com>
This is to be used by the perf maintainers to sync the header copies
with the kernel originals, see the description below for how it works.
$ tools/perf/scripts/sync-headers.sh --help
Usage: sync-headers.sh [OPTIONS]
Sync tools/ header copies with the kernel sources and create commits.
Options:
-n, --dry-run Show what would be done without making changes
-N, --no-build Skip the perf build verification step
-C, --no-commit Copy files but do not create git commits
-f, --filter PAT Only process headers matching PAT (substring match
against the kernel-side path)
-o, --output DIR Build output directory (default: /tmp/build/perf-tools-1000)
-v, --verbose Show more details
-h, --help Show this help
Environment:
SIGN_OFF_NAME Override git user.name for Signed-off-by
SIGN_OFF_EMAIL Override git user.email for Signed-off-by
OUTPUT_DIR Build output directory
Through make:
SYNC_HEADERS_ARGS Options to pass to this script, e.g.:
make -C tools/perf sync-headers SYNC_HEADERS_ARGS='-n'
The script:
1. Runs 'make -C tools/perf check-headers' to find stale copies.
2. For each stale header, identifies the kernel commits that changed it.
3. Copies the kernel header into the tools/ tree.
4. For beauty headers, runs the relevant beauty script(s) before and
after, showing new/changed string table entries.
5. Builds perf and the other consumers of the header to verify nothing
breaks.
6. Creates a git commit per header (or group) with the standard commit
message format.
$
It is also available as:
$ make -C tools/perf sync-headers
==> Running check-headers to detect stale copies...
Stale headers found:
tools/include/uapi/linux/if_addr.h include/uapi/linux/if_addr.h
tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
...
tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h
==> Processing: include/uapi/linux/if_addr.h
Kernel commits since last sync:
7cb8198761e6 ("net: ipv4: report multicast group user count")
==> Copied include/uapi/linux/if_addr.h -> tools/include/uapi/linux/if_addr.h
==> Build-testing consumers of if_addr.h:
perf (tools/perf)
==> Build OK.
==> Committed: tools headers UAPI: Sync linux/if_addr.h with the kernel sources
==> Processing: include/uapi/linux/perf_event.h
Warning: tools/include/uapi/linux/perf_event.h matches a previous tools/ state, leaving it alone
==> Processing: include/uapi/linux/rtnetlink.h
Kernel commits since last sync:
cc17e386f8a5 ("ipv6: add ip6_del_rt_reason()")
==> Copied include/uapi/linux/rtnetlink.h -> tools/include/uapi/linux/rtnetlink.h
==> Build-testing consumers of rtnetlink.h:
libbpf (tools/lib/bpf)
bpftool (tools/bpf/bpftool)
perf (tools/perf)
==> Build OK.
==> Committed: tools headers UAPI: Sync linux/rtnetlink.h with the kernel sources
...
==> Processing: include/linux/socket.h
Kernel commits since last sync:
be3a5e06b962 ("net: add SO_PASSPIDFD_THREAD to get a thread-specific SCM_PIDFD")
5bd369c05576 ("net: Add connect_socket() helper")
==> Copied include/linux/socket.h -> tools/perf/trace/beauty/include/linux/socket.h
==> Build-testing consumers of socket.h:
perf (tools/perf)
==> Build OK.
==> Committed: perf beauty: Update copy of linux/socket.h with the kernel sources
...
==> Processing group: KVM headers (3 files)
...
==> Build-testing consumers of group KVM headers:
perf (tools/perf)
==> Build OK.
...
=========================================
Summary
=========================================
==> Synced successfully (13):
tools/include/uapi/linux/if_addr.h
tools/include/uapi/linux/rtnetlink.h
tools/include/linux/gfp_types.h
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/msr-index.h
tools/perf/trace/beauty/include/linux/socket.h
tools/perf/trace/beauty/include/uapi/linux/fcntl.h
tools/perf/trace/beauty/include/uapi/linux/fs.h
tools/perf/trace/beauty/include/uapi/linux/mount.h
tools/perf/trace/beauty/include/uapi/sound/asound.h
tools/include/uapi/linux/kvm.h
tools/arch/powerpc/include/uapi/asm/kvm.h
tools/arch/arm64/include/uapi/asm/kvm.h
Warning: Headers still out of sync:
tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
tools/arch/x86/include/uapi/asm/perf_regs.h arch/x86/include/uapi/asm/perf_regs.h
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 5 +-
tools/perf/Makefile.perf | 3 +
| 1256 ++++++++++++++++++++++++++++
3 files changed, 1263 insertions(+), 1 deletion(-)
create mode 100755 tools/perf/scripts/sync-headers.sh
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c1818bd5f2879ac9..00baf90e5bda7123 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -137,6 +137,9 @@ build-test-tarball:
check-headers:
@./check-headers.sh
+sync-headers:
+ @./scripts/sync-headers.sh $(SYNC_HEADERS_ARGS)
+
#
# All other targets get passed through:
#
@@ -144,4 +147,4 @@ check-headers:
$(print_msg)
$(make)
-.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers
+.PHONY: all clean tags TAGS FORCE Makefile build-test build-test-tarball check-headers sync-headers
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2d9379fea2672755..b74b534e1153ffcb 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -870,6 +870,9 @@ help:
@echo ''
@echo 'Perf maintainer targets:'
@echo ' clean - clean all binary objects and build output'
+ @echo ' check-headers - check which header copies are out of sync with the kernel'
+ @echo ' sync-headers - sync those header copies with the kernel, creating commits'
+ @echo ' (SYNC_HEADERS_ARGS="..." passes options to the script)'
DOC_TARGETS := doc man html info pdf
--git a/tools/perf/scripts/sync-headers.sh b/tools/perf/scripts/sync-headers.sh
new file mode 100755
index 0000000000000000..9a35a3d2095a7342
--- /dev/null
+++ b/tools/perf/scripts/sync-headers.sh
@@ -0,0 +1,1256 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2026, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
+#
+# Sync tools/ header copies with the kernel sources, generate beauty
+# string table diffs, verify perf still builds, and create git commits.
+
+set -euo pipefail
+
+YELLOW='\033[0;33m'
+GREEN='\033[0;32m'
+RED='\033[0;31m'
+NC='\033[0m'
+
+PERF_DIR=$(cd "$(dirname "$0")/.." && pwd)
+KERNEL_DIR=$(cd "$PERF_DIR/../.." && pwd)
+DRY_RUN=0
+BUILD=1
+COMMIT=1
+OUTPUT_DIR="${OUTPUT_DIR:-${TMPDIR:-/tmp}/build/perf-tools-$(id -u)}"
+SIGN_OFF_NAME="${SIGN_OFF_NAME:-}"
+SIGN_OFF_EMAIL="${SIGN_OFF_EMAIL:-}"
+HEADER_FILTER=""
+VERBOSE=0
+
+# Track build successes and failures for end-of-run summary
+declare -a SYNCED_OK=()
+declare -a BUILD_FAILED=()
+declare -a COPY_FAILED=()
+declare -a COMMIT_FAILED=()
+
+info() { echo -e "${GREEN}==>${NC} $*"; }
+warn() { echo -e "${YELLOW}Warning:${NC} $*"; }
+err() { echo -e "${RED}Error:${NC} $*" >&2; }
+detail(){ [[ $VERBOSE -eq 1 ]] && echo -e " $*"; return 0; }
+
+usage() {
+ local status="${1:-0}"
+
+ cat <<EOF
+Usage: $(basename "$0") [OPTIONS]
+
+Sync tools/ header copies with the kernel sources and create commits.
+
+Options:
+ -n, --dry-run Show what would be done without making changes
+ -N, --no-build Skip the perf build verification step
+ -C, --no-commit Copy files but do not create git commits
+ -f, --filter PAT Only process headers matching PAT (substring match
+ against the kernel-side path)
+ -o, --output DIR Build output directory (default: $OUTPUT_DIR)
+ -v, --verbose Show more details
+ -h, --help Show this help
+
+Environment:
+ SIGN_OFF_NAME Override git user.name for Signed-off-by
+ SIGN_OFF_EMAIL Override git user.email for Signed-off-by
+ OUTPUT_DIR Build output directory
+
+Through make:
+ SYNC_HEADERS_ARGS Options to pass to this script, e.g.:
+ make -C tools/perf sync-headers SYNC_HEADERS_ARGS='-n'
+
+The script:
+ 1. Runs 'make -C tools/perf check-headers' to find stale copies.
+ 2. For each stale header, identifies the kernel commits that changed it.
+ 3. Copies the kernel header into the tools/ tree.
+ 4. For beauty headers, runs the relevant beauty script(s) before and
+ after, showing new/changed string table entries.
+ 5. Builds perf and the other consumers of the header to verify nothing
+ breaks.
+ 6. Creates a git commit per header (or group) with the standard commit
+ message format.
+
+EOF
+ exit "$status"
+}
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -n|--dry-run) DRY_RUN=1; shift ;;
+ -N|--no-build) BUILD=0; shift ;;
+ -C|--no-commit) COMMIT=0; shift ;;
+ -f|--filter)
+ [[ $# -ge 2 ]] || { err "$1 needs an argument"; exit 1; }
+ HEADER_FILTER="$2"; shift 2 ;;
+ -o|--output)
+ [[ $# -ge 2 ]] || { err "$1 needs an argument"; exit 1; }
+ OUTPUT_DIR="$2"; shift 2 ;;
+ -v|--verbose) VERBOSE=1; shift ;;
+ -h|--help) usage ;;
+ *) err "Unknown option: $1"; usage 1 ;;
+ esac
+done
+
+sign_off() {
+ local name="${SIGN_OFF_NAME:-$(git config user.name)}"
+ local email="${SIGN_OFF_EMAIL:-$(git config user.email)}"
+ echo "Signed-off-by: $name <$email>"
+}
+
+# --- Detect stale headers ------------------------------------------------
+
+detect_stale_headers() {
+ local tmpfile
+ tmpfile=$(mktemp)
+
+ # check-headers.sh must be run from tools/perf/ (it does cd ../.. internally)
+ (cd "$PERF_DIR" && bash check-headers.sh 2>/dev/null) | \
+ grep '^ *diff -u ' | \
+ sed 's/^ *diff -u //' > "$tmpfile"
+
+ if [[ ! -s "$tmpfile" ]]; then
+ rm -f "$tmpfile"
+ return 1
+ fi
+
+ cat "$tmpfile"
+ rm -f "$tmpfile"
+ return 0
+}
+
+# --- Classify a header ---------------------------------------------------
+#
+# Returns via globals:
+# HDR_CLASS: "files" | "beauty"
+classify_header() {
+ local tools_path="$1"
+
+ if [[ "$tools_path" == tools/perf/trace/beauty/* ]]; then
+ HDR_CLASS="beauty"
+ else
+ HDR_CLASS="files"
+ fi
+}
+
+# --- Find kernel commits that changed a header since our copy ------------
+
+# The last commit that left the two copies equal, found by content: an
+# in-tree kernel commit can update the copy from a tree state that
+# already misses an earlier kernel change to the header (the
+# linux/gfp_types.h doc fix), so the last commit touching the copy can be
+# newer than the first commit still missing from it. Falls back to the
+# last commit that touched the tools copy.
+#
+# The walk can run to the end of the history when no commit ever left the
+# two byte-identical (copies compared with -I patterns are rewritten on
+# purpose), so all the blob comparisons go through one
+# git cat-file --batch-check, no forks per commit.
+find_sync_point() {
+ local kernel_path="$1"
+ local tools_path="$2"
+ local -a candidates blobs
+ local i
+
+ mapfile -t candidates < <(git log --no-merges --format='%H' -- "$kernel_path" "$tools_path" 2>/dev/null)
+ mapfile -t blobs < <(
+ printf '%s\n' "${candidates[@]}" | \
+ awk -v k="$kernel_path" -v t="$tools_path" '{ print $1 ":" k ORS $1 ":" t }' | \
+ git cat-file --batch-check)
+
+ for ((i = 0; i < ${#candidates[@]}; i++)); do
+ # "<spec> missing" keeps the ':' of the spec as its first field,
+ # which no object id has.
+ if [[ "${blobs[2*i]%% *}" == "${blobs[2*i+1]%% *}" && \
+ "${blobs[2*i]%% *}" != *:* ]]; then
+ echo "${candidates[i]}"
+ return
+ fi
+ done
+
+ git log --no-merges --format='%H' -1 -- "$tools_path" 2>/dev/null
+}
+
+# A kernel commit that changed both the header and the tools copy already
+# carried its change into tools/, so it has nothing left to pick up here.
+find_kernel_commits() {
+ local kernel_path="$1"
+ local tools_path="$2"
+ local sync_point="$3"
+ local copied sha
+
+ copied=$(git log --no-merges --format='%H' \
+ "${sync_point}..HEAD" -- "$tools_path" 2>/dev/null)
+ [[ -n "$copied" ]] && copied+=$'\n'
+
+ while IFS= read -r sha; do
+ [[ "$copied" == *"$sha"$'\n'* ]] && continue
+ echo "$sha"
+ done < <(git log --no-merges --format='%H' \
+ "${sync_point}..HEAD" -- "$kernel_path" 2>/dev/null)
+}
+
+# Render commit ids with FORMAT at the usual 12 chars, keeping their order.
+format_commits() {
+ local format="$1"
+ local ids="$2"
+
+ [[ -n "$ids" ]] || return 0
+ printf '%s\n' "$ids" | git log --no-walk=unsorted --abbrev=12 \
+ --format="$format" --stdin 2>/dev/null
+}
+
+# The kernel's current content can match a previous tools/ copy state when
+# the kernel reverted the header; there is nothing to pick up then.
+kernel_matches_previous_tools_state() {
+ local kernel_path="$1"
+ local tools_path="$2"
+ local kernel_blob
+
+ kernel_blob=$(git hash-object "$kernel_path" 2>/dev/null) || return 1
+ [[ -n "$(git log --format=%h -1 --find-object="$kernel_blob" -- "$tools_path" 2>/dev/null)" ]]
+}
+
+# --- Map a kernel header path to its beauty script(s) --------------------
+#
+# A beauty script is relevant if it reads from the directory containing
+# the header being updated.
+
+find_beauty_scripts() {
+ local kernel_path="$1"
+ local header_basename
+ header_basename=$(basename "$kernel_path")
+
+ local scripts=()
+
+ # Search all beauty .sh scripts (including subdirs) for references to this header
+ while IFS= read -r script; do
+ if grep -F -q -e "/$header_basename" -e "\"$header_basename\"" \
+ "$script" 2>/dev/null; then
+ scripts+=("$script")
+ fi
+ done < <(find "$PERF_DIR"/trace/beauty -name '*.sh')
+
+ printf '%s\n' "${scripts[@]}"
+}
+
+# --- Find buildable targets that consume a header -------------------------
+#
+# Given a tools/ header path, grep tools/ source files to find which
+# buildable directories include it, then return them as build commands.
+# This is discovered dynamically so new consumers are picked up automatically.
+
+# C sources include tools/ headers by their include-relative path, e.g.
+# <linux/socket.h> for tools/include/uapi/linux/socket.h.
+include_relative_path() {
+ local tools_path="$1"
+
+ case "$tools_path" in
+ tools/include/uapi/*)
+ echo "${tools_path#tools/include/uapi/}"
+ ;;
+ tools/include/*)
+ echo "${tools_path#tools/include/}"
+ ;;
+ tools/arch/*/include/uapi/*)
+ echo "${tools_path#tools/arch/*/include/uapi/}"
+ ;;
+ tools/arch/*/include/*)
+ echo "${tools_path#tools/arch/*/include/}"
+ ;;
+ *)
+ basename "$tools_path"
+ ;;
+ esac
+}
+
+# Map from a source file path to its buildable target directory and make command.
+# Returns empty if the file doesn't belong to a known buildable target.
+buildable_target() {
+ local src="$1"
+ case "$src" in
+ tools/perf/*)
+ echo "perf:$PERF_DIR"
+ ;;
+ tools/lib/bpf/*)
+ echo "libbpf:$KERNEL_DIR/tools/lib/bpf"
+ ;;
+ tools/bpf/bpftool/*)
+ echo "bpftool:$KERNEL_DIR/tools/bpf/bpftool"
+ ;;
+ tools/objtool/*)
+ echo "objtool:$KERNEL_DIR/tools/objtool"
+ ;;
+ tools/lib/subcmd/*)
+ echo "libsubcmd:$KERNEL_DIR/tools/lib/subcmd"
+ ;;
+ tools/lib/api/*)
+ echo "libapi:$KERNEL_DIR/tools/lib/api"
+ ;;
+ tools/lib/perf/*)
+ echo "libperf:$KERNEL_DIR/tools/lib/perf"
+ ;;
+ tools/lib/symbol/*)
+ echo "libsymbol:$KERNEL_DIR/tools/lib/symbol"
+ ;;
+ tools/tracing/*)
+ echo "tracing:$KERNEL_DIR/tools/tracing"
+ ;;
+ esac
+}
+
+find_build_targets() {
+ local tools_path="$1"
+ local header_class="$2"
+ local include_path
+ local targets=()
+ local seen=()
+
+ # Beauty copies are only on the include path of the beauty scripts.
+ if [[ "$header_class" == "beauty" ]]; then
+ echo "perf:$PERF_DIR"
+ return
+ fi
+
+ include_path=$(include_relative_path "$tools_path")
+
+ while IFS= read -r src; do
+ [[ -z "$src" ]] && continue
+ local target
+ target=$(buildable_target "$src")
+ [[ -z "$target" ]] && continue
+
+ # Deduplicate
+ local already=0
+ for s in "${seen[@]+"${seen[@]}"}"; do
+ if [[ "$s" == "$target" ]]; then
+ already=1
+ break
+ fi
+ done
+ if [[ $already -eq 0 ]]; then
+ seen+=("$target")
+ targets+=("$target")
+ fi
+ done < <(grep -rlF -e "<$include_path>" -e "\"$include_path\"" -e "/$include_path" \
+ --include='*.c' --include='*.h' --include='*.S' \
+ "$KERNEL_DIR/tools/" 2>/dev/null | \
+ sed "s|^$KERNEL_DIR/||" | grep -v '^tools/include/')
+
+ # Always include perf
+ local has_perf=0
+ for t in "${targets[@]+"${targets[@]}"}"; do
+ [[ "$t" == perf:* ]] && has_perf=1
+ done
+ if [[ $has_perf -eq 0 ]]; then
+ targets+=("perf:$PERF_DIR")
+ fi
+
+ printf '%s\n' "${targets[@]}"
+}
+
+# Print the consumers that will be built for a header or group.
+show_build_targets() {
+ local what="$1"
+ local target_list="$2"
+
+ info "Build-testing consumers of $what:"
+ while IFS=: read -r name dir; do
+ [[ -z "$name" ]] && continue
+ echo " $name ($dir)"
+ done <<< "$target_list"
+}
+
+# Keep build output out of the source tree; perf, tracing and objtool take
+# O=, the libraries and bpftool take OUTPUT=.
+build_target() {
+ local name="$1"
+ local dir="$2"
+
+ case "$name" in
+ perf)
+ make -C "$dir" O="$OUTPUT_DIR" -j"$(nproc)"
+ ;;
+ tracing|objtool)
+ (umask 077 && mkdir -p "$OUTPUT_DIR/$name")
+ make -C "$dir" O="$OUTPUT_DIR/$name" -j"$(nproc)"
+ ;;
+ *)
+ (umask 077 && mkdir -p "$OUTPUT_DIR/$name")
+ make -C "$dir" OUTPUT="$OUTPUT_DIR/$name/" -j"$(nproc)"
+ ;;
+ esac
+}
+
+# Run build tests for all targets that consume a header.
+# Returns 0 if all builds pass, 1 if any fail.
+build_test_targets() {
+ local tools_path="$1"
+ local header_class="$2"
+ local header_basename log_name
+ local target_list failed=0
+
+ header_basename=$(basename "$tools_path")
+ # Key the log by tools path, same-basename headers in different
+ # directories would otherwise share a log.
+ log_name="${tools_path//\//-}"
+ target_list=$(find_build_targets "$tools_path" "$header_class")
+ show_build_targets "$header_basename" "$target_list"
+
+ while IFS=: read -r name dir; do
+ [[ -z "$name" ]] && continue
+ local log="$OUTPUT_DIR/$name.$log_name.log"
+ if ! build_target "$name" "$dir" > "$log" 2>&1; then
+ err " $name build failed, see $log"
+ failed=1
+ fi
+ done <<< "$target_list"
+
+ return $failed
+}
+
+# --- Run a beauty script capturing output --------------------------------
+#
+# The build invokes these scripts with the directories they read from
+# (tools/perf/trace/beauty/Build); run bare, arch_errno_names.sh misses
+# the header copies and the tables miss the changes.
+
+declare -A BEAUTY_SCRIPT_ARGS=()
+declare -A BEAUTY_MAKE_DIRS=()
+declare -A BEAUTY_MAKE_SCRIPTS=()
+
+# Read the beauty script arguments out of the same Build file the build
+# uses, so a new script or a changed directory needs no edit here.
+# The single quotes below hold literal make syntax from the Build
+# file, not shell expressions.
+# shellcheck disable=SC2016
+setup_beauty_args() {
+ local build="$PERF_DIR/trace/beauty/Build"
+ local -a rule_lines=()
+ local line var script args token value
+ local re_dir re_tbl srcarch
+
+ # _dir :=, _tbl := assignments, and the $(SHELL) rules using them.
+ re_dir='^([a-z0-9_]+_(dir|dirs))[[:space:]]*(:=|\?=)[[:space:]]*'
+ re_dir+='\$\(srctree\)/(.*)$'
+ re_tbl='^([a-z0-9_]+_tbl[s]?)[[:space:]]*(:=|\?=)[[:space:]]*'
+ re_tbl+='\$\(srctree\)/((.*\.sh))[[:space:]]*$'
+
+ srcarch=$(uname -m)
+ case "$srcarch" in
+ x86_64|i[3-6]86) srcarch=x86 ;;
+ aarch64|arm64) srcarch=arm64 ;;
+ s390*) srcarch=s390 ;;
+ riscv*) srcarch=riscv ;;
+ loongarch*) srcarch=loongarch ;;
+ ppc*) srcarch=powerpc ;;
+ sparc*) srcarch=sparc ;;
+ mips*) srcarch=mips ;;
+ esac
+
+ [[ -r "$build" ]] || {
+ detail "No beauty Build file, running the scripts without arguments"
+ return 1
+ }
+
+ while IFS= read -r line; do
+ if [[ "$line" =~ $re_dir ]]; then
+ BEAUTY_MAKE_DIRS["${BASH_REMATCH[1]}"]="${BASH_REMATCH[4]}"
+ continue
+ fi
+ if [[ "$line" =~ $re_tbl ]]; then
+ BEAUTY_MAKE_SCRIPTS["${BASH_REMATCH[1]}"]="${BASH_REMATCH[4]}"
+ continue
+ fi
+ if [[ "$line" == *'$(SHELL)'* ]]; then
+ rule_lines+=("$line")
+ fi
+ done < "$build"
+
+ local rule
+ for rule in "${rule_lines[@]+"${rule_lines[@]}"}"; do
+ IFS="'" read -r _ var args <<< "$rule" || continue
+ [[ "$var" == '$('* ]] || continue
+ var="${var:2:${#var}-3}"
+ script="${BEAUTY_MAKE_SCRIPTS[$var]:-}"
+ [[ -n "$script" ]] || continue
+ script="${script##*/}"
+
+ # $(patsubst -%,,$(CC)) yields the compiler name
+ args=$(printf '%s\n' "$args" | sed 's/\$(patsubst -%,,\$(CC))/gcc/g')
+ args="${args//\'}"
+ args="${args%' > $@'}"
+ value=""
+ for token in $args; do
+ case "$token" in
+ '$@')
+ continue
+ ;;
+ '$(srctree)'*)
+ token="${token//\$(srctree)/$KERNEL_DIR}"
+ ;;
+ '$('*)
+ token="$KERNEL_DIR/${BEAUTY_MAKE_DIRS["${token:2:${#token}-3}"]:-}"
+ [[ "$token" == "$KERNEL_DIR/" ]] && { value=""; break; }
+ ;;
+ *) ;;
+ esac
+ token=$(printf '%s' "$token" | sed "s/\$(SRCARCH)/$srcarch/g")
+ if [[ "$token" == *'$('* ]]; then
+ value=""
+ break
+ fi
+ value+="${value:+ }$token"
+ done
+ [[ -n "$value" ]] || continue
+ BEAUTY_SCRIPT_ARGS["$script"]="$value"
+ done
+}
+
+run_beauty_script() {
+ local script="$1"
+ local -a cmd=()
+
+ read -ra cmd <<< "${BEAUTY_SCRIPT_ARGS["${script##*/}"]:-}"
+ bash "$script" "${cmd[@]+"${cmd[@]}"}" 2>/dev/null || true
+}
+
+# Run one beauty script against the kernel content swapped into the tools
+# copy, capturing its output before and after; the saved copy restores the
+# tools copy, also when the script is interrupted.
+run_beauty_pass() {
+ local script="$1"
+ local kernel_path="$2"
+ local tools_path="$3"
+ local tmpdir="$4"
+ local idx="$5"
+ local before="$tmpdir/beauty.$idx.before"
+ local after="$tmpdir/beauty.$idx.after"
+ local saved="$tmpdir/beauty.$idx.saved"
+ local restore
+
+ if ! cp -p "$KERNEL_DIR/$tools_path" "$saved"; then
+ err "Failed to save $tools_path"
+ return 1
+ fi
+ restore=$(printf 'cp -p %q %q' "$saved" "$KERNEL_DIR/$tools_path")
+ # shellcheck disable=SC2064 # expand now, locals may be gone
+ trap "$restore" EXIT
+ # shellcheck disable=SC2064 # expand now, locals may be gone
+ trap "$restore; trap - EXIT; exit 130" INT
+ # shellcheck disable=SC2064 # expand now, locals may be gone
+ trap "$restore; trap - EXIT; exit 143" TERM
+ (cd "$KERNEL_DIR" && run_beauty_script "$script") > "$before"
+ if ! cp "$KERNEL_DIR/$kernel_path" "$KERNEL_DIR/$tools_path"; then
+ err "Failed to copy $kernel_path -> $tools_path"
+ cp -p "$saved" "$KERNEL_DIR/$tools_path" || \
+ err "Failed to restore $tools_path"
+ trap - INT TERM EXIT
+ return 1
+ fi
+ (cd "$KERNEL_DIR" && run_beauty_script "$script") > "$after"
+ if ! cp -p "$saved" "$KERNEL_DIR/$tools_path"; then
+ err "Failed to restore $tools_path"
+ trap - INT TERM EXIT
+ return 1
+ fi
+ trap - INT TERM EXIT
+}
+
+# The tools/perf/trace/beauty/ relative path of a beauty script, as shown
+# in the commit messages.
+beauty_script_relpath() {
+ echo "tools/perf/trace/beauty/${1##*/trace/beauty/}"
+}
+
+# The commit message fragment for a beauty script whose table changed:
+# the recipe the pre-pass ran and the difference between its two runs.
+beauty_body_fragment() {
+ local script="$1"
+ local kernel_path="$2"
+ local tools_path="$3"
+ local before="$4"
+ local after="$5"
+ local rel_script args
+
+ rel_script=$(beauty_script_relpath "$script")
+ # The runs are from the tree root, show the dirs relative to it.
+ args="${BEAUTY_SCRIPT_ARGS["${script##*/}"]:-}"
+ args="${args//"$KERNEL_DIR/"/}"
+
+ printf '\n'
+ printf ' $ %s%s > before.txt\n' "$rel_script" "${args:+ $args}"
+ printf ' $ cp %s %s\n' "$kernel_path" "$tools_path"
+ printf ' $ %s%s > after.txt\n' "$rel_script" "${args:+ $args}"
+ printf ' $ diff -u before.txt after.txt\n'
+ printf '\n'
+ diff -u "$before" "$after" | tail -n +3 | sed 's/^/ /'
+ printf '\n'
+}
+
+cleanup_tmpdir() {
+ [[ -n "$1" ]] || return 0
+ rm -rf "$1"
+}
+
+# --- Copy header and create commit ---------------------------------------
+
+process_header() {
+ local tools_path="$1"
+ local kernel_path="$2"
+
+ classify_header "$tools_path"
+
+ if [[ -n "$HEADER_FILTER" ]] && [[ "$kernel_path" != *"$HEADER_FILTER"* ]]; then
+ detail "Skipping $kernel_path (does not match filter)"
+ return
+ fi
+
+ info "Processing: $kernel_path"
+ detail " Class: $HDR_CLASS"
+ detail " Tools: $tools_path"
+ detail " Kernel: $kernel_path"
+
+ if kernel_matches_previous_tools_state "$kernel_path" "$tools_path"; then
+ warn "$tools_path matches a previous tools/ state, leaving it alone"
+ return
+ fi
+
+ # Find kernel commits that changed this file
+ local sync_point pickup_commits=""
+ sync_point=$(find_sync_point "$kernel_path" "$tools_path")
+ if [[ -n "$sync_point" ]]; then
+ pickup_commits=$(find_kernel_commits "$kernel_path" \
+ "$tools_path" "$sync_point")
+ else
+ warn "No previous sync commit found for $tools_path"
+ fi
+
+ local kernel_commits=""
+ if [[ -n "$pickup_commits" ]]; then
+ kernel_commits=$(format_commits ' %h ("%s")' "$pickup_commits")
+ echo ""
+ echo " Kernel commits since last sync:"
+ echo "$kernel_commits"
+ fi
+
+ # For beauty files, capture the string table changes and keep the
+ # before/after files for the commit message.
+ local beauty_changed=0
+ local beauty_tmpdir=""
+ local beauty_scripts
+ local -a beauty_script_list=()
+ beauty_scripts=$(find_beauty_scripts "$kernel_path")
+ while IFS= read -r script; do
+ [[ -z "$script" ]] && continue
+ beauty_script_list+=("$script")
+ done <<< "$beauty_scripts"
+ if [[ ${#beauty_script_list[@]} -gt 0 ]]; then
+ beauty_tmpdir=$(mktemp -d)
+
+ local idx=0
+ for script in "${beauty_script_list[@]}"; do
+ local script_name
+ script_name=$(basename "$script")
+ local before="$beauty_tmpdir/beauty.$idx.before"
+ local after="$beauty_tmpdir/beauty.$idx.after"
+
+ # The script reads the tools/ copy, so swap in the kernel one
+ # and restore the saved copy, also in a dry run.
+ if ! run_beauty_pass "$script" "$kernel_path" "$tools_path" \
+ "$beauty_tmpdir" "$idx"; then
+ COPY_FAILED+=("$tools_path")
+ cleanup_tmpdir "$beauty_tmpdir"
+ return 1
+ fi
+
+ if ! diff -q "$before" "$after" > /dev/null 2>&1; then
+ echo ""
+ info "Beauty string changes from $script_name:"
+ diff -u "$before" "$after" | head -60 || true
+ beauty_changed=1
+ fi
+ idx=$((idx + 1))
+ done
+ fi
+
+ if [[ $DRY_RUN -eq 1 ]]; then
+ cleanup_tmpdir "$beauty_tmpdir"
+ info "(dry run) Would copy $kernel_path -> $tools_path"
+ return
+ fi
+
+ # Do the actual copy
+ if ! cp "$KERNEL_DIR/$kernel_path" "$KERNEL_DIR/$tools_path"; then
+ err "Failed to copy $kernel_path -> $tools_path"
+ COPY_FAILED+=("$tools_path")
+ cleanup_tmpdir "$beauty_tmpdir"
+ return 1
+ fi
+ info "Copied $kernel_path -> $tools_path"
+
+ # Verify the consumers still build
+ if [[ $BUILD -eq 1 ]]; then
+ if ! build_test_targets "$tools_path" "$HDR_CLASS"; then
+ err "Build failed after copying $kernel_path — reverting."
+ git -C "$KERNEL_DIR" checkout -- "$tools_path" || \
+ err "Failed to revert $tools_path"
+ BUILD_FAILED+=("$tools_path")
+ cleanup_tmpdir "$beauty_tmpdir"
+ return 1
+ fi
+ info "Build OK."
+ fi
+
+ if [[ $COMMIT -eq 0 ]]; then
+ SYNCED_OK+=("$tools_path")
+ cleanup_tmpdir "$beauty_tmpdir"
+ return
+ fi
+
+ # Compose commit message
+ local header_short
+ header_short=$(basename "$kernel_path")
+ local header_dir
+ header_dir=$(dirname "$kernel_path" | sed 's|^include/uapi/||;s|^include/||;s|^arch/||')
+
+ # Determine the commit subject per header type
+ local subject
+ case "$kernel_path" in
+ arch/x86/include/asm/cpufeatures.h)
+ subject="tools headers x86 cpufeatures: Sync with the kernel sources"
+ ;;
+ arch/x86/include/asm/msr-index.h)
+ subject="tools arch x86: Sync the msr-index.h copy with the kernel sources"
+ ;;
+ arch/x86/include/asm/irq_vectors.h)
+ subject="perf beauty: Update the arch/x86/include/asm/irq_vectors.h copy with the kernel sources"
+ ;;
+ arch/x86/include/uapi/asm/prctl.h)
+ subject="perf beauty: Sync x86 uapi/asm/prctl.h with the kernel sources"
+ ;;
+ include/uapi/drm/*|include/uapi/sound/*)
+ subject="tools headers: Sync UAPI ${header_dir}/${header_short} with kernel sources"
+ ;;
+ include/uapi/linux/perf_event.h)
+ subject="tools headers UAPI: Sync linux/perf_event.h with the kernel sources"
+ ;;
+ include/uapi/linux/*)
+ if [[ "$HDR_CLASS" == "beauty" ]]; then
+ subject="tools headers: Sync UAPI linux/${header_short} with the kernel sources"
+ else
+ subject="tools headers UAPI: Sync linux/${header_short} with the kernel sources"
+ fi
+ ;;
+ include/uapi/asm-generic/*)
+ subject="tools headers UAPI: Sync asm-generic/${header_short} with the kernel sources"
+ ;;
+ include/uapi/*)
+ local uapi_subdir
+ uapi_subdir=$(echo "$kernel_path" | sed 's|^include/uapi/||;s|/[^/]*$||')
+ if [[ "$HDR_CLASS" == "beauty" ]]; then
+ subject="tools headers: Sync UAPI ${uapi_subdir}/${header_short} with kernel sources"
+ else
+ subject="tools headers UAPI: Sync ${uapi_subdir}/${header_short} with the kernel sources"
+ fi
+ ;;
+ include/linux/socket.h)
+ subject="perf beauty: Update copy of linux/socket.h with the kernel sources"
+ ;;
+ include/linux/*)
+ subject="tools headers: Sync linux/${header_short} with the kernel sources"
+ ;;
+ include/vdso/*)
+ subject="tools headers: Sync vdso/${header_short} with the kernel sources"
+ ;;
+ include/asm-generic/*)
+ subject="tools headers: Sync asm-generic/${header_short} with the kernel sources"
+ ;;
+ arch/*/include/uapi/asm/perf_regs.h)
+ local arch
+ arch=$(echo "$kernel_path" | cut -d/ -f2)
+ subject="tools headers UAPI: Sync ${arch}/asm/perf_regs.h with the kernel sources"
+ ;;
+ arch/*/include/uapi/*)
+ subject="tools headers UAPI: Sync ${header_short} with the kernel sources"
+ ;;
+ arch/*)
+ local arch
+ arch=$(echo "$kernel_path" | cut -d/ -f2)
+ subject="tools arch ${arch}: Sync the ${header_short} copy with the kernel sources"
+ ;;
+ scripts/*|lib/*)
+ subject="tools headers: Sync ${header_short} with the kernel sources"
+ ;;
+ *)
+ subject="tools headers: Sync ${header_short} with the kernel sources"
+ ;;
+ esac
+
+ # Build commit body
+ local body=""
+
+ if [[ -n "$kernel_commits" ]]; then
+ body+="To pick up the changes in:"
+ body+=$'\n'
+ body+=$'\n'
+ body+="$kernel_commits"
+ body+=$'\n'
+ fi
+
+ if [[ $beauty_changed -eq 1 ]]; then
+ # Show the beauty diff in the commit message.
+ body+=$'\n'
+ body+="That introduce these new entries in the string tables:"
+ body+=$'\n'
+
+ local idx=0
+ for script in "${beauty_script_list[@]}"; do
+ local before_msg="$beauty_tmpdir/beauty.$idx.before"
+ local after_msg="$beauty_tmpdir/beauty.$idx.after"
+
+ if ! diff -q "$before_msg" "$after_msg" > /dev/null 2>&1; then
+ body+=$(beauty_body_fragment "$script" "$kernel_path" \
+ "$tools_path" "$before_msg" "$after_msg")
+ body+=$'\n'
+ fi
+ idx=$((idx + 1))
+ done
+ elif [[ ${#beauty_script_list[@]} -gt 0 ]]; then
+ body+=$'\n'
+ body+="That don't result in changes to the string tables generated"
+ body+=" from this header."
+ else
+ body+=$'\n'
+ body+="That just rebuilds perf, silencing this build warning."
+ fi
+
+ body+=$'\n'
+ body+=$'\n'
+ body+="This addresses this perf build warning:"
+ body+=$'\n'
+ body+=$'\n'
+ body+=" Warning: Kernel ABI header differences:"
+ body+=$'\n'
+ body+=" diff -u $tools_path $kernel_path"
+ body+=$'\n'
+ body+=$'\n'
+ body+="Please see tools/include/uapi/README for further details."
+
+ # Add Cc for kernel commit authors
+ local cc_lines=""
+ if [[ -n "$pickup_commits" ]]; then
+ cc_lines=$(format_commits 'Cc: %an <%ae>' "$pickup_commits" | sort -u)
+ fi
+
+ body+=$'\n'
+ body+=$'\n'
+ if [[ -n "$cc_lines" ]]; then
+ body+="$cc_lines"$'\n'
+ fi
+ body+="$(sign_off)"
+
+ cleanup_tmpdir "$beauty_tmpdir"
+
+ if ! git -C "$KERNEL_DIR" add "$tools_path"; then
+ err "Failed to stage $tools_path"
+ COMMIT_FAILED+=("$tools_path")
+ return 1
+ fi
+ if ! git -C "$KERNEL_DIR" commit "$tools_path" \
+ -m "$(printf '%s\n\n%s\n' "$subject" "$body")"; then
+ err "Commit failed for $tools_path"
+ COMMIT_FAILED+=("$tools_path")
+ return 1
+ fi
+
+ SYNCED_OK+=("$tools_path")
+ info "Committed: $subject"
+ echo ""
+}
+
+# --- Group related headers -----------------------------------------------
+#
+# Some headers should be committed together (e.g. all KVM arch headers,
+# all syscall tables). This function processes groups.
+
+process_group() {
+ local group_name="$1"
+ shift
+ local pairs=("$@")
+
+ if [[ ${#pairs[@]} -eq 0 ]]; then
+ return
+ fi
+
+ local file_count
+ file_count=$((${#pairs[@]} / 2))
+ info "Processing group: $group_name ($file_count files)"
+
+ local group_slug="${group_name// /-}"
+
+ local all_kernel_commits=""
+ local all_cc_lines=""
+ local all_warnings=""
+ local group_beauty_tmpdir=""
+ local group_beauty_body=""
+ local group_beauty_scripts=0
+ local files_to_add=()
+
+ # Collect info for all files in the group
+ local i=0
+ while [[ $i -lt ${#pairs[@]} ]]; do
+ local tools_path="${pairs[$i]}"
+ local kernel_path="${pairs[$((i+1))]}"
+ local fidx=$i
+ i=$((i + 2))
+
+ if [[ -n "$HEADER_FILTER" ]] && [[ "$kernel_path" != *"$HEADER_FILTER"* ]]; then
+ continue
+ fi
+
+ if kernel_matches_previous_tools_state "$kernel_path" "$tools_path"; then
+ warn "$tools_path matches a previous tools/ state, leaving it alone"
+ continue
+ fi
+
+ local sync_point pickup_commits=""
+ sync_point=$(find_sync_point "$kernel_path" "$tools_path")
+ if [[ -n "$sync_point" ]]; then
+ pickup_commits=$(find_kernel_commits "$kernel_path" \
+ "$tools_path" "$sync_point")
+ else
+ warn "No previous sync commit found for $tools_path"
+ fi
+ if [[ -n "$pickup_commits" ]]; then
+ all_kernel_commits+=$(format_commits ' %h ("%s")' "$pickup_commits")
+ all_kernel_commits+=$'\n'
+
+ local ccs
+ ccs=$(format_commits 'Cc: %an <%ae>' "$pickup_commits")
+ if [[ -n "$ccs" ]]; then
+ all_cc_lines+="$ccs"$'\n'
+ fi
+ fi
+
+ all_warnings+=" diff -u $tools_path $kernel_path"$'\n'
+
+ # Beauty string tables; the script reads the tools/ copy, so this
+ # runs before the copy too, also in a dry run.
+ local -a group_script_list=()
+ while IFS= read -r script; do
+ [[ -z "$script" ]] && continue
+ group_script_list+=("$script")
+ done < <(find_beauty_scripts "$kernel_path")
+ if [[ ${#group_script_list[@]} -gt 0 ]]; then
+ group_beauty_scripts=1
+ [[ -z "$group_beauty_tmpdir" ]] && group_beauty_tmpdir=$(mktemp -d)
+ local sidx=0
+ for script in "${group_script_list[@]}"; do
+ local script_name
+ script_name=$(basename "$script")
+ local before="$group_beauty_tmpdir/beauty.$fidx.$sidx.before"
+ local after="$group_beauty_tmpdir/beauty.$fidx.$sidx.after"
+
+ if ! run_beauty_pass "$script" "$kernel_path" "$tools_path" \
+ "$group_beauty_tmpdir" "$fidx.$sidx"; then
+ COPY_FAILED+=("$tools_path")
+ for f in "${files_to_add[@]}"; do
+ git -C "$KERNEL_DIR" checkout -- "$f" || \
+ err "Failed to revert $f"
+ done
+ cleanup_tmpdir "$group_beauty_tmpdir"
+ return 1
+ fi
+
+ if ! diff -q "$before" "$after" > /dev/null 2>&1; then
+ echo ""
+ info "Beauty string changes from $script_name:"
+ diff -u "$before" "$after" | head -60 || true
+ group_beauty_body+=$(beauty_body_fragment "$script" \
+ "$kernel_path" "$tools_path" "$before" "$after")
+ group_beauty_body+=$'\n'
+ fi
+ sidx=$((sidx + 1))
+ done
+ fi
+
+ if [[ $DRY_RUN -eq 0 ]]; then
+ if ! cp "$KERNEL_DIR/$kernel_path" "$KERNEL_DIR/$tools_path"; then
+ err "Failed to copy $kernel_path -> $tools_path"
+ COPY_FAILED+=("$tools_path")
+ for f in "${files_to_add[@]}"; do
+ git -C "$KERNEL_DIR" checkout -- "$f" || \
+ err "Failed to revert $f"
+ done
+ cleanup_tmpdir "$group_beauty_tmpdir"
+ return 1
+ fi
+ files_to_add+=("$tools_path")
+ info "Copied $kernel_path -> $tools_path"
+ else
+ info "(dry run) Would copy $kernel_path -> $tools_path"
+ fi
+ done
+
+ # The beauty before/after files are captured into the fragments above.
+ cleanup_tmpdir "$group_beauty_tmpdir"
+
+ if [[ ${#files_to_add[@]} -eq 0 ]]; then
+ return
+ fi
+
+ if [[ $BUILD -eq 1 ]]; then
+ # Collect all unique build targets for the group
+ local group_targets=""
+ for f in "${files_to_add[@]}"; do
+ classify_header "$f"
+ group_targets+=$(find_build_targets "$f" "$HDR_CLASS")
+ group_targets+=$'\n'
+ done
+ group_targets=$(echo "$group_targets" | sort -u | grep -v '^$')
+
+ show_build_targets "group $group_name" "$group_targets"
+ local build_failed=0
+ while IFS=: read -r name dir; do
+ [[ -z "$name" ]] && continue
+ detail " Build-testing $name ($dir)..."
+ local log="$OUTPUT_DIR/$name.$group_slug.log"
+ if ! build_target "$name" "$dir" > "$log" 2>&1; then
+ err " $name build failed, see $log"
+ build_failed=1
+ fi
+ done <<< "$group_targets"
+
+ if [[ $build_failed -eq 1 ]]; then
+ err "Build failed after copying group $group_name — reverting."
+ for f in "${files_to_add[@]}"; do
+ git -C "$KERNEL_DIR" checkout -- "$f" || \
+ err "Failed to revert $f"
+ BUILD_FAILED+=("$f (group: $group_name)")
+ done
+ return 1
+ fi
+ info "Build OK."
+ fi
+
+ if [[ $DRY_RUN -eq 1 ]]; then
+ return
+ fi
+
+ if [[ $COMMIT -eq 0 ]]; then
+ for f in "${files_to_add[@]}"; do
+ SYNCED_OK+=("$f")
+ done
+ return
+ fi
+
+ # Deduplicate kernel commits and Cc lines; the commits keep the git log
+ # order they came in, the Cc lines stay sorted.
+ all_kernel_commits=$(printf '%s\n' "$all_kernel_commits" | \
+ awk 'NF && !seen[$0]++')
+ all_cc_lines=$(echo "$all_cc_lines" | sort -u | grep -v '^$' || true)
+
+ local subject="tools headers: Sync $group_name with the kernel sources"
+ local body=""
+
+ if [[ -n "$all_kernel_commits" ]]; then
+ body+="To pick up the changes in:"
+ body+=$'\n'
+ body+=$'\n'
+ body+="$all_kernel_commits"
+ body+=$'\n'
+ fi
+
+ if [[ -n "$group_beauty_body" ]]; then
+ body+=$'\n'
+ body+="That introduce these new entries in the string tables:"
+ body+=$'\n'
+ body+="$group_beauty_body"
+ elif [[ $group_beauty_scripts -eq 1 ]]; then
+ body+=$'\n'
+ body+="That don't result in changes to the string tables generated"
+ body+=" from these headers."
+ fi
+
+ body+=$'\n'
+ body+=$'\n'
+ body+="This addresses these perf build warnings:"
+ body+=$'\n'
+ body+=$'\n'
+ body+=" Warning: Kernel ABI header differences:"
+ body+=$'\n'
+ body+="$all_warnings"
+ body+=$'\n'
+ body+="Please see tools/include/uapi/README for further details."
+ body+=$'\n'
+ body+=$'\n'
+ if [[ -n "$all_cc_lines" ]]; then
+ body+="$all_cc_lines"$'\n'
+ fi
+ body+="$(sign_off)"
+
+ for f in "${files_to_add[@]}"; do
+ if ! git -C "$KERNEL_DIR" add "$f"; then
+ err "Failed to stage $f"
+ for g in "${files_to_add[@]}"; do
+ COMMIT_FAILED+=("$g")
+ done
+ return 1
+ fi
+ done
+
+ if ! git -C "$KERNEL_DIR" commit "${files_to_add[@]}" \
+ -m "$(printf '%s\n\n%s\n' "$subject" "$body")"; then
+ err "Commit failed for group $group_name"
+ for f in "${files_to_add[@]}"; do
+ COMMIT_FAILED+=("$f")
+ done
+ return 1
+ fi
+
+ for f in "${files_to_add[@]}"; do
+ SYNCED_OK+=("$f")
+ done
+
+ info "Committed: $subject"
+ echo ""
+}
+
+# --- Main -----------------------------------------------------------------
+
+main() {
+ cd "$KERNEL_DIR"
+
+ if [[ ! -d include/uapi ]]; then
+ err "Must be run from a kernel tree root (or tools/perf/)"
+ exit 1
+ fi
+
+ if [[ ! -d tools/perf ]]; then
+ err "Cannot find tools/perf/ in kernel tree"
+ exit 1
+ fi
+
+ setup_beauty_args || true
+
+ if [[ $BUILD -eq 1 ]]; then
+ # umask covers every level created, -m with -p only the last.
+ (umask 077 && mkdir -p "$OUTPUT_DIR")
+ fi
+
+ # Check for uncommitted changes in tools/
+ if ! git diff --quiet -- tools/include/ tools/perf/trace/beauty/ tools/perf/util/ tools/perf/arch/*/entry/syscalls/ tools/scripts/ tools/lib/ tools/arch/; then
+ warn "You have uncommitted changes in tools/. Commit or stash them first."
+ if [[ $DRY_RUN -eq 0 ]]; then
+ exit 1
+ fi
+ fi
+
+ info "Running check-headers to detect stale copies..."
+ echo ""
+
+ local stale
+ if ! stale=$(detect_stale_headers); then
+ info "All headers are up to date."
+ exit 0
+ fi
+
+ echo "Stale headers found:"
+ echo "$stale"
+ echo ""
+
+ # Parse the stale header pairs and group them
+ # Each line is: tools_path kernel_path
+ local kvm_group=()
+ local syscall_group=()
+ local singles=()
+
+ while IFS=' ' read -r tools_path kernel_path; do
+ case "$kernel_path" in
+ *kvm.h|*svm.h|*vmx.h|*sie.h)
+ kvm_group+=("$tools_path" "$kernel_path")
+ ;;
+ *syscall*.tbl|*unistd.h)
+ syscall_group+=("$tools_path" "$kernel_path")
+ ;;
+ *)
+ singles+=("$tools_path" "$kernel_path")
+ ;;
+ esac
+ done <<< "$stale"
+
+ # Process individual headers first (beauty and simple copies).
+ # || true: continue on failure; failures are tracked in BUILD_FAILED[],
+ # COPY_FAILED[] and COMMIT_FAILED[] and reported in the summary.
+ local i=0
+ while [[ $i -lt ${#singles[@]} ]]; do
+ process_header "${singles[$i]}" "${singles[$((i+1))]}" || true
+ i=$((i + 2))
+ done
+
+ # Process grouped headers
+ if [[ ${#kvm_group[@]} -gt 0 ]]; then
+ process_group "KVM headers" "${kvm_group[@]}" || true
+ fi
+
+ if [[ ${#syscall_group[@]} -gt 0 ]]; then
+ process_group "syscall tables and unistd.h" "${syscall_group[@]}" || true
+ fi
+
+ # Summary
+ echo ""
+ echo "========================================="
+ echo " Summary"
+ echo "========================================="
+
+ if [[ ${#SYNCED_OK[@]} -gt 0 ]]; then
+ info "Synced successfully (${#SYNCED_OK[@]}):"
+ for f in "${SYNCED_OK[@]}"; do
+ echo " $f"
+ done
+ fi
+
+ if [[ ${#BUILD_FAILED[@]} -gt 0 ]]; then
+ echo ""
+ err "Build failures (${#BUILD_FAILED[@]}) — reverted, need manual attention:"
+ for f in "${BUILD_FAILED[@]}"; do
+ echo " $f"
+ done
+ fi
+
+ if [[ ${#COPY_FAILED[@]} -gt 0 ]]; then
+ echo ""
+ err "Copy failures (${#COPY_FAILED[@]}) — need manual attention:"
+ for f in "${COPY_FAILED[@]}"; do
+ echo " $f"
+ done
+ fi
+
+ if [[ ${#COMMIT_FAILED[@]} -gt 0 ]]; then
+ echo ""
+ err "Commit failures (${#COMMIT_FAILED[@]}) — need manual attention:"
+ for f in "${COMMIT_FAILED[@]}"; do
+ echo " $f"
+ done
+ fi
+
+ # Final check-headers run to see what's still out of sync
+ echo ""
+ local remaining
+ if remaining=$(detect_stale_headers); then
+ warn "Headers still out of sync:"
+ echo "$remaining"
+ else
+ info "All headers are now in sync."
+ fi
+
+ if [[ ${#BUILD_FAILED[@]} -gt 0 || ${#COPY_FAILED[@]} -gt 0 || \
+ ${#COMMIT_FAILED[@]} -gt 0 ]]; then
+ exit 1
+ fi
+}
+
+main "$@"
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:38 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h " Arnaldo Carvalho de Melo
` (9 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Yuyang Huang
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
7cb8198761e6 ("net: ipv4: report multicast group user count")
That just rebuilds perf, silencing this build warning.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/if_addr.h include/uapi/linux/if_addr.h
Please see tools/include/uapi/README for further details.
Cc: Yuyang Huang <sigefriedhyy@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/uapi/linux/if_addr.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/include/uapi/linux/if_addr.h b/tools/include/uapi/linux/if_addr.h
index aa7958b4e41d044b..7fb630b7fe311ab4 100644
--- a/tools/include/uapi/linux/if_addr.h
+++ b/tools/include/uapi/linux/if_addr.h
@@ -36,6 +36,7 @@ enum {
IFA_RT_PRIORITY, /* u32, priority/metric for prefix route */
IFA_TARGET_NETNSID,
IFA_PROTO, /* u8, address protocol */
+ IFA_MC_USERS, /* u32, multicast group users */
__IFA_MAX,
};
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h " Arnaldo Carvalho de Melo
` (8 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Yuyang Huang
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
cc17e386f8a5 ("ipv6: add ip6_del_rt_reason()")
That just rebuilds perf, silencing this build warning.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/rtnetlink.h include/uapi/linux/rtnetlink.h
Please see tools/include/uapi/README for further details.
Cc: Yuyang Huang <sigefriedhyy@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/uapi/linux/rtnetlink.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/tools/include/uapi/linux/rtnetlink.h b/tools/include/uapi/linux/rtnetlink.h
index 27265fd31e5fc99c..3988b51db539fe4f 100644
--- a/tools/include/uapi/linux/rtnetlink.h
+++ b/tools/include/uapi/linux/rtnetlink.h
@@ -399,6 +399,7 @@ enum rtattr_type_t {
RTA_DPORT,
RTA_NH_ID,
RTA_FLOWLABEL,
+ RTA_DEL_REASON,
__RTA_MAX
};
@@ -407,6 +408,30 @@ enum rtattr_type_t {
#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
+/* RTA_DEL_REASON: why the kernel deleted the route. u32.
+ * Emitted only on RTM_DELROUTE notifications, and only when the deletion
+ * path records a cause. Absence means either an older kernel or a
+ * deletion path that does not (yet) record its cause - consumers must
+ * treat "absent" and "unspec" identically. New causes may be appended.
+ * Currently only IPv6 deletion paths record a cause.
+ *
+ * The attribute is notification-only: the kernel rejects it in
+ * requests, so a notification must not be echoed back verbatim.
+ *
+ * The value space is family-agnostic: a value must never be
+ * reinterpreted per address family. A cause that only one family can
+ * produce still gets its own value rather than reusing another
+ * family's.
+ */
+enum rt_del_reason {
+ RT_DEL_REASON_UNSPEC, /* cause not recorded */
+ RT_DEL_REASON_EXPIRED, /* RTF_EXPIRES lifetime ran out (GC) */
+ RT_DEL_REASON_RA_WITHDRAWN, /* zero-lifetime RA / PIO / RIO */
+ __RT_DEL_REASON_MAX
+};
+
+#define RT_DEL_REASON_MAX (__RT_DEL_REASON_MAX - 1)
+
/* RTM_MULTIPATH --- array of struct rtnexthop.
*
* "struct rtnexthop" describes all necessary nexthop information,
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:38 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 05/12] tools headers x86 cpufeatures: Sync " Arnaldo Carvalho de Melo
` (7 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Johannes Weiner
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
f6c786a95e95 ("mm: gfp_types: fix __GFP_ACCOUNT, GFP_KERNEL_ACCOUNT documentation")
That just rebuilds perf, silencing this build warning.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/include/linux/gfp_types.h include/linux/gfp_types.h
Please see tools/include/uapi/README for further details.
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/include/linux/gfp_types.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/include/linux/gfp_types.h b/tools/include/linux/gfp_types.h
index da47aa089f01c992..190191411009f265 100644
--- a/tools/include/linux/gfp_types.h
+++ b/tools/include/linux/gfp_types.h
@@ -134,7 +134,8 @@ enum {
* %__GFP_THISNODE forces the allocation to be satisfied from the requested
* node with no fallbacks or placement policy enforcements.
*
- * %__GFP_ACCOUNT causes the allocation to be accounted to kmemcg.
+ * %__GFP_ACCOUNT causes the allocation to be accounted to the active
+ * cgroup context.
*/
#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)
#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE)
@@ -313,7 +314,7 @@ enum {
* %ZONE_NORMAL or a lower zone for direct access but can direct reclaim.
*
* %GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is
- * accounted to kmemcg.
+ * accounted to the active cgroup context.
*
* %GFP_NOWAIT is for kernel allocations that should not stall for direct
* reclaim, start physical IO or use any filesystem callback. It is very
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 05/12] tools headers x86 cpufeatures: Sync with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:42 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy " Arnaldo Carvalho de Melo
` (6 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Borislav Petkov (AMD), Ewan Hai-oc,
Ricardo Neri
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
87db7795cbaa ("x86/CPU/AMD: Fix AMD TLBI Erratum #1718")
dcfb0f2c067a ("KVM: x86: Expose Zhaoxin RSA CPUID feature")
54db9aaacc2a ("KVM: x86: Expose Zhaoxin PHE2 CPUID feature")
93134f14106b ("KVM: x86: Expose Zhaoxin RNG2 CPUID feature")
3ee865eb696f ("KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) CPUID feature")
d99fc2a7c5e2 ("KVM: x86: Expose Zhaoxin SM2 CPUID feature")
ac5cc691eb4a ("x86/thermal: Add bit definitions for Intel Directed Package Thermal Interrupt")
That just rebuilds perf, silencing this build warning.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Please see tools/include/uapi/README for further details.
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Ewan Hai-oc <ewanhai-oc@zhaoxin.com>
Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/x86/include/asm/cpufeatures.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h
index 6547c0aee45b7781..fe84cf4e97d35a7d 100644
--- a/tools/arch/x86/include/asm/cpufeatures.h
+++ b/tools/arch/x86/include/asm/cpufeatures.h
@@ -136,8 +136,12 @@
#define X86_FEATURE_HYPERVISOR ( 4*32+31) /* "hypervisor" Running on a hypervisor */
/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
+#define X86_FEATURE_SM2 ( 5*32+ 0) /* "sm2" SM2 algorithm */
+#define X86_FEATURE_SM2_EN ( 5*32+ 1) /* "sm2_en" SM2 enabled */
#define X86_FEATURE_XSTORE ( 5*32+ 2) /* "rng" RNG present (xstore) */
#define X86_FEATURE_XSTORE_EN ( 5*32+ 3) /* "rng_en" RNG enabled */
+#define X86_FEATURE_CCS ( 5*32+ 4) /* "ccs" SM3 + SM4 instructions */
+#define X86_FEATURE_CCS_EN ( 5*32+ 5) /* "ccs_en" CCS enabled */
#define X86_FEATURE_XCRYPT ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
#define X86_FEATURE_XCRYPT_EN ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */
#define X86_FEATURE_ACE2 ( 5*32+ 8) /* "ace2" Advanced Cryptography Engine v2 */
@@ -146,6 +150,12 @@
#define X86_FEATURE_PHE_EN ( 5*32+11) /* "phe_en" PHE enabled */
#define X86_FEATURE_PMM ( 5*32+12) /* "pmm" PadLock Montgomery Multiplier */
#define X86_FEATURE_PMM_EN ( 5*32+13) /* "pmm_en" PMM enabled */
+#define X86_FEATURE_RNG2 ( 5*32+22) /* "rng2" RNG v2 */
+#define X86_FEATURE_RNG2_EN ( 5*32+23) /* "rng2_en" RNG2 enabled */
+#define X86_FEATURE_PHE2 ( 5*32+25) /* "phe2" PadLock Hash Engine v2 */
+#define X86_FEATURE_PHE2_EN ( 5*32+26) /* "phe2_en" PHE2 enabled */
+#define X86_FEATURE_RSA ( 5*32+27) /* "rsa" Big-number arithmetic */
+#define X86_FEATURE_RSA_EN ( 5*32+28) /* "rsa_en" RSA enabled */
/* More extended AMD flags: CPUID level 0x80000001, ECX, word 6 */
#define X86_FEATURE_LAHF_LM ( 6*32+ 0) /* "lahf_lm" LAHF/SAHF in long mode */
@@ -365,6 +375,8 @@
#define X86_FEATURE_HWP_HIGHEST_PERF_CHANGE (14*32+15) /* HWP Highest perf change */
#define X86_FEATURE_HFI (14*32+19) /* "hfi" Hardware Feedback Interface */
+#define X86_FEATURE_DPTI (14*32+24) /* Intel Directed Package Thermal Interrupt */
+
/* AMD SVM Feature Identification, CPUID level 0x8000000a (EDX), word 15 */
#define X86_FEATURE_NPT (15*32+ 0) /* "npt" Nested Page Table support */
#define X86_FEATURE_LBRV (15*32+ 1) /* "lbrv" LBR Virtualization support */
@@ -465,6 +477,8 @@
#define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */
#define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
#define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */
+
+#define X86_FEATURE_TLBSYNC_SFW_NO (20*32+ 4) /* TLBI Erratum #1718 fixed in microcode */
#define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */
#define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */
@@ -575,4 +589,5 @@
#define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
#define X86_BUG_VMSCAPE X86_BUG( 1*32+10) /* "vmscape" CPU is affected by VMSCAPE attacks from guests */
#define X86_BUG_SEAMRET_INVD_VMCS X86_BUG( 1*32+11) /* "seamret_invd_vmcs" SEAMRET from P-SEAMLDR clears the current VMCS */
+#define X86_BUG_TLBI X86_BUG( 1*32+12) /* "tlbi" AMD TLBI Erratum #1718 */
#endif /* _ASM_X86_CPUFEATURES_H */
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 05/12] tools headers x86 cpufeatures: Sync " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:45 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h " Arnaldo Carvalho de Melo
` (5 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Ricardo Neri
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
ac5cc691eb4a ("x86/thermal: Add bit definitions for Intel Directed Package Thermal Interrupt")
That don't result in changes to the string tables generated from this header.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
Please see tools/include/uapi/README for further details.
Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/x86/include/asm/msr-index.h | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
index 9c26d4075c5f421e..3a8e51a0c9e88cf3 100644
--- a/tools/arch/x86/include/asm/msr-index.h
+++ b/tools/arch/x86/include/asm/msr-index.h
@@ -350,13 +350,6 @@
#define ARCH_PEBS_LBR_SHIFT 40
#define ARCH_PEBS_LBR (0x3ull << ARCH_PEBS_LBR_SHIFT)
#define ARCH_PEBS_VECR_XMM BIT_ULL(49)
-#define ARCH_PEBS_VECR_YMMH BIT_ULL(50)
-#define ARCH_PEBS_VECR_EGPRS BIT_ULL(51)
-#define ARCH_PEBS_VECR_OPMASK BIT_ULL(53)
-#define ARCH_PEBS_VECR_ZMMH BIT_ULL(54)
-#define ARCH_PEBS_VECR_H16ZMM BIT_ULL(55)
-#define ARCH_PEBS_VECR_EXT_SHIFT 49
-#define ARCH_PEBS_VECR_EXT (0x7full << ARCH_PEBS_VECR_EXT_SHIFT)
#define ARCH_PEBS_GPR BIT_ULL(61)
#define ARCH_PEBS_AUX BIT_ULL(62)
#define ARCH_PEBS_EN BIT_ULL(63)
@@ -1014,6 +1007,7 @@
#define THERM_INT_HIGH_ENABLE (1 << 0)
#define THERM_INT_LOW_ENABLE (1 << 1)
#define THERM_INT_PLN_ENABLE (1 << 24)
+#define THERM_INT_DPTI_ENABLE (1 << 25)
#define MSR_IA32_THERM_STATUS 0x0000019c
@@ -1043,6 +1037,7 @@
#define PACKAGE_THERM_STATUS_PROCHOT (1 << 0)
#define PACKAGE_THERM_STATUS_POWER_LIMIT (1 << 10)
+#define PACKAGE_THERM_STATUS_DPTI_ACK (1 << 25)
#define PACKAGE_THERM_STATUS_HFI_UPDATED (1 << 26)
#define MSR_IA32_PACKAGE_THERM_INTERRUPT 0x000001b2
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:41 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h " Arnaldo Carvalho de Melo
` (4 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Mahe Tardy, Christian Brauner
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
be3a5e06b962 ("net: add SO_PASSPIDFD_THREAD to get a thread-specific SCM_PIDFD")
5bd369c05576 ("net: Add connect_socket() helper")
That don't result in changes to the string tables generated from this header.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
Please see tools/include/uapi/README for further details.
Acked-by: Mahe Tardy <mahe.tardy@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/include/linux/socket.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/trace/beauty/include/linux/socket.h b/tools/perf/trace/beauty/include/linux/socket.h
index 2a8d7b14f1d11959..b17fdb7d38a7734a 100644
--- a/tools/perf/trace/beauty/include/linux/socket.h
+++ b/tools/perf/trace/beauty/include/linux/socket.h
@@ -189,10 +189,11 @@ static inline size_t msg_data_left(const struct msghdr *msg)
/* "Socket"-level control message types: */
-#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
-#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
-#define SCM_SECURITY 0x03 /* rw: security label */
-#define SCM_PIDFD 0x04 /* ro: pidfd (int) */
+#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
+#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
+#define SCM_SECURITY 0x03 /* rw: security label */
+#define SCM_PIDFD 0x04 /* ro: pidfd (int) */
+#define SCM_PIDFD_THREAD 0x05 /* ro: thread pidfd (int) */
struct ucred {
__u32 pid;
@@ -461,6 +462,8 @@ extern struct file *__sys_socket_file(int family, int type, int protocol);
extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
extern int __sys_bind_socket(struct socket *sock, struct sockaddr_storage *address,
int addrlen);
+int connect_socket(struct socket *sock, struct sockaddr_storage *addr,
+ int addrlen, int flags);
extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr,
int addrlen, int file_flags);
extern int __sys_connect(int fd, struct sockaddr __user *uservaddr,
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h " Arnaldo Carvalho de Melo
` (3 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Christian Brauner
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
cdf930a00949 ("fs: support FD_FAILFS_ROOT in fchdir()")
That don't result in changes to the string tables generated from this header.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
Please see tools/include/uapi/README for further details.
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/include/uapi/linux/fcntl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/fcntl.h b/tools/perf/trace/beauty/include/uapi/linux/fcntl.h
index aadfbf6e0cb3a004..e43e3de3e9ee44a2 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/fcntl.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/fcntl.h
@@ -124,6 +124,7 @@ struct delegation {
#define FD_PIDFS_ROOT -10002 /* Root of the pidfs filesystem */
#define FD_NSFS_ROOT -10003 /* Root of the nsfs filesystem */
+#define FD_FAILFS_ROOT -10004 /* Root of the failfs filesystem */
#define FD_INVALID -10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */
/* Generic flags for the *at(2) family of syscalls. */
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:42 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h " Arnaldo Carvalho de Melo
` (2 subsequent siblings)
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Hemanth Selam, Kiryl Shutsemau (Meta)
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
21a62663d473 ("fs: fix typos in comments")
338964881982 ("mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking")
That don't result in changes to the string tables generated from this header.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h
Please see tools/include/uapi/README for further details.
Cc: Hemanth Selam <hemanth.selam@gmail.com>
Cc: Kiryl Shutsemau (Meta) <kas@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/include/uapi/linux/fs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/fs.h b/tools/perf/trace/beauty/include/uapi/linux/fs.h
index ee2203d606436f42..a46c33692aa21af0 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/fs.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/fs.h
@@ -471,6 +471,7 @@ typedef int __bitwise __kernel_rwf_t;
#define PAGE_IS_HUGE (1 << 6)
#define PAGE_IS_SOFT_DIRTY (1 << 7)
#define PAGE_IS_GUARD (1 << 8)
+#define PAGE_IS_ACCESSED (1 << 9)
/*
* struct page_region - Page region with flags
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:41 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with " Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 12/12] tools headers: Sync KVM headers with the " Arnaldo Carvalho de Melo
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Kir Kolyshkin
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
73b40395c71c ("mount: add OPEN_TREE_DROP_MNTNS_MOUNTS")
That don't result in changes to the string tables generated from this header.
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h
Please see tools/include/uapi/README for further details.
Cc: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/include/uapi/linux/mount.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/mount.h b/tools/perf/trace/beauty/include/uapi/linux/mount.h
index 2204708dbf7a583a..ac865edac5173e26 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/mount.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/mount.h
@@ -63,6 +63,7 @@
*/
#define OPEN_TREE_CLONE (1 << 0) /* Clone the target tree and attach the clone */
#define OPEN_TREE_NAMESPACE (1 << 1) /* Clone the target tree into a new mount namespace */
+#define OPEN_TREE_DROP_MNTNS_MOUNTS (1 << 2) /* Drop mntns mounts from the clone */
#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
/*
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 12/12] tools headers: Sync KVM headers with the " Arnaldo Carvalho de Melo
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Maciej Strozek, Takashi Iwai
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
91415225fbfb ("ALSA: uapi: Drop __bitwise and __force prefix")
86cac980c966 ("ALSA: control: add ioctl to retrieve full card components")
That introduce these new entries in the string tables:
$ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh tools/perf/trace/beauty/include/uapi/sound/ > before.txt
$ cp include/uapi/sound/asound.h tools/perf/trace/beauty/include/uapi/sound/asound.h
$ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh tools/perf/trace/beauty/include/uapi/sound/ > after.txt
$ diff -u before.txt after.txt
@@ -1,6 +1,7 @@
static const char *sndrv_ctl_ioctl_cmds[] = {
[0x00] = "PVERSION",
[0x01] = "CARD_INFO",
+ [0x02] = "CARD_BYTES",
[0x10] = "ELEM_LIST",
[0x11] = "ELEM_INFO",
[0x12] = "ELEM_READ",
This addresses this perf build warning:
Warning: Kernel ABI header differences:
diff -u tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h
Please see tools/include/uapi/README for further details.
Cc: Maciej Strozek <mstrozek@opensource.cirrus.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../trace/beauty/include/uapi/sound/asound.h | 200 ++++++++++--------
1 file changed, 110 insertions(+), 90 deletions(-)
diff --git a/tools/perf/trace/beauty/include/uapi/sound/asound.h b/tools/perf/trace/beauty/include/uapi/sound/asound.h
index d3ce75ba938a8497..c11da9656e3811d2 100644
--- a/tools/perf/trace/beauty/include/uapi/sound/asound.h
+++ b/tools/perf/trace/beauty/include/uapi/sound/asound.h
@@ -169,72 +169,72 @@ enum {
SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
};
-typedef int __bitwise snd_pcm_access_t;
-#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
-#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
-#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
-#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
-#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
+typedef int snd_pcm_access_t;
+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED 0 /* interleaved mmap */
+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED 1 /* noninterleaved mmap */
+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX 2 /* complex mmap */
+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED 3 /* readi/writei */
+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED 4 /* readn/writen */
#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
-typedef int __bitwise snd_pcm_format_t;
-#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
-#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
-#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
-#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
-#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
-#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
-#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
-#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
-#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
-#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
+typedef int snd_pcm_format_t;
+#define SNDRV_PCM_FORMAT_S8 0
+#define SNDRV_PCM_FORMAT_U8 1
+#define SNDRV_PCM_FORMAT_S16_LE 2
+#define SNDRV_PCM_FORMAT_S16_BE 3
+#define SNDRV_PCM_FORMAT_U16_LE 4
+#define SNDRV_PCM_FORMAT_U16_BE 5
+#define SNDRV_PCM_FORMAT_S24_LE 6 /* low three bytes */
+#define SNDRV_PCM_FORMAT_S24_BE 7 /* low three bytes */
+#define SNDRV_PCM_FORMAT_U24_LE 8 /* low three bytes */
+#define SNDRV_PCM_FORMAT_U24_BE 9 /* low three bytes */
/*
* For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
* available bit count in most significant bit. It's for the case of so-called 'left-justified' or
* `right-padding` sample which has less width than 32 bit.
*/
-#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
-#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
-#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
-#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
-#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
-#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
-#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
-#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
-#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
-#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
-#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_S32_LE 10
+#define SNDRV_PCM_FORMAT_S32_BE 11
+#define SNDRV_PCM_FORMAT_U32_LE 12
+#define SNDRV_PCM_FORMAT_U32_BE 13
+#define SNDRV_PCM_FORMAT_FLOAT_LE 14 /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT_BE 15 /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT64_LE 16 /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT64_BE 17 /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE 18 /* IEC-958 subframe, Little Endian */
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE 19 /* IEC-958 subframe, Big Endian */
+#define SNDRV_PCM_FORMAT_MU_LAW 20
+#define SNDRV_PCM_FORMAT_A_LAW 21
+#define SNDRV_PCM_FORMAT_IMA_ADPCM 22
+#define SNDRV_PCM_FORMAT_MPEG 23
+#define SNDRV_PCM_FORMAT_GSM 24
+#define SNDRV_PCM_FORMAT_S20_LE 25 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_S20_BE 26 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_U20_LE 27 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_U20_BE 28 /* in four bytes, LSB justified */
/* gap in the numbering for a future standard linear format */
-#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
-#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
-#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
-#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
-#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
-#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
-#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
-#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
-#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
-#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
-#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
+#define SNDRV_PCM_FORMAT_SPECIAL 31
+#define SNDRV_PCM_FORMAT_S24_3LE 32 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S24_3BE 33 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U24_3LE 34 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U24_3BE 35 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S20_3LE 36 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S20_3BE 37 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U20_3LE 38 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U20_3BE 39 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S18_3LE 40 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S18_3BE 41 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U18_3LE 42 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U18_3BE 43 /* in three bytes */
+#define SNDRV_PCM_FORMAT_G723_24 44 /* 8 samples in 3 bytes */
+#define SNDRV_PCM_FORMAT_G723_24_1B 45 /* 1 sample in 1 byte */
+#define SNDRV_PCM_FORMAT_G723_40 46 /* 8 Samples in 5 bytes */
+#define SNDRV_PCM_FORMAT_G723_40_1B 47 /* 1 sample in 1 byte */
+#define SNDRV_PCM_FORMAT_DSD_U8 48 /* DSD, 1-byte samples DSD (x8) */
+#define SNDRV_PCM_FORMAT_DSD_U16_LE 49 /* DSD, 2-byte samples DSD (x16), little endian */
+#define SNDRV_PCM_FORMAT_DSD_U32_LE 50 /* DSD, 4-byte samples DSD (x32), little endian */
+#define SNDRV_PCM_FORMAT_DSD_U16_BE 51 /* DSD, 2-byte samples DSD (x16), big endian */
+#define SNDRV_PCM_FORMAT_DSD_U32_BE 52 /* DSD, 4-byte samples DSD (x32), big endian */
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
@@ -265,11 +265,11 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
#endif
-typedef int __bitwise snd_pcm_subformat_t;
-#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX ((__force snd_pcm_subformat_t) 1)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_20 ((__force snd_pcm_subformat_t) 2)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_24 ((__force snd_pcm_subformat_t) 3)
+typedef int snd_pcm_subformat_t;
+#define SNDRV_PCM_SUBFORMAT_STD 0
+#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX 1
+#define SNDRV_PCM_SUBFORMAT_MSBITS_20 2
+#define SNDRV_PCM_SUBFORMAT_MSBITS_24 3
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
@@ -303,16 +303,16 @@ typedef int __bitwise snd_pcm_subformat_t;
#define __SND_STRUCT_TIME64
#endif
-typedef int __bitwise snd_pcm_state_t;
-#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
-#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
-#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
-#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
-#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
-#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
-#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
-#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
-#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
+typedef int snd_pcm_state_t;
+#define SNDRV_PCM_STATE_OPEN 0 /* stream is open */
+#define SNDRV_PCM_STATE_SETUP 1 /* stream has a setup */
+#define SNDRV_PCM_STATE_PREPARED 2 /* stream is ready to start */
+#define SNDRV_PCM_STATE_RUNNING 3 /* stream is running */
+#define SNDRV_PCM_STATE_XRUN 4 /* stream reached an xrun */
+#define SNDRV_PCM_STATE_DRAINING 5 /* stream is draining */
+#define SNDRV_PCM_STATE_PAUSED 6 /* stream is paused */
+#define SNDRV_PCM_STATE_SUSPENDED 7 /* hardware is suspended */
+#define SNDRV_PCM_STATE_DISCONNECTED 8 /* hardware is disconnected */
#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
enum {
@@ -1058,7 +1058,7 @@ struct snd_timer_tread {
* *
****************************************************************************/
-#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
+#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10)
struct snd_ctl_card_info {
int card; /* card number */
@@ -1072,24 +1072,43 @@ struct snd_ctl_card_info {
unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
};
-typedef int __bitwise snd_ctl_elem_type_t;
-#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
-#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
-#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
-#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
-#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
-#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
-#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
+/*
+ * Card components can exceed the fixed 128 bytes in snd_ctl_card_info.
+ * Use SNDRV_CTL_IOCTL_CARD_BYTES with type SND_CTL_CARD_BTYPE_COMPONENTS
+ * to retrieve the full string.
+ */
+
+/* Type values for struct snd_ctl_card_bytes::type */
+enum {
+ SND_CTL_CARD_BTYPE_COMPONENTS = 1, /* full card components string */
+};
+
+struct snd_ctl_card_bytes {
+ __u32 type; /* SND_CTL_CARD_BTYPE_* */
+ __u32 data_allocated; /* size of @data buffer in bytes */
+ __u32 data_len; /* in/out: actual data length in bytes */
+ __u32 reserved; /* explicit pad */
+ __u64 data; /* user buffer (pointer stored as __u64) */
+};
+
+typedef int snd_ctl_elem_type_t;
+#define SNDRV_CTL_ELEM_TYPE_NONE 0 /* invalid */
+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN 1 /* boolean type */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER 2 /* integer type */
+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED 3 /* enumerated type */
+#define SNDRV_CTL_ELEM_TYPE_BYTES 4 /* byte array */
+#define SNDRV_CTL_ELEM_TYPE_IEC958 5 /* IEC958 (S/PDIF) setup */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 6 /* 64-bit integer type */
#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
-typedef int __bitwise snd_ctl_elem_iface_t;
-#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
-#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
-#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
-#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
-#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
-#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
-#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
+typedef int snd_ctl_elem_iface_t;
+#define SNDRV_CTL_ELEM_IFACE_CARD 0 /* global control */
+#define SNDRV_CTL_ELEM_IFACE_HWDEP 1 /* hardware dependent device */
+#define SNDRV_CTL_ELEM_IFACE_MIXER 2 /* virtual mixer device */
+#define SNDRV_CTL_ELEM_IFACE_PCM 3 /* PCM device */
+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI 4 /* RawMidi device */
+#define SNDRV_CTL_ELEM_IFACE_TIMER 5 /* timer device */
+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER 6 /* sequencer client */
#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
@@ -1198,6 +1217,7 @@ struct snd_ctl_tlv {
#define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int)
#define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info)
+#define SNDRV_CTL_IOCTL_CARD_BYTES _IOWR('U', 0x02, struct snd_ctl_card_bytes)
#define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list)
#define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info)
#define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value)
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 12/12] tools headers: Sync KVM headers with the kernel sources
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2026-10-21 22:35 ` [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with " Arnaldo Carvalho de Melo
@ 2026-10-21 22:35 ` Arnaldo Carvalho de Melo
2026-10-21 22:55 ` sashiko-bot
11 siblings, 1 reply; 25+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-10-21 22:35 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ingo Molnar, Thomas Gleixner, James Clark, Jiri Olsa, Ian Rogers,
Adrian Hunter, Clark Williams, linux-perf-users,
Arnaldo Carvalho de Melo, Amit Machhiwal, Congkai Tan
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To pick up the changes in:
ac3e65ddddf3 ("KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl")
ad220e275c39 ("KVM: arm64: Add KVM_ARM_VCPU_PMU_V3_STRICT vCPU feature")
b76fb087efcd ("KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM")
453f6ff04b8d ("KVM: arm64: Expose PMMIR_EL1.SLOTS under strict PMUv3 UAPI")
That don't result in changes to the string tables generated from these headers.
This addresses these perf build warnings:
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
Please see tools/include/uapi/README for further details.
Cc: Amit Machhiwal <amachhiw@linux.ibm.com>
Cc: Congkai Tan <congkai@amazon.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/arch/arm64/include/uapi/asm/kvm.h | 1 +
tools/arch/powerpc/include/uapi/asm/kvm.h | 18 ++++++++++++++++++
tools/include/uapi/linux/kvm.h | 4 ++++
3 files changed, 23 insertions(+)
diff --git a/tools/arch/arm64/include/uapi/asm/kvm.h b/tools/arch/arm64/include/uapi/asm/kvm.h
index 1c13bfa2d38aada4..019e5e3d892e6dc5 100644
--- a/tools/arch/arm64/include/uapi/asm/kvm.h
+++ b/tools/arch/arm64/include/uapi/asm/kvm.h
@@ -106,6 +106,7 @@ struct kvm_regs {
#define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication */
#define KVM_ARM_VCPU_HAS_EL2 7 /* Support nested virtualization */
#define KVM_ARM_VCPU_HAS_EL2_E2H0 8 /* Limit NV support to E2H RES0 */
+#define KVM_ARM_VCPU_PMU_V3_STRICT 9 /* No default PMU creation */
struct kvm_vcpu_init {
__u32 target;
diff --git a/tools/arch/powerpc/include/uapi/asm/kvm.h b/tools/arch/powerpc/include/uapi/asm/kvm.h
index 077c5437f5219b05..913a64b901a3d702 100644
--- a/tools/arch/powerpc/include/uapi/asm/kvm.h
+++ b/tools/arch/powerpc/include/uapi/asm/kvm.h
@@ -437,6 +437,24 @@ struct kvm_ppc_cpu_char {
__u64 behaviour_mask; /* valid bits in behaviour */
};
+/* For KVM_PPC_GET_COMPAT_CAPS */
+struct kvm_ppc_compat_caps {
+ __u64 size; /* Size of this structure */
+ __u64 flags; /* Reserved for future use */
+ __u64 compat_capabilities; /* Capabilities supported by the host */
+};
+#define KVM_PPC_COMPAT_CAPS_SIZE_VER0 24 /* sizeof first published struct */
+
+/*
+ * Capability bits for compat_capabilities field in kvm_ppc_compat_caps.
+ * These bits indicate which processor compatibility modes are supported.
+ */
+#define KVM_PPC_COMPAT_CAP_POWER9 (1ULL << 62)
+#define KVM_PPC_COMPAT_CAP_POWER10 (1ULL << 61)
+#define KVM_PPC_COMPAT_CAP_POWER11 (1ULL << 60)
+#define KVM_PPC_COMPAT_BITMASK (KVM_PPC_COMPAT_CAP_POWER9 | \
+ KVM_PPC_COMPAT_CAP_POWER10 | \
+ KVM_PPC_COMPAT_CAP_POWER11)
/*
* Values for character and character_mask.
* These are identical to the values used by H_GET_CPU_CHARACTERISTICS.
diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h
index 419011097fa8e2c6..ac2d77d14963560d 100644
--- a/tools/include/uapi/linux/kvm.h
+++ b/tools/include/uapi/linux/kvm.h
@@ -997,6 +997,8 @@ struct kvm_enable_cap {
#define KVM_CAP_S390_KEYOP 247
#define KVM_CAP_S390_VSIE_ESAMODE 248
#define KVM_CAP_S390_HPAGE_2G 249
+#define KVM_CAP_PPC_COMPAT_CAPS 250
+#define KVM_CAP_ARM_PMU_V3_STRICT 251
struct kvm_irq_routing_irqchip {
__u32 irqchip;
@@ -1341,6 +1343,8 @@ struct kvm_s390_keyop {
/* Available with KVM_CAP_COUNTER_OFFSET */
#define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_counter_offset)
#define KVM_ARM_GET_REG_WRITABLE_MASKS _IOR(KVMIO, 0xb6, struct reg_mask_range)
+/* Available with KVM_CAP_PPC_COMPAT_CAPS */
+#define KVM_PPC_GET_COMPAT_CAPS _IO(KVMIO, 0xb8)
/* ioctl for vm fd */
#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
--
2.56.0
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:38 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:38 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> f6c786a95e95 ("mm: gfp_types: fix __GFP_ACCOUNT, GFP_KERNEL_ACCOUNT documentation")
>
> That just rebuilds perf, silencing this build warning.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/include/linux/gfp_types.h include/linux/gfp_types.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=4
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources Arnaldo Carvalho de Melo
@ 2026-10-21 22:38 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:38 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> 7cb8198761e6 ("net: ipv4: report multicast group user count")
>
> That just rebuilds perf, silencing this build warning.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/include/uapi/linux/if_addr.h include/uapi/linux/if_addr.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Yuyang Huang <sigefriedhyy@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=2
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:39 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> cc17e386f8a5 ("ipv6: add ip6_del_rt_reason()")
>
> That just rebuilds perf, silencing this build warning.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/include/uapi/linux/rtnetlink.h include/uapi/linux/rtnetlink.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Yuyang Huang <sigefriedhyy@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=3
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with kernel sources
2026-10-21 22:35 ` [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with " Arnaldo Carvalho de Melo
@ 2026-10-21 22:39 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> 91415225fbfb ("ALSA: uapi: Drop __bitwise and __force prefix")
> 86cac980c966 ("ALSA: control: add ioctl to retrieve full card components")
>
> That introduce these new entries in the string tables:
>
> $ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh tools/perf/trace/beauty/include/uapi/sound/ > before.txt
> $ cp include/uapi/sound/asound.h tools/perf/trace/beauty/include/uapi/sound/asound.h
> $ tools/perf/trace/beauty/sndrv_ctl_ioctl.sh tools/perf/trace/beauty/include/uapi/sound/ > after.txt
> $ diff -u before.txt after.txt
>
> @@ -1,6 +1,7 @@
> [ ... ]
> Please see tools/include/uapi/README for further details.
>
> Cc: Maciej Strozek <mstrozek@opensource.cirrus.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=11
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:39 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> cdf930a00949 ("fs: support FD_FAILFS_ROOT in fchdir()")
>
> That don't result in changes to the string tables generated from this header.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/perf/trace/beauty/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=8
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:41 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> be3a5e06b962 ("net: add SO_PASSPIDFD_THREAD to get a thread-specific SCM_PIDFD")
> 5bd369c05576 ("net: Add connect_socket() helper")
>
> That don't result in changes to the string tables generated from this header.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/perf/trace/beauty/include/linux/socket.h include/linux/socket.h
>
> Please see tools/include/uapi/README for further details.
>
> Acked-by: Mahe Tardy <mahe.tardy@gmail.com>
> Cc: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=7
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:41 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> 73b40395c71c ("mount: add OPEN_TREE_DROP_MNTNS_MOUNTS")
>
> That don't result in changes to the string tables generated from this header.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/perf/trace/beauty/include/uapi/linux/mount.h include/uapi/linux/mount.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Kir Kolyshkin <kolyshkin@gmail.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=10
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 05/12] tools headers x86 cpufeatures: Sync with the kernel sources
2026-10-21 22:35 ` [PATCH v2 05/12] tools headers x86 cpufeatures: Sync " Arnaldo Carvalho de Melo
@ 2026-10-21 22:42 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:42 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> 87db7795cbaa ("x86/CPU/AMD: Fix AMD TLBI Erratum #1718")
> dcfb0f2c067a ("KVM: x86: Expose Zhaoxin RSA CPUID feature")
> 54db9aaacc2a ("KVM: x86: Expose Zhaoxin PHE2 CPUID feature")
> 93134f14106b ("KVM: x86: Expose Zhaoxin RNG2 CPUID feature")
> 3ee865eb696f ("KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) CPUID feature")
> d99fc2a7c5e2 ("KVM: x86: Expose Zhaoxin SM2 CPUID feature")
> ac5cc691eb4a ("x86/thermal: Add bit definitions for Intel Directed Package Thermal Interrupt")
>
> That just rebuilds perf, silencing this build warning.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Borislav Petkov (AMD) <bp@alien8.de>
> Cc: Ewan Hai-oc <ewanhai-oc@zhaoxin.com>
> Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=5
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h with the kernel sources
2026-10-21 22:35 ` [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h " Arnaldo Carvalho de Melo
@ 2026-10-21 22:42 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:42 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> To pick up the changes in:
>
> 21a62663d473 ("fs: fix typos in comments")
> 338964881982 ("mm/pagemap: add PAGE_IS_ACCESSED for RWP tracking")
>
> That don't result in changes to the string tables generated from this header.
>
> This addresses this perf build warning:
>
> Warning: Kernel ABI header differences:
> diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h
>
> Please see tools/include/uapi/README for further details.
>
> Cc: Hemanth Selam <hemanth.selam@gmail.com>
> Cc: Kiryl Shutsemau (Meta) <kas@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=9
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy with the kernel sources
2026-10-21 22:35 ` [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy " Arnaldo Carvalho de Melo
@ 2026-10-21 22:45 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:45 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tools arch x86: msr-index.h sync reverts ARCH_PEBS_VECR_* macros
--
commit 78affd0f60ae68f3b52a636d7f03411361f2bbe0
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
tools arch x86: Sync the msr-index.h copy with the kernel sources
This commit synchronizes tools/arch/x86/include/asm/msr-index.h with the
kernel header to pick up thermal interrupt bit definitions from commit
ac5cc691eb4a ("x86/thermal: Add bit definitions for Intel Directed Package
Thermal Interrupt").
> diff --git a/tools/arch/x86/include/asm/msr-index.h b/tools/arch/x86/include/asm/msr-index.h
> index 9c26d4075c5f4..3a8e51a0c9e88 100644
> --- a/tools/arch/x86/include/asm/msr-index.h
> +++ b/tools/arch/x86/include/asm/msr-index.h
> @@ -350,13 +350,6 @@
> #define ARCH_PEBS_LBR_SHIFT 40
> #define ARCH_PEBS_LBR (0x3ull << ARCH_PEBS_LBR_SHIFT)
> #define ARCH_PEBS_VECR_XMM BIT_ULL(49)
> -#define ARCH_PEBS_VECR_YMMH BIT_ULL(50)
> -#define ARCH_PEBS_VECR_EGPRS BIT_ULL(51)
> -#define ARCH_PEBS_VECR_OPMASK BIT_ULL(53)
> -#define ARCH_PEBS_VECR_ZMMH BIT_ULL(54)
> -#define ARCH_PEBS_VECR_H16ZMM BIT_ULL(55)
> -#define ARCH_PEBS_VECR_EXT_SHIFT 49
> -#define ARCH_PEBS_VECR_EXT (0x7full << ARCH_PEBS_VECR_EXT_SHIFT)
> #define ARCH_PEBS_GPR BIT_ULL(61)
> #define ARCH_PEBS_AUX BIT_ULL(62)
> #define ARCH_PEBS_EN BIT_ULL(63)
[Severity: Medium]
Does syncing tools/arch/x86/include/asm/msr-index.h by overwriting it with
arch/x86/include/asm/msr-index.h unintentionally revert commit 7846bf499da3fe
("tools headers: Sync x86 headers with kernel sources")?
Commit 7846bf499da3fe added ARCH_PEBS_VECR_YMMH, ARCH_PEBS_VECR_EGPRS,
ARCH_PEBS_VECR_OPMASK, ARCH_PEBS_VECR_ZMMH, ARCH_PEBS_VECR_H16ZMM,
ARCH_PEBS_VECR_EXT_SHIFT, and ARCH_PEBS_VECR_EXT to
tools/arch/x86/include/asm/msr-index.h alongside commit eb89aef367e470 before
those kernel changes landed in arch/x86/include/asm/msr-index.h in this tree.
In tools/perf/scripts/sync-headers.sh, kernel_matches_previous_tools_state()
checks whether the kernel header's current blob exists in the history of the
tools header:
tools/perf/scripts/sync-headers.sh:kernel_matches_previous_tools_state() {
local kernel_path="$1"
local tools_path="$2"
local kernel_blob
kernel_blob=$(git hash-object "$kernel_path" 2>/dev/null) || return 1
[[ -n "$(git log --format=%h -1 --find-object="$kernel_blob" -- "$tools_path" 2>/dev/null)" ]]
}
Because arch/x86/include/asm/msr-index.h and
tools/arch/x86/include/asm/msr-index.h both diverged with independent commits
(ac5cc691eb4a and 7846bf499da3fe) since their last common sync point
(369e91bd201d15), kernel_matches_previous_tools_state() returns false and
process_header() overwrites the tools copy with the kernel copy.
While the commit message states this only picks up commit ac5cc691eb4a
("x86/thermal: Add bit definitions for Intel Directed Package Thermal
Interrupt"), should the ARCH_PEBS_VECR_* definitions from commit
7846bf499da3fe be preserved here?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=6
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel
2026-10-21 22:35 ` [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel Arnaldo Carvalho de Melo
@ 2026-10-21 22:53 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:53 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] perf tools: process_header() overwrites intentional tools/ header divergences
- [Medium] perf tools: setup_beauty_args() strips output file argument for syscalltbl.sh
- [Medium] perf tools: find_beauty_scripts() matches unrelated headers by basename
- [Medium] perf tools: build_target() fails when OUTPUT_DIR is a relative path
--
commit e56a03e1fdcaea6f774a4409b4149a6440687459
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tools: Add script and make target to sync the header copies with the kernel
This commit adds tools/perf/scripts/sync-headers.sh and a sync-headers make
target to detect stale tools/ header copies, run beauty table generators,
build-test consumers, and create standardized sync commits.
> diff --git a/tools/perf/scripts/sync-headers.sh b/tools/perf/scripts/sync-headers.sh
> new file mode 100755
> index 0000000000000..9a35a3d2095a7
> --- /dev/null
> +++ b/tools/perf/scripts/sync-headers.sh
[ ... ]
> +# --- Map a kernel header path to its beauty script(s) --------------------
> +#
> +# A beauty script is relevant if it reads from the directory containing
> +# the header being updated.
> +
> +find_beauty_scripts() {
> + local kernel_path="$1"
> + local header_basename
> + header_basename=$(basename "$kernel_path")
> +
> + local scripts=()
> +
> + # Search all beauty .sh scripts (including subdirs) for references to this header
> + while IFS= read -r script; do
> + if grep -F -q -e "/$header_basename" -e "\"$header_basename\"" \
> + "$script" 2>/dev/null; then
> + scripts+=("$script")
> + fi
> + done < <(find "$PERF_DIR"/trace/beauty -name '*.sh')
> +
> + printf '%s\n' "${scripts[@]}"
> +}
[Severity: Medium]
Could matching only on header_basename in find_beauty_scripts() associate a
beauty script with the wrong header copy when multiple tracked headers share
the same filename?
For example, include/uapi/linux/stat.h is copied to both
tools/include/uapi/linux/stat.h and
tools/perf/trace/beauty/include/uapi/linux/stat.h, while statx_mask.sh only
reads the beauty copy. When process_header() updates
tools/include/uapi/linux/stat.h, find_beauty_scripts() matches statx_mask.sh,
and run_beauty_pass() swaps tools/include/uapi/linux/stat.h while
statx_mask.sh reads the unupdated beauty copy. Because the output does not
change, process_header() then writes:
That don't result in changes to the string tables generated from this header.
instead of:
That just rebuilds perf, silencing this build warning.
Similar basename collisions happen between include/uapi/linux/prctl.h and
arch/x86/include/uapi/asm/prctl.h (matching both prctl_option.sh and
x86_arch_prctl.sh), arch/{x86,powerpc,s390,arm64}/include/uapi/asm/kvm.h
(matching kvm_ioctl.sh, which only reads tools/include/uapi/linux/kvm.h), and
arch/mips/include/asm/errno.h (matching arch_errno_names.sh).
Also, setup_beauty_args() only reads tools/perf/trace/beauty/Build and matches
lowercase variable names in re_tbl:
local build="$PERF_DIR/trace/beauty/Build"
...
re_tbl='^([a-z0-9_]+_tbl[s]?)[[:space:]]*(:=|\?=)[[:space:]]*'
Should setup_beauty_args() also parse
tools/perf/trace/beauty/tracepoints/Build and allow uppercase characters in
variable names so x86_irq_vectors.sh and x86_msr.sh (which uses
x86_arch_MSRs_tbl) receive their directory arguments?
[ ... ]
> +# Keep build output out of the source tree; perf, tracing and objtool take
> +# O=, the libraries and bpftool take OUTPUT=.
> +build_target() {
> + local name="$1"
> + local dir="$2"
> +
> + case "$name" in
> + perf)
> + make -C "$dir" O="$OUTPUT_DIR" -j"$(nproc)"
> + ;;
> + tracing|objtool)
> + (umask 077 && mkdir -p "$OUTPUT_DIR/$name")
> + make -C "$dir" O="$OUTPUT_DIR/$name" -j"$(nproc)"
> + ;;
> + *)
> + (umask 077 && mkdir -p "$OUTPUT_DIR/$name")
> + make -C "$dir" OUTPUT="$OUTPUT_DIR/$name/" -j"$(nproc)"
> + ;;
> + esac
> +}
[Severity: Medium]
What happens in build_target() when a user passes a relative path via -o,
--output, or OUTPUT_DIR?
In main(), the script changes directory to $KERNEL_DIR and creates
$OUTPUT_DIR without converting it to an absolute path:
cd "$KERNEL_DIR"
...
if [[ $BUILD -eq 1 ]]; then
# umask covers every level created, -m with -p only the last.
(umask 077 && mkdir -p "$OUTPUT_DIR")
fi
When build_test_targets() or process_group() then calls build_target(),
make -C "$dir" changes the working directory to the target subdirectory (such
as tools/perf, tools/objtool, or tools/lib/bpf) before evaluating O= or
OUTPUT=. In tools/scripts/Makefile.include, the existence check resolves that
relative path from $dir rather than from $KERNEL_DIR (or the caller's working
directory), causing the build test to fail and sync-headers.sh to revert the
synced header. Should OUTPUT_DIR be canonicalized to an absolute path before
main() changes directory?
[ ... ]
> + for token in $args; do
> + case "$token" in
> + '$@')
> + continue
> + ;;
> + '$(srctree)'*)
> + token="${token//\$(srctree)/$KERNEL_DIR}"
> + ;;
> + '$('*)
> + token="$KERNEL_DIR/${BEAUTY_MAKE_DIRS["${token:2:${#token}-3}"]:-}"
> + [[ "$token" == "$KERNEL_DIR/" ]] && { value=""; break; }
> + ;;
> + *) ;;
> + esac
> + token=$(printf '%s' "$token" | sed "s/\$(SRCARCH)/$srcarch/g")
> + if [[ "$token" == *'$('* ]]; then
> + value=""
> + break
> + fi
> + value+="${value:+ }$token"
> + done
> + [[ -n "$value" ]] || continue
> + BEAUTY_SCRIPT_ARGS["$script"]="$value"
> + done
> +}
> +
> +run_beauty_script() {
> + local script="$1"
> + local -a cmd=()
> +
> + read -ra cmd <<< "${BEAUTY_SCRIPT_ARGS["${script##*/}"]:-}"
> + bash "$script" "${cmd[@]+"${cmd[@]}"}" 2>/dev/null || true
> +}
[Severity: Medium]
Will run_beauty_script() ever capture string table diffs for syscalltbl.sh?
In tools/perf/trace/beauty/Build, syscalltbl.sh is invoked with $@ as a
positional output file argument rather than via stdout redirection:
$(Q)$(call echo-cmd,gen)$(SHELL) '$(syscall_tbl)' $(srctree)/tools $@
And tools/perf/trace/beauty/syscalltbl.sh requires two arguments and writes
directly to the output file:
if [ $# -ne 2 ]; then
usage
fi
tools_dir=$1
outfile=$2
Because setup_beauty_args() strips the $@ token,
BEAUTY_SCRIPT_ARGS["syscalltbl.sh"] only contains $KERNEL_DIR/tools. When
process_group() -> run_beauty_pass() -> run_beauty_script() runs
syscalltbl.sh, it fails the argument count check, discards the usage message
via 2>/dev/null, and ignores the non-zero status via || true. That leaves the
before and after files empty, so process_group() always reports:
That don't result in changes to the string tables generated from these headers.
even when syscall tables have new or modified entries.
[ ... ]
> + # Do the actual copy
> + if ! cp "$KERNEL_DIR/$kernel_path" "$KERNEL_DIR/$tools_path"; then
> + err "Failed to copy $kernel_path -> $tools_path"
> + COPY_FAILED+=("$tools_path")
> + cleanup_tmpdir "$beauty_tmpdir"
> + return 1
> + fi
> + info "Copied $kernel_path -> $tools_path"
[Severity: Medium]
Does copying $kernel_path directly over $tools_path in process_header()
clobber intentional tools/ adaptations in files that check-headers.sh
compares with ignore rules?
In tools/perf/check-headers.sh, several tracked files intentionally differ
between the kernel and tools/ and are checked with -I patterns or
check_ignore_some_hunks:
for i in "${SYNC_CHECK_FILES[@]}"
do
check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
done
along with arch/x86/include/asm/amd/ibs.h, include/uapi/asm-generic/mman.h,
include/uapi/linux/mman.h, include/linux/build_bug.h, include/linux/ctype.h,
include/linux/unaligned.h, lib/ctype.c, arch/x86/lib/memcpy_64.S,
arch/x86/lib/memset_64.S, and lib/list_sort.c.
When check-headers.sh reports other differences in one of those files,
process_header() overwrites $tools_path with a verbatim copy of $kernel_path,
removing the tools/-specific changes (such as mman-common-tools.h in
tools/include/uapi/asm-generic/mman.h, the static_assert guard in
tools/include/linux/build_bug.h, __isdigit in tools/include/linux/ctype.h,
relative includes marked with __ignore_sync_check__ in x86 insn/inat files,
or omitted kernel hunks in tools/lib/list_sort.c). If the host build still
passes without those adaptations, process_header() will commit the clobbered
file.
In addition, find_sync_point() assumes that files with intentional differences
never had matching blob hashes and will fall through to the last commit
touching $tools_path:
for ((i = 0; i < ${#candidates[@]}; i++)); do
if [[ "${blobs[2*i]%% *}" == "${blobs[2*i+1]%% *}" && \
"${blobs[2*i]%% *}" != *:* ]]; then
echo "${candidates[i]}"
return
fi
done
git log --no-merges --format='%H' -1 -- "$tools_path" 2>/dev/null
For files that were initially copied verbatim and only later adapted for
tools/ (for example, tools/include/uapi/asm-generic/mman.h, which was
byte-identical in commit fb7df12d645c before commit be709d48329a added
mman-common-tools.h), doesn't find_sync_point() match that older
pre-divergence commit and cause find_kernel_commits() to list and Cc commits
that were already synced?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=1
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 12/12] tools headers: Sync KVM headers with the kernel sources
2026-10-21 22:35 ` [PATCH v2 12/12] tools headers: Sync KVM headers with the " Arnaldo Carvalho de Melo
@ 2026-10-21 22:55 ` sashiko-bot
0 siblings, 0 replies; 25+ messages in thread
From: sashiko-bot @ 2026-10-21 22:55 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] perf scripts: sync-headers.sh clobbers tools-ahead commits in msr-index.h
- [Medium] perf scripts: setup_beauty_args() strips outfile arg for syscalltbl.sh
--
commit e56a03e1fdcaea6f774a4409b4149a6440687459
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tools: Add script and make target to sync the header copies with the kernel
This commit adds tools/perf/scripts/sync-headers.sh and a sync-headers make
target to detect stale header copies under tools/, run beauty scripts to
capture string table changes, build-test consumers, and generate sync commits.
> diff --git a/tools/perf/scripts/sync-headers.sh b/tools/perf/scripts/sync-headers.sh
> new file mode 100755
> index 0000000000000..9a35a3d2095a7
> --- /dev/null
> +++ b/tools/perf/scripts/sync-headers.sh
[ ... ]
> +# A kernel commit that changed both the header and the tools copy already
> +# carried its change into tools/, so it has nothing left to pick up here.
> +find_kernel_commits() {
> + local kernel_path="$1"
> + local tools_path="$2"
> + local sync_point="$3"
> + local copied sha
> +
> + copied=$(git log --no-merges --format='%H' \
> + "${sync_point}..HEAD" -- "$tools_path" 2>/dev/null)
> + [[ -n "$copied" ]] && copied+=$'\n'
> +
> + while IFS= read -r sha; do
> + [[ "$copied" == *"$sha"$'\n'* ]] && continue
> + echo "$sha"
> + done < <(git log --no-merges --format='%H' \
> + "${sync_point}..HEAD" -- "$kernel_path" 2>/dev/null)
> +}
> +
> +# Render commit ids with FORMAT at the usual 12 chars, keeping their order.
> +format_commits() {
> + local format="$1"
> + local ids="$2"
> +
> + [[ -n "$ids" ]] || return 0
> + printf '%s\n' "$ids" | git log --no-walk=unsorted --abbrev=12 \
> + --format="$format" --stdin 2>/dev/null
> +}
> +
> +# The kernel's current content can match a previous tools/ copy state when
> +# the kernel reverted the header; there is nothing to pick up then.
> +kernel_matches_previous_tools_state() {
> + local kernel_path="$1"
> + local tools_path="$2"
> + local kernel_blob
> +
> + kernel_blob=$(git hash-object "$kernel_path" 2>/dev/null) || return 1
> + [[ -n "$(git log --format=%h -1 --find-object="$kernel_blob" -- "$tools_path" 2>/dev/null)" ]]
> +}
[Severity: Medium]
Can kernel_matches_previous_tools_state() and find_kernel_commits() miss
cases where tools_path has commits ahead of the kernel header while
kernel_path also received an unrelated commit since the last common
sync_point, causing process_header() to overwrite tools_path and revert
the tools-side changes?
Specifically, kernel_matches_previous_tools_state() only matches when the
current kernel_blob hash previously existed in tools_path's history, which
stops matching as soon as kernel_path receives any new commit after
sync_point. Meanwhile, find_kernel_commits() only uses the commits on
tools_path in ${sync_point}..HEAD to filter out commits that touched both
files, without checking for commits that modified tools_path alone.
This happens in commit 78affd0f60ae ("tools arch x86: Sync the msr-index.h
copy with the kernel sources") in this series. Commit 7846bf499da3 ("tools
headers: Sync x86 headers with kernel sources") had added seven PEBS vector
definitions to tools/arch/x86/include/asm/msr-index.h ahead of the kernel,
and arch/x86/include/asm/msr-index.h later received commit ac5cc691eb4a
("x86/thermal: Add bit definitions for Intel Directed Package Thermal
Interrupt") after their common sync point 369e91bd201d. Running
sync-headers.sh then overwrote tools/arch/x86/include/asm/msr-index.h with
arch/x86/include/asm/msr-index.h, silently deleting those definitions in
commit 78affd0f60ae:
tools/arch/x86/include/asm/msr-index.h:
#define ARCH_PEBS_LBR_SHIFT 40
#define ARCH_PEBS_LBR (0x3ull << ARCH_PEBS_LBR_SHIFT)
#define ARCH_PEBS_VECR_XMM BIT_ULL(49)
-#define ARCH_PEBS_VECR_YMMH BIT_ULL(50)
-#define ARCH_PEBS_VECR_EGPRS BIT_ULL(51)
-#define ARCH_PEBS_VECR_OPMASK BIT_ULL(53)
-#define ARCH_PEBS_VECR_ZMMH BIT_ULL(54)
-#define ARCH_PEBS_VECR_H16ZMM BIT_ULL(55)
-#define ARCH_PEBS_VECR_EXT_SHIFT 49
-#define ARCH_PEBS_VECR_EXT (0x7full << ARCH_PEBS_VECR_EXT_SHIFT)
#define ARCH_PEBS_GPR BIT_ULL(61)
Should process_header() and process_group() check whether tools_path has
commits in ${sync_point}..HEAD that are not in kernel_path's history and
skip or warn instead of overwriting tools_path?
[ ... ]
> + # $(patsubst -%,,$(CC)) yields the compiler name
> + args=$(printf '%s\n' "$args" | sed 's/\$(patsubst -%,,\$(CC))/gcc/g')
> + args="${args//\'}"
> + args="${args%' > $@'}"
> + value=""
> + for token in $args; do
> + case "$token" in
> + '$@')
> + continue
> + ;;
> + '$(srctree)'*)
> + token="${token//\$(srctree)/$KERNEL_DIR}"
> + ;;
> + '$('*)
> + token="$KERNEL_DIR/${BEAUTY_MAKE_DIRS["${token:2:${#token}-3}"]:-}"
> + [[ "$token" == "$KERNEL_DIR/" ]] && { value=""; break; }
> + ;;
> + *) ;;
> + esac
> + token=$(printf '%s' "$token" | sed "s/\$(SRCARCH)/$srcarch/g")
> + if [[ "$token" == *'$('* ]]; then
> + value=""
> + break
> + fi
> + value+="${value:+ }$token"
> + done
> + [[ -n "$value" ]] || continue
> + BEAUTY_SCRIPT_ARGS["$script"]="$value"
> + done
> +}
> +
> +run_beauty_script() {
> + local script="$1"
> + local -a cmd=()
> +
> + read -ra cmd <<< "${BEAUTY_SCRIPT_ARGS["${script##*/}"]:-}"
> + bash "$script" "${cmd[@]+"${cmd[@]}"}" 2>/dev/null || true
> +}
[Severity: Medium]
Does stripping the $@ token in setup_beauty_args() cause
run_beauty_script() to always fail on syscalltbl.sh?
In tools/perf/trace/beauty/Build, the rule for syscalltbl.sh passes $@ as a
second positional argument rather than redirecting stdout with > $@:
$(syscall_array): $(syscall_tbl) $(syscall_tbl_data)
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)$(SHELL) '$(syscall_tbl)' $(srctree)/tools $@
And tools/perf/trace/beauty/syscalltbl.sh requires two positional arguments
and writes its generated table to the second argument:
if [ $# -ne 2 ]; then
usage
fi
tools_dir=$1
outfile=$2
Because setup_beauty_args() skips $@, BEAUTY_SCRIPT_ARGS["syscalltbl.sh"]
only receives "$KERNEL_DIR/tools". When run_beauty_pass() calls
run_beauty_script() for syscalltbl.sh, syscalltbl.sh exits with status 1 in
usage(), and run_beauty_script() suppresses stderr and the exit status,
leaving both the before and after files empty so syscall table changes are
never detected.
[ ... ]
完美 (Wait—oops! Do not include any extra text after the report!). Let's make sure I only output the report itself in the final message!
Wait—I am already in the final response output stream! Let me check: everything after `$/thought` is in the response!
Oh! I wrote `完美...` at the end! Let me not do that—wait, I cannot edit already emitted tokens, so I'll stop immediately. (Actually it's just one line at the very end). Let me end with a blank line now.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261021223555.28372-1-acme@kernel.org?part=12
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2026-10-21 22:55 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 22:35 [PATCH v2 00/12] perf tools: Add a script to sync the header copies with the kernel sources Arnaldo Carvalho de Melo
2026-10-21 22:35 ` [PATCH v2 01/12] perf tools: Add script and make target to sync the header copies with the kernel Arnaldo Carvalho de Melo
2026-10-21 22:53 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 02/12] tools headers UAPI: Sync linux/if_addr.h with the kernel sources Arnaldo Carvalho de Melo
2026-10-21 22:38 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 03/12] tools headers UAPI: Sync linux/rtnetlink.h " Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 04/12] tools headers: Sync linux/gfp_types.h " Arnaldo Carvalho de Melo
2026-10-21 22:38 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 05/12] tools headers x86 cpufeatures: Sync " Arnaldo Carvalho de Melo
2026-10-21 22:42 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 06/12] tools arch x86: Sync the msr-index.h copy " Arnaldo Carvalho de Melo
2026-10-21 22:45 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 07/12] perf beauty: Update copy of linux/socket.h " Arnaldo Carvalho de Melo
2026-10-21 22:41 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 08/12] tools headers: Sync UAPI linux/fcntl.h " Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 09/12] tools headers: Sync UAPI linux/fs.h " Arnaldo Carvalho de Melo
2026-10-21 22:42 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 10/12] tools headers: Sync UAPI linux/mount.h " Arnaldo Carvalho de Melo
2026-10-21 22:41 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 11/12] tools headers: Sync UAPI sound/asound.h with " Arnaldo Carvalho de Melo
2026-10-21 22:39 ` sashiko-bot
2026-10-21 22:35 ` [PATCH v2 12/12] tools headers: Sync KVM headers with the " Arnaldo Carvalho de Melo
2026-10-21 22:55 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox