aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-04-10 01:21:54 -0400
committerIngo Molnar <mingo@kernel.org>2018-04-10 01:21:54 -0400
commite31193a9fee0f8008e9718c9d8a6f4c4709f0482 (patch)
treea364f217fc30c7fdbce4847eca583aaf962c1e56
parent621b6d2ea297d0fb6030452c5bcd221f12165fcf (diff)
parentfcbd8fa44664e99a5d8c7ab97f1afdd82472f973 (diff)
Merge tag 'perf-urgent-for-mingo-4.17-20180409' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo: . Fix the --stdio2/TUI annotate output to include group details, be it for a recorded '{a,b,f}' explicit event group or when forcing group display using 'perf report --group' for a set of events not recorded as a group (Arnaldo Carvalho de Melo) . Fix display artifacts in the ui browser (base class for the annotate and main report/top TUI browser) related to the extra title lines work (Arnaldo Carvalho de Melo) . perf auxtrace refactorings, leftovers from a previously partially processed patchset (Adrian Hunter) . Fix the builtin clang build (Sandipan Das, Arnaldo Carvalho de Melo) - Synchronize i915_drm.h, silencing a perf build warning and in the process automagically adding support for a new ioctl command (Arnaldo Carvalho de Melo) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/perf/Makefile.perf3
-rw-r--r--tools/perf/ui/browsers/hists.c13
-rw-r--r--tools/perf/util/auxtrace.c20
-rw-r--r--tools/perf/util/c++/clang-test.cpp2
-rw-r--r--tools/perf/util/c++/clang.cpp11
-rw-r--r--tools/perf/util/util.h4
6 files changed, 29 insertions, 24 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f7517e1b73f8..83e453de36f8 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -364,7 +364,8 @@ LIBS = -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-archive
364 364
365ifeq ($(USE_CLANG), 1) 365ifeq ($(USE_CLANG), 1)
366 CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization 366 CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization
367 LIBCLANG = $(foreach l,$(CLANGLIBS_LIST),$(wildcard $(shell $(LLVM_CONFIG) --libdir)/libclang$(l).a)) 367 CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l))
368 LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so))
368 LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group 369 LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group
369endif 370endif
370 371
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b06afb8f51fb..0eec06c105c6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -659,9 +659,10 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
659 struct hist_entry *h = rb_entry(browser->b.top, 659 struct hist_entry *h = rb_entry(browser->b.top,
660 struct hist_entry, rb_node); 660 struct hist_entry, rb_node);
661 ui_helpline__pop(); 661 ui_helpline__pop();
662 ui_helpline__fpush("%d: nr_ent=(%d,%d), rows=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d", 662 ui_helpline__fpush("%d: nr_ent=(%d,%d), etl: %d, rows=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d",
663 seq++, browser->b.nr_entries, 663 seq++, browser->b.nr_entries,
664 browser->hists->nr_entries, 664 browser->hists->nr_entries,
665 browser->b.extra_title_lines,
665 browser->b.rows, 666 browser->b.rows,
666 browser->b.index, 667 browser->b.index,
667 browser->b.top_idx, 668 browser->b.top_idx,
@@ -1743,17 +1744,11 @@ static void ui_browser__hists_init_top(struct ui_browser *browser)
1743static unsigned int hist_browser__refresh(struct ui_browser *browser) 1744static unsigned int hist_browser__refresh(struct ui_browser *browser)
1744{ 1745{
1745 unsigned row = 0; 1746 unsigned row = 0;
1746 u16 header_offset = 0;
1747 struct rb_node *nd; 1747 struct rb_node *nd;
1748 struct hist_browser *hb = container_of(browser, struct hist_browser, b); 1748 struct hist_browser *hb = container_of(browser, struct hist_browser, b);
1749 struct hists *hists = hb->hists;
1750
1751 if (hb->show_headers) {
1752 struct perf_hpp_list *hpp_list = hists->hpp_list;
1753 1749
1750 if (hb->show_headers)
1754 hist_browser__show_headers(hb); 1751 hist_browser__show_headers(hb);
1755 header_offset = hpp_list->nr_header_lines;
1756 }
1757 1752
1758 ui_browser__hists_init_top(browser); 1753 ui_browser__hists_init_top(browser);
1759 hb->he_selection = NULL; 1754 hb->he_selection = NULL;
@@ -1791,7 +1786,7 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
1791 break; 1786 break;
1792 } 1787 }
1793 1788
1794 return row + header_offset; 1789 return row;
1795} 1790}
1796 1791
1797static struct rb_node *hists__filter_entries(struct rb_node *nd, 1792static struct rb_node *hists__filter_entries(struct rb_node *nd,
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index e1aff91c54a8..857de69a5361 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -302,6 +302,13 @@ static int auxtrace_queues__split_buffer(struct auxtrace_queues *queues,
302 return 0; 302 return 0;
303} 303}
304 304
305static bool filter_cpu(struct perf_session *session, int cpu)
306{
307 unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
308
309 return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
310}
311
305static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues, 312static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
306 struct perf_session *session, 313 struct perf_session *session,
307 unsigned int idx, 314 unsigned int idx,
@@ -310,6 +317,9 @@ static int auxtrace_queues__add_buffer(struct auxtrace_queues *queues,
310{ 317{
311 int err = -ENOMEM; 318 int err = -ENOMEM;
312 319
320 if (filter_cpu(session, buffer->cpu))
321 return 0;
322
313 buffer = memdup(buffer, sizeof(*buffer)); 323 buffer = memdup(buffer, sizeof(*buffer));
314 if (!buffer) 324 if (!buffer)
315 return -ENOMEM; 325 return -ENOMEM;
@@ -344,13 +354,6 @@ out_free:
344 return err; 354 return err;
345} 355}
346 356
347static bool filter_cpu(struct perf_session *session, int cpu)
348{
349 unsigned long *cpu_bitmap = session->itrace_synth_opts->cpu_bitmap;
350
351 return cpu_bitmap && cpu != -1 && !test_bit(cpu, cpu_bitmap);
352}
353
354int auxtrace_queues__add_event(struct auxtrace_queues *queues, 357int auxtrace_queues__add_event(struct auxtrace_queues *queues,
355 struct perf_session *session, 358 struct perf_session *session,
356 union perf_event *event, off_t data_offset, 359 union perf_event *event, off_t data_offset,
@@ -367,9 +370,6 @@ int auxtrace_queues__add_event(struct auxtrace_queues *queues,
367 }; 370 };
368 unsigned int idx = event->auxtrace.idx; 371 unsigned int idx = event->auxtrace.idx;
369 372
370 if (filter_cpu(session, event->auxtrace.cpu))
371 return 0;
372
373 return auxtrace_queues__add_buffer(queues, session, idx, &buffer, 373 return auxtrace_queues__add_buffer(queues, session, idx, &buffer,
374 buffer_ptr); 374 buffer_ptr);
375} 375}
diff --git a/tools/perf/util/c++/clang-test.cpp b/tools/perf/util/c++/clang-test.cpp
index a4014d786676..7b042a5ebc68 100644
--- a/tools/perf/util/c++/clang-test.cpp
+++ b/tools/perf/util/c++/clang-test.cpp
@@ -41,7 +41,7 @@ int test__clang_to_IR(void)
41 if (!M) 41 if (!M)
42 return -1; 42 return -1;
43 for (llvm::Function& F : *M) 43 for (llvm::Function& F : *M)
44 if (F.getName() == "bpf_func__SyS_epoll_wait") 44 if (F.getName() == "bpf_func__SyS_epoll_pwait")
45 return 0; 45 return 0;
46 return -1; 46 return -1;
47} 47}
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp
index 1bfc946e37dc..bf31ceab33bd 100644
--- a/tools/perf/util/c++/clang.cpp
+++ b/tools/perf/util/c++/clang.cpp
@@ -9,6 +9,7 @@
9 * Copyright (C) 2016 Huawei Inc. 9 * Copyright (C) 2016 Huawei Inc.
10 */ 10 */
11 11
12#include "clang/Basic/Version.h"
12#include "clang/CodeGen/CodeGenAction.h" 13#include "clang/CodeGen/CodeGenAction.h"
13#include "clang/Frontend/CompilerInvocation.h" 14#include "clang/Frontend/CompilerInvocation.h"
14#include "clang/Frontend/CompilerInstance.h" 15#include "clang/Frontend/CompilerInstance.h"
@@ -58,7 +59,8 @@ createCompilerInvocation(llvm::opt::ArgStringList CFlags, StringRef& Path,
58 59
59 FrontendOptions& Opts = CI->getFrontendOpts(); 60 FrontendOptions& Opts = CI->getFrontendOpts();
60 Opts.Inputs.clear(); 61 Opts.Inputs.clear();
61 Opts.Inputs.emplace_back(Path, IK_C); 62 Opts.Inputs.emplace_back(Path,
63 FrontendOptions::getInputKindForExtension("c"));
62 return CI; 64 return CI;
63} 65}
64 66
@@ -71,10 +73,17 @@ getModuleFromSource(llvm::opt::ArgStringList CFlags,
71 73
72 Clang.setVirtualFileSystem(&*VFS); 74 Clang.setVirtualFileSystem(&*VFS);
73 75
76#if CLANG_VERSION_MAJOR < 4
74 IntrusiveRefCntPtr<CompilerInvocation> CI = 77 IntrusiveRefCntPtr<CompilerInvocation> CI =
75 createCompilerInvocation(std::move(CFlags), Path, 78 createCompilerInvocation(std::move(CFlags), Path,
76 Clang.getDiagnostics()); 79 Clang.getDiagnostics());
77 Clang.setInvocation(&*CI); 80 Clang.setInvocation(&*CI);
81#else
82 std::shared_ptr<CompilerInvocation> CI(
83 createCompilerInvocation(std::move(CFlags), Path,
84 Clang.getDiagnostics()));
85 Clang.setInvocation(CI);
86#endif
78 87
79 std::unique_ptr<CodeGenAction> Act(new EmitLLVMOnlyAction(&*LLVMCtx)); 88 std::unique_ptr<CodeGenAction> Act(new EmitLLVMOnlyAction(&*LLVMCtx));
80 if (!Clang.ExecuteAction(*Act)) 89 if (!Clang.ExecuteAction(*Act))
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 9496365da3d7..c9626c206208 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -11,8 +11,7 @@
11#include <stdlib.h> 11#include <stdlib.h>
12#include <stdarg.h> 12#include <stdarg.h>
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14#include <linux/types.h> 14#include <sys/types.h>
15#include "namespaces.h"
16 15
17/* General helper functions */ 16/* General helper functions */
18void usage(const char *err) __noreturn; 17void usage(const char *err) __noreturn;
@@ -26,6 +25,7 @@ static inline void *zalloc(size_t size)
26#define zfree(ptr) ({ free(*ptr); *ptr = NULL; }) 25#define zfree(ptr) ({ free(*ptr); *ptr = NULL; })
27 26
28struct dirent; 27struct dirent;
28struct nsinfo;
29struct strlist; 29struct strlist;
30 30
31int mkdir_p(char *path, mode_t mode); 31int mkdir_p(char *path, mode_t mode);