Skip to content

Commit ac5eed2

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling updates form Ingo Molnar: "A final batch of perf tooling changes: mostly fixes and small improvements" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (29 commits) perf session: Add comment for perf_session__register_idle_thread() perf thread-stack: Fix thread stack processing for the idle task perf thread-stack: Allocate an array of thread stacks perf thread-stack: Factor out thread_stack__init() perf thread-stack: Allow for a thread stack array perf thread-stack: Avoid direct reference to the thread's stack perf thread-stack: Tidy thread_stack__bottom() usage perf thread-stack: Simplify some code in thread_stack__process() tools gpio: Allow overriding CFLAGS tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command tools thermal tmon: Allow overriding CFLAGS assignments tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command perf c2c: Increase the HITM ratio limit for displayed cachelines perf c2c: Change the default coalesce setup perf trace beauty ioctl: Beautify USBDEVFS_ commands perf trace beauty: Export function to get the files for a thread perf trace: Wire up ioctl's USBDEBFS_ cmd table generator perf beauty ioctl: Add generator for USBDEVFS_ ioctl commands tools headers uapi: Grab a copy of usbdevice_fs.h perf trace: Store the major number for a file when storing its pathname ...
2 parents 574823b + 2573be2 commit ac5eed2

File tree

27 files changed

+620
-166
lines changed

27 files changed

+620
-166
lines changed

tools/build/Makefile.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ FEATURE_TESTS_EXTRA := \
8282
cplus-demangle \
8383
hello \
8484
libbabeltrace \
85-
liberty \
86-
liberty-z \
85+
libbfd-liberty \
86+
libbfd-liberty-z \
8787
libunwind-debug-frame \
8888
libunwind-debug-frame-arm \
8989
libunwind-debug-frame-aarch64 \

tools/build/feature/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ FILES= \
1717
test-libbfd.bin \
1818
test-disassembler-four-args.bin \
1919
test-reallocarray.bin \
20-
test-liberty.bin \
21-
test-liberty-z.bin \
20+
test-libbfd-liberty.bin \
21+
test-libbfd-liberty-z.bin \
2222
test-cplus-demangle.bin \
2323
test-libelf.bin \
2424
test-libelf-getphdrnum.bin \
@@ -210,18 +210,18 @@ $(OUTPUT)test-libpython-version.bin:
210210
$(BUILD)
211211

212212
$(OUTPUT)test-libbfd.bin:
213-
$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
213+
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
214214

215215
$(OUTPUT)test-disassembler-four-args.bin:
216216
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
217217

218218
$(OUTPUT)test-reallocarray.bin:
219219
$(BUILD)
220220

221-
$(OUTPUT)test-liberty.bin:
221+
$(OUTPUT)test-libbfd-liberty.bin:
222222
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
223223

224-
$(OUTPUT)test-liberty-z.bin:
224+
$(OUTPUT)test-libbfd-liberty-z.bin:
225225
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
226226

227227
$(OUTPUT)test-cplus-demangle.bin:

tools/gpio/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endif
1212
# (this improves performance and avoids hard-to-debug behaviour);
1313
MAKEFLAGS += -r
1414

15-
CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
15+
override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
1616

