Skip to content

Commit 53f3fee

Browse files
author
Ingo Molnar
committed
Merge tag 'perf-core-for-mingo-5.6-20200106' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: perf record: Alexey Budankov: - Adapt affinity for machines with #CPUs > 1K to overcome current 1024 CPUs mask size limitation of cpu_set_t type. perf report/top TUI: Arnaldo Carvalho de Melo: - Make ENTER consistently present the pop up menu with and without call chains, to eliminate confusion. The menu continues available at all times use 'm' and '+' can be used to toggle just one call chain level, 'e' for all the call chains for a top level histogram entry and 'E' to expand all call chains in all top level entries. Extra info about these options was added to the pop up menu entries. Pressing 'k' serves as special hotkey to go straight to the main vmlinux entries, to avoid having to press enter and then select "Zoom into the kernel DSO". perf sched timehist: David Ahern: - Add support for filtering on CPU. perf tests: Arnaldo Carvalho de Melo: - Show expected versus obtained values in bp_signal test. libperf: Jiri Olsa: - Move to tools/lib/perf. - Add man pages. libapi: Andrey Zhizhikin: - Fix gcc9 stringop-truncation compilation error. tools lib: Vitaly Chikunov: - Fix builds when glibc contains strlcpy(), which is the case for ALT Linux. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2 parents 1f67624 + 6c4798d commit 53f3fee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1577
-356
lines changed

tools/include/linux/bitmap.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
1515
const unsigned long *bitmap2, int bits);
1616
int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
1717
const unsigned long *bitmap2, unsigned int bits);
18+
int __bitmap_equal(const unsigned long *bitmap1,
19+
const unsigned long *bitmap2, unsigned int bits);
1820
void bitmap_clear(unsigned long *map, unsigned int start, int len);
1921

2022
#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
@@ -123,6 +125,15 @@ static inline unsigned long *bitmap_alloc(int nbits)
123125
return calloc(1, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
124126
}
125127

128+
/*
129+
* bitmap_free - Free bitmap
130+
* @bitmap: pointer to bitmap
131+
*/
132+
static inline void bitmap_free(unsigned long *bitmap)
133+
{
134+
free(bitmap);
135+
}
136+
126137
/*
127138
* bitmap_scnprintf - print bitmap list into buffer
128139
* @bitmap: bitmap
@@ -148,4 +159,23 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
148159
return __bitmap_and(dst, src1, src2, nbits);
149160
}
150161

162+
#ifdef __LITTLE_ENDIAN
163+
#define BITMAP_MEM_ALIGNMENT 8
164+
#else
165+
#define BITMAP_MEM_ALIGNMENT (8 * sizeof(unsigned long))
166+
#endif
167+
#define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1)
168+
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
169+
170+
static inline int bitmap_equal(const unsigned long *src1,
171+
const unsigned long *src2, unsigned int nbits)
172+
{
173+
if (small_const_nbits(nbits))
174+
return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
175+
if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) &&
176+
IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT))
177+
return !memcmp(src1, src2, nbits / 8);
178+
return __bitmap_equal(src1, src2, nbits);
179+
}
180+
151181
#endif /* _PERF_BITOPS_H */

tools/include/linux/string.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ int strtobool(const char *s, bool *res);
1717
* However uClibc headers also define __GLIBC__ hence the hack below
1818
*/
1919
#if defined(__GLIBC__) && !defined(__UCLIBC__)
20+
// pragma diagnostic was introduced in gcc 4.6
21+
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
22+
#pragma GCC diagnostic push
23+
#pragma GCC diagnostic ignored "-Wredundant-decls"
24+
#endif
2025
extern size_t strlcpy(char *dest, const char *src, size_t size);
26+
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
27+
#pragma GCC diagnostic pop
28+
#endif
2129
#endif
2230

2331
char *str_error_r(int errnum, char *buf, size_t buflen);

tools/lib/api/fs/fs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ static bool fs__env_override(struct fs *fs)
210210
size_t name_len = strlen(fs->name);
211211
/* name + "_PATH" + '\0' */
212212
char upper_name[name_len + 5 + 1];
213+
213214
memcpy(upper_name, fs->name, name_len);
214215
mem_toupper(upper_name, name_len);
215216
strcpy(&upper_name[name_len], "_PATH");
@@ -219,7 +220,8 @@ static bool fs__env_override(struct fs *fs)
219220
return false;
220221

