Skip to content

Commit b2760b8

Browse files
committed
Merge tag 'perf-tools-fixes-for-v6.12-1-2024-10-08' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools fixes from Arnaldo Carvalho de Melo: - Fix an assert() to handle captured and unprocessed ARM CoreSight CPU traces - Fix static build compilation error when libdw isn't installed or is too old - Add missing include when building with !HAVE_DWARF_GETLOCATIONS_SUPPORT - Add missing refcount put on 32-bit DSOs - Fix disassembly of user space binaries by setting the binary_type of DSO when loading - Update headers with the kernel sources, including asound.h, sched.h, fcntl, msr-index.h, irq_vectors.h, socket.h, list_sort.c and arm64's cputype.h * tag 'perf-tools-fixes-for-v6.12-1-2024-10-08' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: perf cs-etm: Fix the assert() to handle captured and unprocessed cpu trace perf build: Fix build feature-dwarf_getlocations fail for old libdw perf build: Fix static compilation error when libdw is not installed perf dwarf-aux: Fix build with !HAVE_DWARF_GETLOCATIONS_SUPPORT tools headers arm64: Sync arm64's cputype.h with the kernel sources perf tools: Cope with differences for lib/list_sort.c copy from the kernel tools check_headers.sh: Add check variant that excludes some hunks perf beauty: Update copy of linux/socket.h with the kernel sources tools headers UAPI: Sync the linux/in.h with the kernel sources perf trace beauty: Update the arch/x86/include/asm/irq_vectors.h copy with the kernel sources tools arch x86: Sync the msr-index.h copy with the kernel sources tools include UAPI: Sync linux/fcntl.h copy with the kernel sources tools include UAPI: Sync linux/sched.h copy with the kernel sources tools include UAPI: Sync sound/asound.h copy with the kernel sources perf vdso: Missed put on 32-bit dsos perf symbol: Set binary_type of dso when loading
2 parents 87d6aab + e934a35 commit b2760b8

18 files changed

Lines changed: 170 additions & 34 deletions

File tree

tools/arch/arm64/include/asm/cputype.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
#define APPLE_CPU_PART_M2_AVALANCHE_MAX 0x039
144144

145145
#define AMPERE_CPU_PART_AMPERE1 0xAC3
146+
#define AMPERE_CPU_PART_AMPERE1A 0xAC4
146147

147148
#define MICROSOFT_CPU_PART_AZURE_COBALT_100 0xD49 /* Based on r0p0 of ARM Neoverse N2 */
148149

@@ -212,6 +213,7 @@
212213
#define MIDR_APPLE_M2_BLIZZARD_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_BLIZZARD_MAX)
213214
#define MIDR_APPLE_M2_AVALANCHE_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M2_AVALANCHE_MAX)
214215
#define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1)
216+
#define MIDR_AMPERE1A MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1A)
215217
#define MIDR_MICROSOFT_AZURE_COBALT_100 MIDR_CPU_MODEL(ARM_CPU_IMP_MICROSOFT, MICROSOFT_CPU_PART_AZURE_COBALT_100)
216218

217219
/* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */

tools/arch/x86/include/asm/msr-index.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@
247247
#define MSR_INTEGRITY_CAPS_ARRAY_BIST BIT(MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT)
248248
#define MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT 4
249249
#define MSR_INTEGRITY_CAPS_PERIODIC_BIST BIT(MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT)
250+
#define MSR_INTEGRITY_CAPS_SBAF_BIT 8
251+
#define MSR_INTEGRITY_CAPS_SBAF BIT(MSR_INTEGRITY_CAPS_SBAF_BIT)
250252
#define MSR_INTEGRITY_CAPS_SAF_GEN_MASK GENMASK_ULL(10, 9)
251253

252254
#define MSR_LBR_NHM_FROM 0x00000680

tools/build/feature/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ DWARFLIBS := -ldw
172172
ifeq ($(findstring -static,${LDFLAGS}),-static)
173173
DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
174174

175-
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
175+
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
176176
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
177177
LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION)))
178178

@@ -181,6 +181,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
181181
ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
182182
DWARFLIBS += -lebl
183183
endif
184+
185+
# Must put -ldl after -lebl for dependency
186+
DWARFLIBS += -ldl
184187
endif
185188

186189
$(OUTPUT)test-dwarf.bin:

tools/include/uapi/linux/in.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct in_addr {
141141
*/
142142
#define IP_PMTUDISC_INTERFACE 4
143143
/* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get
144-
* fragmented if they exeed the interface mtu
144+
* fragmented if they exceed the interface mtu
145145
*/
146146
#define IP_PMTUDISC_OMIT 5
147147

tools/perf/Makefile.config

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ ifdef LIBDW_DIR
147147
endif
148148
DWARFLIBS := -ldw
149149
ifeq ($(findstring -static,${LDFLAGS}),-static)
150-
DWARFLIBS += -lelf -ldl -lz -llzma -lbz2 -lzstd
150+
DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
151151

152-
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
152+
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw).0.0
153153
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
154154
LIBDW_VERSION_2 := $(word 2, $(subst ., ,$(LIBDW_VERSION)))
155155