1717
ALL_TARGETS := lsgpio gpio-hammer gpio-event-mon
1818
ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2+
/*****************************************************************************/
3+
4+
/*
5+
* usbdevice_fs.h -- USB device file system.
6+
*
7+
* Copyright (C) 2000
8+
* Thomas Sailer ([email protected])
9+
*
10+
* This program is free software; you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation; either version 2 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program; if not, write to the Free Software
22+
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23+
*
24+
* History:
25+
* 0.1 04.01.2000 Created
26+
*/
27+
28+
/*****************************************************************************/
29+
30+
#ifndef _UAPI_LINUX_USBDEVICE_FS_H
31+
#define _UAPI_LINUX_USBDEVICE_FS_H
32+
33+
#include <linux/types.h>
34+
#include <linux/magic.h>
35+
36+
/* --------------------------------------------------------------------- */
37+
38+
/* usbdevfs ioctl codes */
39+
40+
struct usbdevfs_ctrltransfer {
41+
__u8 bRequestType;
42+
__u8 bRequest;
43+
__u16 wValue;
44+
__u16 wIndex;
45+
__u16 wLength;
46+
__u32 timeout; /* in milliseconds */
47+
void __user *data;
48+
};
49+
50+
struct usbdevfs_bulktransfer {
51+
unsigned int ep;
52+
unsigned int len;
53+
unsigned int timeout; /* in milliseconds */
54+
void __user *data;
55+
};
56+
57+
struct usbdevfs_setinterface {
58+
unsigned int interface;
59+
unsigned int altsetting;
60+
};
61+
62+
struct usbdevfs_disconnectsignal {
63+
unsigned int signr;
64+
void __user *context;
65+
};
66+
67+
#define USBDEVFS_MAXDRIVERNAME 255
68+
69+
struct usbdevfs_getdriver {
70+
unsigned int interface;
71+
char driver[USBDEVFS_MAXDRIVERNAME + 1];
72+
};
73+
74+
struct usbdevfs_connectinfo {
75+
unsigned int devnum;
76+
unsigned char slow;
77+
};
78+
79+
#define USBDEVFS_URB_SHORT_NOT_OK 0x01
80+
#define USBDEVFS_URB_ISO_ASAP 0x02
81+
#define USBDEVFS_URB_BULK_CONTINUATION 0x04
82+
#define USBDEVFS_URB_NO_FSBR 0x20 /* Not used */
83+
#define USBDEVFS_URB_ZERO_PACKET 0x40
84+
#define USBDEVFS_URB_NO_INTERRUPT 0x80
85+
86+
#define USBDEVFS_URB_TYPE_ISO 0
87+
#define USBDEVFS_URB_TYPE_INTERRUPT 1
88+
#define USBDEVFS_URB_TYPE_CONTROL 2
89+
#define USBDEVFS_URB_TYPE_BULK 3
90+
91+
struct usbdevfs_iso_packet_desc {
92+
unsigned int length;
93+
unsigned int actual_length;
94+
unsigned int status;
95+
};
96+
97+
struct usbdevfs_urb {
98+
unsigned char type;
99+
unsigned char endpoint;
100+
int status;
101+
unsigned int flags;
102+
void __user *buffer;
103+
int buffer_length;
104+
int actual_length;
105+
int start_frame;
106+
union {
107+
int number_of_packets; /* Only used for isoc urbs */
108+
unsigned int stream_id; /* Only used with bulk streams */
109+
};
110+
int error_count;
111+
unsigned int signr; /* signal to be sent on completion,
112+
or 0 if none should be sent. */
113+
void __user *usercontext;
114+
struct usbdevfs_iso_packet_desc iso_frame_desc[0];
115+
};
116+
117+
/* ioctls for talking directly to drivers */
118+
struct usbdevfs_ioctl {
119+
int ifno; /* interface 0..N ; negative numbers reserved */
120+
int ioctl_code; /* MUST encode size + direction of data so the
121+
* macros in <asm/ioctl.h> give correct values */
122+
void __user *data; /* param buffer (in, or out) */
123+
};
124+
125+
/* You can do most things with hubs just through control messages,
126+
* except find out what device connects to what port. */
127+
struct usbdevfs_hub_portinfo {
128+
char nports; /* number of downstream ports in this hub */
129+
char port [127]; /* e.g. port 3 connects to device 27 */
130+
};
131+
132+
/* System and bus capability flags */
133+
#define USBDEVFS_CAP_ZERO_PACKET 0x01
134+
#define USBDEVFS_CAP_BULK_CONTINUATION 0x02
135+
#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
136+
#define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
137+
#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10
138+
#define USBDEVFS_CAP_MMAP 0x20
139+
#define USBDEVFS_CAP_DROP_PRIVILEGES 0x40
140+
141+
/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
142+
143+
/* disconnect-and-claim if the driver matches the driver field */
144+
#define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
145+
/* disconnect-and-claim except when the driver matches the driver field */
146+
#define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
147+
148+
struct usbdevfs_disconnect_claim {
149+
unsigned int interface;
150+
unsigned int flags;
151+
char driver[USBDEVFS_MAXDRIVERNAME + 1];
152+
};
153+
154+
struct usbdevfs_streams {
155+
unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */
156+
unsigned int num_eps;
157+
unsigned char eps[0];
158+
};
159+
160+
/*
161+
* USB_SPEED_* values returned by USBDEVFS_GET_SPEED are defined in
162+
* linux/usb/ch9.h
163+
*/
164+
165+
#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
166+
#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
167+
#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
168+
#define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
169+
#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
170+
#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
171+
#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
172+
#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
173+
#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
174+
#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
175+
#define USBDEVFS_DISCARDURB _IO('U', 11)
176+
#define USBDEVFS_REAPURB _IOW('U', 12, void *)
177+
#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
178+
#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
179+
#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
180+
#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
181+
#define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
182+
#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
183+
#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
184+
#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
185+
#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
186+
#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
187+
#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
188+
#define USBDEVFS_RESET _IO('U', 20)
189+
#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
190+
#define USBDEVFS_DISCONNECT _IO('U', 22)
191+
#define USBDEVFS_CONNECT _IO('U', 23)
192+
#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
193+
#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
194+
#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
195+
#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
196+
#define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams)
197+
#define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams)
198+
#define USBDEVFS_DROP_PRIVILEGES _IOW('U', 30, __u32)
199+
#define USBDEVFS_GET_SPEED _IO('U', 31)
200+
201+
#endif /* _UAPI_LINUX_USBDEVICE_FS_H */

