History

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar: "Assorted small fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf python: Properly link with libtraceevent perf hists browser: Add back callchain folding symbol perf tools: Fix build on sparc. perf python: Link with libtraceevent perf python: Initialize 'page_size' variable tools lib traceevent: Fix missed freeing of subargs in free_arg() in filter lib tools traceevent: Add back pevent assignment in __pevent_parse_format() perf hists browser: Fix off-by-two bug on the first column perf tools: Remove warnings on JIT samples for srcline sort key perf tools: Fix segfault when using srcline sort key perf: Require exclude_guest to use PEBS - kernel side enforcement perf tool: Precise mode requires exclude_guest

Linus Torvalds committed 14 years ago

Commit 8c1bee62 parents 3782010 45bff419 files · +56 −17Browse files

Unified · Split

9 files
  1. arch/x86/kernel/cpu/perf_event.c +6 −0
  2. tools/lib/traceevent/event-parse.c +6 −3
  3. tools/lib/traceevent/parse-filter.c +15 −0
  4. tools/perf/Makefile +13 −11
  5. tools/perf/perf.h +1 −1
  6. tools/perf/ui/browsers/hists.c +4 −2
  7. tools/perf/util/parse-events.c +3 −0
  8. tools/perf/util/setup.py +2 −0
  9. tools/perf/util/sort.c +6 −0
