Re: [PATCH] perf build: Only enable context analysis with Clang 23 or later

From: Arnaldo Melo

Date: Tue Nov 24 2026 - 08:08:48 EST




On November 24, 2026 8:24:37 AM GMT-03:00, James Clark <james.clark@xxxxxxxxxx> wrote:

>Looks like __guarded_by() has also been around since at least clang 18, so that wasn't the issue. The problem is that it's not supported on struct _members_ specifically until clang 19.

>I sent another version that stubs it out for < 19 which works. The commit summary changed to "perf build: Stub out __guarded_by() on older Clang versions".

>The header diverges from the kernel one which isn't great, but I suppose that's better

Right, but you changed how check-headers.sh treats it to cope with the difference and I'll make sure that tools/perf/scripts/sync-headers.sh handles this case as well, namely if check-headers.sh detects drift, sync-headers.sh will update the tools copy while keeping the tools specific parts.

acme@number:~/git/perf-tools-next$ make -C tools/perf help | grep headers
check-headers - check which header copies are out of sync with the kernel
sync-headers - sync those header copies with the kernel, creating commits
acme@number:~/git/perf-tools-next$ tools/perf/scripts/sync-headers.sh --helpUsage: 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)
-F, --force Sync also when both copies have content the other
lacks, after manual investigation; tools/ additions
dropped are recorded in the commit
-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,
including the merges that brought content of their own.
3. Copies the kernel header into the tools/ tree, skipping it when only
the tools/ copy changed (it is ahead) or when it carries intentional
edits, and stopping for manual investigation when both sides have
content the other lacks.
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.

acme@number:~/git/perf-tools-next$

I.e. the limitation in point number three, about intentional edits, needs to be lifted.

- Arnaldo

> than someone on clang 17 or 18 missing out on all of the lock analysis.

Right.

- Arnaldo