@@ -158,6 +158,9 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
158158
ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
159159
DWARFLIBS += -lebl
160160
endif
161+
162+
# Must put -ldl after -lebl for dependency
163+
DWARFLIBS += -ldl
161164
endif
162165
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
163166
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@@ -1,5 +1,6 @@
2+
// SPDX-License-Identifier: GPL-2.0
3+
#include <linux/kernel.h>
4+
+#include <linux/bug.h>
5+
#include <linux/compiler.h>
6+
#include <linux/export.h>
7+
#include <linux/string.h>
8+
@@ -52,6 +53,7 @@
9+
struct list_head *a, struct list_head *b)
10+
{
11+
struct list_head *tail = head;
12+
+ u8 count = 0;
13+
14+
for (;;) {
15+
/* if equal, take 'a' -- important for sort stability */
16+
@@ -77,6 +79,15 @@
17+
/* Finish linking remainder of list b on to tail */
18+
tail->next = b;
19+
do {
20+
+ /*
21+
+ * If the merge is highly unbalanced (e.g. the input is
22+
+ * already sorted), this loop may run many iterations.
23+
+ * Continue callbacks to the client even though no
24+
+ * element comparison is needed, so the client's cmp()
25+
+ * routine can invoke cond_resched() periodically.
26+
+ */
27+
+ if (unlikely(!++count))
28+
+ cmp(priv, b, b);
29+
b->prev = tail;
30+
tail = b;
31+
b = b->next;

tools/perf/check-headers.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ beauty_check () {
136136
check_2 "tools/perf/trace/beauty/$file" "$file" "$@"
137137
}
138138

139+
check_ignore_some_hunks () {
140+
orig_file="$1"
141+
tools_file="tools/$orig_file"
142+
hunks_to_ignore="tools/perf/check-header_ignore_hunks/$orig_file"
143+
144+
if [ ! -f "$hunks_to_ignore" ]; then
145+
echo "$hunks_to_ignore not found. Skipping $orig_file check."
146+
FAILURES+=(
147+
"$tools_file $orig_file"
148+
)
149+
return
150+
fi
151+
152+
cmd="diff -u \"$tools_file\" \"$orig_file\" | grep -vf \"$hunks_to_ignore\" | wc -l | grep -qw 0"
153+
154+
if [ -f "$orig_file" ] && ! eval "$cmd"
155+
then
156+
FAILURES+=(
157+
"$tools_file $orig_file"
158+
)
159+
fi
160+
}
161+
162+
139163
# Check if we have the kernel headers (tools/perf/../../include), else
140164
# we're probably on a detached tarball, so no point in trying to check
141165
# differences.
@@ -169,7 +193,6 @@ check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
169193
check include/linux/build_bug.h '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
170194
check include/linux/ctype.h '-I "isdigit("'
171195
check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
172-
check lib/list_sort.c '-I "^#include <linux/bug.h>"'
173196

174197
# diff non-symmetric files
175198
check_2 tools/perf/arch/x86/entry/syscalls/syscall_32.tbl arch/x86/entry/syscalls/syscall_32.tbl
@@ -187,6 +210,10 @@ done
187210
check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
188211
check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
189212

213+
# Files with larger differences
214+
215+
check_ignore_some_hunks lib/list_sort.c
216+
190217
cd tools/perf || exit
191218

192219
if [ ${#FAILURES[@]} -gt 0 ]

tools/perf/trace/beauty/arch/x86/include/asm/irq_vectors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* Vectors 0 ... 31 : system traps and exceptions - hardcoded events
1919
* Vectors 32 ... 127 : device interrupts
2020
* Vector 128 : legacy int80 syscall interface
21-
* Vectors 129 ... LOCAL_TIMER_VECTOR-1
22-
* Vectors LOCAL_TIMER_VECTOR ... 255 : special interrupts
21+
* Vectors 129 ... FIRST_SYSTEM_VECTOR-1 : device interrupts
22+
* Vectors FIRST_SYSTEM_VECTOR ... 255 : special interrupts
2323
*
2424
* 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table.
2525
*

tools/perf/trace/beauty/fs_at_flags.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ printf "static const char *fs_at_flags[] = {\n"
1313
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+AT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
1414
# AT_EACCESS is only meaningful to faccessat, so we will special case it there...
1515
# AT_STATX_SYNC_TYPE is not a bit, its a mask of AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC and AT_STATX_DONT_SYNC
16+
# AT_HANDLE_FID and AT_HANDLE_MNT_ID_UNIQUE are reusing values and are valid only for name_to_handle_at()
17+
# AT_RENAME_NOREPLACE reuses 0x1 and is valid only for renameat2()
1618
grep -E $regex ${linux_fcntl} | \
1719
grep -v AT_EACCESS | \
1820
grep -v AT_STATX_SYNC_TYPE | \
21+
grep -v AT_HANDLE_FID | \
22+
grep -v AT_HANDLE_MNT_ID_UNIQUE | \
23+
grep -v AT_RENAME_NOREPLACE | \
1924
sed -r "s/$regex/\2 \1/g" | \
2025
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
2126
printf "};\n"

tools/perf/trace/beauty/include/linux/socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ struct ucred {
327327
* plain text and require encryption
328328
*/
329329

330+
#define MSG_SOCK_DEVMEM 0x2000000 /* Receive devmem skbs as cmsg */
330331
#define MSG_ZEROCOPY 0x4000000 /* Use user data in kernel path */
331332
#define MSG_SPLICE_PAGES 0x8000000 /* Splice the pages from the iterator in sendmsg() */
332333
#define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */

0 commit comments

Comments
 (0)