arch/x86/kernel/cpu/perf_event.c+6−0
@@ -338,6 +338,9 @@ int x86_setup_perfctr(struct perf_event *event) · 337 unmodified lines
338338 /* BTS is currently only allowed for user-mode. */
339339 if (!attr->exclude_kernel)
340340 return -EOPNOTSUPP;
341+
342+ if (!attr->exclude_guest)
343+ return -EOPNOTSUPP;
341344 }
342345
343346 hwc->config |= config;
@@ -380,6 +383,9 @@ int x86_pmu_hw_config(struct perf_event *event) · 36 unmodified lines
380383 if (event->attr.precise_ip) {
381384 int precise = 0;
382385
386+ if (!event->attr.exclude_guest)
387+ return -EOPNOTSUPP;
388+
383389 /* Support for constant skid */
384390 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
385391 precise++;
tools/lib/traceevent/event-parse.c+6−3
@@ -2602,6 +2602,9 @@ find_func_handler(struct pevent *pevent, char *func_name) · 2601 unmodified lines
26022602 {
26032603 struct pevent_function_handler *func;
26042604
2605+ if (!pevent)
2606+ return NULL;
2607+
26052608 for (func = pevent->func_handlers; func; func = func->next) {
26062609 if (strcmp(func->name, func_name) == 0)
26072610 break;
@@ -4938,6 +4941,9 @@ enum pevent_errno __pevent_parse_format(struct event_format **eventp, · 2330 unmodified lines
49384941 goto event_alloc_failed;
49394942 }
49404943
4944+ /* Add pevent to event so that it can be referenced */
4945+ event->pevent = pevent;
4946+
49414947 ret = event_read_format(event);
49424948 if (ret < 0) {
49434949 ret = PEVENT_ERRNO__READ_FORMAT_FAILED;
@@ -5041,9 +5047,6 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf, · 97 unmodified lines
50415047 if (event == NULL)
50425048 return ret;
50435049
5044− /* Add pevent to event so that it can be referenced */
5045− event->pevent = pevent;
5046−
50475050 if (add_event(pevent, event)) {
50485051 ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
50495052 goto event_add_failed;
tools/lib/traceevent/parse-filter.c+15−0
@@ -209,7 +209,16 @@ static void free_arg(struct filter_arg *arg) · 208 unmodified lines
209209 switch (arg->type) {
210210 case FILTER_ARG_NONE:
211211 case FILTER_ARG_BOOLEAN:
212+ break;
213+
212214 case FILTER_ARG_NUM:
215+ free_arg(arg->num.left);
216+ free_arg(arg->num.right);
217+ break;
218+
219+ case FILTER_ARG_EXP:
220+ free_arg(arg->exp.left);
221+ free_arg(arg->exp.right);
213222 break;
214223
215224 case FILTER_ARG_STR:
@@ -218,6 +227,12 @@ static void free_arg(struct filter_arg *arg) · 2 unmodified lines
218227 free(arg->str.buffer);
219228 break;
220229
230+ case FILTER_ARG_VALUE:
231+ if (arg->value.type == FILTER_STRING ||
232+ arg->value.type == FILTER_CHAR)
233+ free(arg->value.str);
234+ break;
235+
221236 case FILTER_ARG_OP:
222237 free_arg(arg->op.left);
223238 free_arg(arg->op.right);
tools/perf/Makefile+13−11
@@ -184,9 +184,22 @@ SCRIPT_SH += perf-archive.sh · 183 unmodified lines
184184 grep-libs = $(filter -l%,$(1))
185185 strip-libs = $(filter-out -l%,$(1))
186186
187+TRACE_EVENT_DIR = ../lib/traceevent/
188+
189+ifneq ($(OUTPUT),)
190+ TE_PATH=$(OUTPUT)
191+else
192+ TE_PATH=$(TRACE_EVENT_DIR)
193+endif
194+
195+LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
196+TE_LIB := -L$(TE_PATH) -ltraceevent
197+
187198 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
188199 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py
189200
201+export LIBTRACEEVENT
202+
190203 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
191204 $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
192205 --quiet build_ext; \
@@ -198,17 +211,6 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) · 5 unmodified lines
198211
199212 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
200213
201−TRACE_EVENT_DIR = ../lib/traceevent/
202−
203−ifneq ($(OUTPUT),)
204− TE_PATH=$(OUTPUT)
205−else
206− TE_PATH=$(TRACE_EVENT_DIR)
207−endif
208−
209−LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
210−TE_LIB := -L$(TE_PATH) -ltraceevent
211−
212214 #
213215 # Single 'perf' binary right now:
214216 #
tools/perf/perf.h+1−1
@@ -57,7 +57,7 @@ void get_term_dimensions(struct winsize *ws); · 56 unmodified lines
5757 #endif
5858
5959 #ifdef __sparc__
60−#include "../../arch/sparc/include/asm/unistd.h"
60+#include "../../arch/sparc/include/uapi/asm/unistd.h"
6161 #define rmb() asm volatile("":::"memory")
6262 #define cpu_relax() asm volatile("":::"memory")
6363 #define CPUINFO_PROC "cpu"
tools/perf/ui/browsers/hists.c+4−2
@@ -610,6 +610,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, · 609 unmodified lines
610610 char folded_sign = ' ';
611611 bool current_entry = ui_browser__is_current_entry(&browser->b, row);
612612 off_t row_offset = entry->row_offset;
613+ bool first = true;
613614
614615 if (current_entry) {
615616 browser->he_selection = entry;
@@ -633,10 +634,11 @@ static int hist_browser__show_entry(struct hist_browser *browser, · 17 unmodified lines
633634 if (!perf_hpp__format[i].cond)
634635 continue;
635636
636− if (i) {
637+ if (!first) {
637638 slsmg_printf(" ");
638639 width -= 2;
639640 }
641+ first = false;
640642
641643 if (perf_hpp__format[i].color) {
642644 hpp.ptr = &percent;
@@ -645,7 +647,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, · 2 unmodified lines
645647
646648 ui_browser__set_percent_color(&browser->b, percent, current_entry);
647649
648− if (i == 0 && symbol_conf.use_callchain) {
650+ if (i == PERF_HPP__OVERHEAD && symbol_conf.use_callchain) {
649651 slsmg_printf("%c ", folded_sign);
650652 width -= 2;
651653 }
tools/perf/util/parse-events.c+3−0
@@ -690,6 +690,9 @@ static int get_event_modifier(struct event_modifier *mod, char *str, · 689 unmodified lines
690690 eH = 0;
691691 } else if (*str == 'p') {
692692 precise++;
693+ /* use of precise requires exclude_guest */
694+ if (!exclude_GH)
695+ eG = 1;
693696 } else
694697 break;
695698
tools/perf/util/setup.py+2−0
@@ -23,6 +23,7 @@ cflags += getenv('CFLAGS', '').split() · 22 unmodified lines
2323
2424 build_lib = getenv('PYTHON_EXTBUILD_LIB')
2525 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
26+libtraceevent = getenv('LIBTRACEEVENT')
2627
2728 ext_sources = [f.strip() for f in file('util/python-ext-sources')
2829 if len(f.strip()) > 0 and f[0] != '#']
@@ -31,6 +32,7 @@ perf = Extension('perf', · 2 unmodified lines
3132 sources = ext_sources,
3233 include_dirs = ['util/include'],
3334 extra_compile_args = cflags,
35+ extra_objects = [libtraceevent],
3436 )
3537
3638 setup(name='perf',
tools/perf/util/sort.c+6−0
@@ -260,6 +260,12 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf, · 259 unmodified lines
260260 if (path != NULL)
261261 goto out_path;
262262
263+ if (!self->ms.map)
264+ goto out_ip;
265+
266+ if (!strncmp(self->ms.map->dso->long_name, "/tmp/perf-", 10))
267+ goto out_ip;
268+
263269 snprintf(cmd, sizeof(cmd), "addr2line -e %s %016" PRIx64,
264270 self->ms.map->dso->long_name, self->ip);
265271 fp = popen(cmd, "r");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t