221222
fs->found = true;
222-
strncpy(fs->path, override_path, sizeof(fs->path));
223+
strncpy(fs->path, override_path, sizeof(fs->path) - 1);
224+
fs->path[sizeof(fs->path) - 1] = '\0';
223225
return true;
224226
}
225227

tools/lib/bitmap.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,18 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
7171
BITMAP_LAST_WORD_MASK(bits));
7272
return result != 0;
7373
}
74+
75+
int __bitmap_equal(const unsigned long *bitmap1,
76+
const unsigned long *bitmap2, unsigned int bits)
77+
{
78+
unsigned int k, lim = bits/BITS_PER_LONG;
79+
for (k = 0; k < lim; ++k)
80+
if (bitmap1[k] != bitmap2[k])
81+
return 0;
82+
83+
if (bits % BITS_PER_LONG)
84+
if ((bitmap1[k] ^ bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
85+
return 0;
86+
87+
return 1;
88+
}
File renamed without changes.

tools/lib/perf/Documentation/Makefile

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2+
# Most of this file is copied from tools/perf/Documentation/Makefile
3+
4+
include ../../../scripts/Makefile.include
5+
include ../../../scripts/utilities.mak
6+
7+
MAN3_TXT = libperf.txt
8+
MAN7_TXT = libperf-counting.txt libperf-sampling.txt
9+
MAN_EX = examples/*.c
10+
11+
MAN_TXT = $(MAN3_TXT) $(MAN7_TXT)
12+
13+
_MAN_XML = $(patsubst %.txt,%.xml,$(MAN_TXT))
14+
_MAN_HTML = $(patsubst %.txt,%.html,$(MAN_TXT))
15+
_MAN_3 = $(patsubst %.txt,%.3,$(MAN3_TXT))
16+
_MAN_7 = $(patsubst %.txt,%.7,$(MAN7_TXT))
17+
18+
MAN_XML = $(addprefix $(OUTPUT),$(_MAN_XML))
19+
MAN_HTML = $(addprefix $(OUTPUT),$(_MAN_HTML))
20+
MAN_3 = $(addprefix $(OUTPUT),$(_MAN_3))
21+
MAN_7 = $(addprefix $(OUTPUT),$(_MAN_7))
22+
MAN_X = $(MAN_3) $(MAN_7)
23+
24+
# Make the path relative to DESTDIR, not prefix
25+
ifndef DESTDIR
26+
prefix ?=$(HOME)
27+
endif
28+
29+
mandir ?= $(prefix)/share/man
30+
man3dir = $(mandir)/man3
31+
man7dir = $(mandir)/man7
32+
33+
docdir ?= $(prefix)/share/doc/libperf
34+
htmldir = $(docdir)/html
35+
exdir = $(docdir)/examples
36+
37+
ASCIIDOC = asciidoc
38+
ASCIIDOC_EXTRA = --unsafe -f asciidoc.conf
39+
ASCIIDOC_HTML = xhtml11
40+
MANPAGE_XSL = manpage-normal.xsl
41+
XMLTO_EXTRA =
42+
XMLTO =xmlto
43+
44+
INSTALL ?= install
45+
RM ?= rm -f
46+
47+
# For asciidoc ...
48+
# -7.1.2, no extra settings are needed.
49+
# 8.0-, set ASCIIDOC8.
50+
#
51+
52+
# For docbook-xsl ...
53+
# -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
54+
# 1.69.0, no extra settings are needed?
55+
# 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP?
56+
# 1.71.1, no extra settings are needed?
57+
# 1.72.0, set DOCBOOK_XSL_172.
58+
# 1.73.0-, set ASCIIDOC_NO_ROFF
59+
60+
# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
61+
# of 'the ".ft C" problem' in your generated manpages, and you
62+
# instead ended up with weird characters around callouts, try
63+
# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
64+
65+
ifdef ASCIIDOC8
66+
ASCIIDOC_EXTRA += -a asciidoc7compatible
67+
endif
68+
ifdef DOCBOOK_XSL_172
69+
ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff
70+
MANPAGE_XSL = manpage-1.72.xsl
71+
else
72+
ifdef ASCIIDOC_NO_ROFF
73+
# docbook-xsl after 1.72 needs the regular XSL, but will not
74+
# pass-thru raw roff codes from asciidoc.conf, so turn them off.
75+
ASCIIDOC_EXTRA += -a libperf-asciidoc-no-roff
76+
endif
77+
endif
78+
ifdef MAN_BOLD_LITERAL
79+
XMLTO_EXTRA += -m manpage-bold-literal.xsl
80+
endif
81+
ifdef DOCBOOK_SUPPRESS_SP
82+
XMLTO_EXTRA += -m manpage-suppress-sp.xsl
83+
endif
84+
85+
DESTDIR ?=
86+
DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
87+
88+
export DESTDIR DESTDIR_SQ
89+
90+
# Please note that there is a minor bug in asciidoc.
91+
# The version after 6.0.3 _will_ include the patch found here:
92+
# http://marc.theaimsgroup.com/?l=libtraceevent&m=111558757202243&w=2
93+
#
94+
# Until that version is released you may have to apply the patch
95+
# yourself - yes, all 6 characters of it!
96+
97+
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
98+
QUIET_SUBDIR1 =
99+
100+
ifneq ($(findstring $(MAKEFLAGS),w),w)
101+
PRINT_DIR = --no-print-directory
102+
else # "make -w"
103+
NO_SUBDIR = :
104+
endif
105+
106+
ifneq ($(findstring $(MAKEFLAGS),s),s)
107+
ifneq ($(V),1)
108+
QUIET_ASCIIDOC = @echo ' ASCIIDOC '$@;
109+
QUIET_XMLTO = @echo ' XMLTO '$@;
110+
endif
111+
endif
112+
113+
all: $(MAN_X) $(MAN_HTML)
114+
115+
$(MAN_HTML) $(MAN_X): asciidoc.conf
116+
117+
install-man: all
118+
$(call QUIET_INSTALL, man) \
119+
$(INSTALL) -d -m 755 $(DESTDIR)$(man3dir); \
120+
$(INSTALL) -m 644 $(MAN_3) $(DESTDIR)$(man3dir); \
121+
$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \
122+
$(INSTALL) -m 644 $(MAN_7) $(DESTDIR)$(man7dir);
123+
124+
install-html:
125+
$(call QUIET_INSTALL, html) \
126+
$(INSTALL) -d -m 755 $(DESTDIR)$(htmldir); \
127+
$(INSTALL) -m 644 $(MAN_HTML) $(DESTDIR)$(htmldir); \
128+
129+
install-examples:
130+
$(call QUIET_INSTALL, examples) \
131+
$(INSTALL) -d -m 755 $(DESTDIR)$(exdir); \
132+
$(INSTALL) -m 644 $(MAN_EX) $(DESTDIR)$(exdir); \
133+
134+
CLEAN_FILES = \
135+
$(MAN_XML) $(addsuffix +,$(MAN_XML)) \
136+
$(MAN_HTML) $(addsuffix +,$(MAN_HTML)) \
137+
$(MAN_X)
138+
139+
clean:
140+
$(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES)
141+
142+
$(MAN_3): $(OUTPUT)%.3: %.xml
143+
$(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
144+
145+
$(MAN_7): $(OUTPUT)%.7: %.xml
146+
$(QUIET_XMLTO)$(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
147+
148+
$(MAN_XML): $(OUTPUT)%.xml: %.txt
149+
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d manpage \
150+
$(ASCIIDOC_EXTRA) -alibperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \
151+
mv $@+ $@
152+
153+
$(MAN_HTML): $(OUTPUT)%.html: %.txt
154+
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b $(ASCIIDOC_HTML) -d manpage \
155+
$(ASCIIDOC_EXTRA) -aperf_version=$(EVENT_PARSE_VERSION) -o $@+ $< && \
156+
mv $@+ $@
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
## linktep: macro
2+
#
3+
# Usage: linktep:command[manpage-section]
4+
#
5+
# Note, {0} is the manpage section, while {target} is the command.
6+
#
7+
# Show TEP link as: <command>(<section>); if section is defined, else just show
8+
# the command.
9+
10+
[macros]
11+
(?su)[\\]?(?P<name>linktep):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
12+
13+
[attributes]
14+
asterisk=&#42;
15+
plus=&#43;
16+
caret=&#94;
17+
startsb=&#91;
18+
endsb=&#93;
19+
tilde=&#126;
20+
21+
ifdef::backend-docbook[]
22+
[linktep-inlinemacro]
23+
{0%{target}}
24+
{0#<citerefentry>}
25+
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
26+
{0#</citerefentry>}
27+
endif::backend-docbook[]
28+
29+
ifdef::backend-docbook[]
30+
ifndef::tep-asciidoc-no-roff[]
31+
# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this.
32+
# v1.72 breaks with this because it replaces dots not in roff requests.
33+
[listingblock]
34+
<example><title>{title}</title>
35+
<literallayout>
36+
ifdef::doctype-manpage[]
37+
&#10;.ft C&#10;
38+
endif::doctype-manpage[]
39+
|
40+
ifdef::doctype-manpage[]
41+
&#10;.ft&#10;
42+
endif::doctype-manpage[]
43+
</literallayout>
44+
{title#}</example>
45+
endif::tep-asciidoc-no-roff[]
46+
47+
ifdef::tep-asciidoc-no-roff[]
48+
ifdef::doctype-manpage[]
49+
# The following two small workarounds insert a simple paragraph after screen
50+
[listingblock]
51+
<example><title>{title}</title>
52+
<literallayout>
53+
|
54+
</literallayout><simpara></simpara>
55+
{title#}</example>
56+
57+
[verseblock]
58+
<formalpara{id? id="{id}"}><title>{title}</title><para>
59+
{title%}<literallayout{id? id="{id}"}>
60+
{title#}<literallayout>
61+
|
62+
</literallayout>
63+
{title#}</para></formalpara>
64+
{title%}<simpara></simpara>
65+
endif::doctype-manpage[]
66+
endif::tep-asciidoc-no-roff[]
67+
endif::backend-docbook[]
68+
69+
ifdef::doctype-manpage[]
70+
ifdef::backend-docbook[]
71+
[header]
72+
template::[header-declarations]
73+
<refentry>
74+
<refmeta>
75+
<refentrytitle>{mantitle}</refentrytitle>
76+
<manvolnum>{manvolnum}</manvolnum>
77+
<refmiscinfo class="source">libperf</refmiscinfo>
78+
<refmiscinfo class="version">{libperf_version}</refmiscinfo>
79+
<refmiscinfo class="manual">libperf Manual</refmiscinfo>
80+
</refmeta>
81+
<refnamediv>
82+
<refname>{manname1}</refname>
83+
<refname>{manname2}</refname>
84+
<refname>{manname3}</refname>
85+
<refname>{manname4}</refname>
86+
<refname>{manname5}</refname>
87+
<refname>{manname6}</refname>
88+
<refname>{manname7}</refname>
89+
<refname>{manname8}</refname>
90+
<refname>{manname9}</refname>
91+
<refname>{manname10}</refname>
92+
<refname>{manname11}</refname>
93+
<refname>{manname12}</refname>
94+
<refname>{manname13}</refname>
95+
<refname>{manname14}</refname>
96+
<refname>{manname15}</refname>
97+
<refname>{manname16}</refname>
98+
<refname>{manname17}</refname>
99+
<refname>{manname18}</refname>
100+
<refname>{manname19}</refname>
101+
<refname>{manname20}</refname>
102+
<refname>{manname21}</refname>
103+
<refname>{manname22}</refname>
104+
<refname>{manname23}</refname>
105+
<refname>{manname24}</refname>
106+
<refname>{manname25}</refname>
107+
<refname>{manname26}</refname>
108+
<refname>{manname27}</refname>
109+
<refname>{manname28}</refname>
110+
<refname>{manname29}</refname>
111+
<refname>{manname30}</refname>
112+
<refpurpose>{manpurpose}</refpurpose>
113+
</refnamediv>
114+
endif::backend-docbook[]
115+
endif::doctype-manpage[]
116+
117+
ifdef::backend-xhtml11[]
118+
[linktep-inlinemacro]
119+
<a href="{target}.html">{target}{0?({0})}</a>
120+
endif::backend-xhtml11[]

0 commit comments

Comments
 (0)