tools/perf/Makefile.config

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -702,18 +702,20 @@ endif
702702

703703
ifeq ($(feature-libbfd), 1)
704704
EXTLIBS += -lbfd
705+
else
706+
# we are on a system that requires -liberty and (maybe) -lz
707+
# to link against -lbfd; test each case individually here
705708

706709
# call all detections now so we get correct
707710
# status in VF output
708-
$(call feature_check,liberty)
709-
$(call feature_check,liberty-z)
710-
$(call feature_check,cplus-demangle)
711+
$(call feature_check,libbfd-liberty)
712+
$(call feature_check,libbfd-liberty-z)
711713

712-
ifeq ($(feature-liberty), 1)
713-
EXTLIBS += -liberty
714+
ifeq ($(feature-libbfd-liberty), 1)
715+
EXTLIBS += -lbfd -liberty
714716
else
715-
ifeq ($(feature-liberty-z), 1)
716-
EXTLIBS += -liberty -lz
717+
ifeq ($(feature-libbfd-liberty-z), 1)
718+
EXTLIBS += -lbfd -liberty -lz
717719
endif
718720
endif
719721
endif
@@ -723,24 +725,24 @@ ifdef NO_DEMANGLE
723725
else
724726
ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
725727
EXTLIBS += -liberty
726-
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
727728
else
728-
ifneq ($(feature-libbfd), 1)
729-
ifneq ($(feature-liberty), 1)
730-
ifneq ($(feature-liberty-z), 1)
731-
# we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
732-
# or any of 'bfd iberty z' trinity
733-
ifeq ($(feature-cplus-demangle), 1)
734-
EXTLIBS += -liberty
735-
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
736-
else
737-
msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
738-
CFLAGS += -DNO_DEMANGLE
739-
endif
740-
endif
729+
ifeq ($(filter -liberty,$(EXTLIBS)),)
730+
$(call feature_check,cplus-demangle)
731+
732+
# we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
733+
# or any of 'bfd iberty z' trinity
734+
ifeq ($(feature-cplus-demangle), 1)
735+
EXTLIBS += -liberty
736+
else
737+
msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
738+
CFLAGS += -DNO_DEMANGLE
741739
endif
742740
endif
743741
endif
742+
743+
ifneq ($(filter -liberty,$(EXTLIBS)),)
744+
CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
745+
endif
744746
endif
745747

746748
ifneq ($(filter -lbfd,$(EXTLIBS)),)

tools/perf/Makefile.perf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ prctl_option_tbl := $(srctree)/tools/perf/trace/beauty/prctl_option.sh
497497
$(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl)
498498
$(Q)$(SHELL) '$(prctl_option_tbl)' $(prctl_hdr_dir) > $@
499499

500+
usbdevfs_ioctl_array := $(beauty_ioctl_outdir)/usbdevfs_ioctl_array.c
501+
usbdevfs_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/usbdevfs_ioctl.sh
502+
503+
$(usbdevfs_ioctl_array): $(linux_uapi_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
504+
$(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(linux_uapi_dir) > $@
505+
500506
x86_arch_prctl_code_array := $(beauty_outdir)/x86_arch_prctl_code_array.c
501507
x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh
502508

@@ -624,6 +630,7 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioc
624630
$(mount_flags_array) \
625631
$(perf_ioctl_array) \
626632
$(prctl_option_array) \
633+
$(usbdevfs_ioctl_array) \
627634
$(x86_arch_prctl_code_array) \
628635
$(rename_flags_array) \
629636
$(arch_errno_name_array)
@@ -923,6 +930,7 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
923930
$(OUTPUT)$(vhost_virtio_ioctl_array) \
924931
$(OUTPUT)$(perf_ioctl_array) \
925932
$(OUTPUT)$(prctl_option_array) \
933+
$(OUTPUT)$(usbdevfs_ioctl_array) \
926934
$(OUTPUT)$(x86_arch_prctl_code_array) \
927935
$(OUTPUT)$(rename_flags_array) \
928936
$(OUTPUT)$(arch_errno_name_array)

tools/perf/builtin-c2c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct c2c_hist_entry {
6868
struct hist_entry he;
6969
};
7070

71-
static char const *coalesce_default = "pid,iaddr";
71+
static char const *coalesce_default = "iaddr";
7272

7373
struct perf_c2c {
7474
struct perf_tool tool;
@@ -1878,7 +1878,7 @@ static int c2c_hists__reinit(struct c2c_hists *c2c_hists,
18781878
return hpp_list__parse(&c2c_hists->list, output, sort);
18791879
}
18801880

1881-
#define DISPLAY_LINE_LIMIT 0.0005
1881+
#define DISPLAY_LINE_LIMIT 0.001
18821882

18831883
static bool he__display(struct hist_entry *he, struct c2c_stats *stats)
18841884
{

0 commit comments

Comments
 (0)