提交 77d54a2c 编写于 作者: N Namhyung Kim 提交者: Arnaldo Carvalho de Melo

perf lock: Pass machine pointer to is_lock_function()

This is a preparation for later change to expose the function externally
so that it can be used without the implicit session data.
Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
Cc: Blake Jones <blakejones@google.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220729200756.666106-2-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 9bd70218
...@@ -947,10 +947,9 @@ static int report_lock_release_event(struct evsel *evsel, ...@@ -947,10 +947,9 @@ static int report_lock_release_event(struct evsel *evsel,
return 0; return 0;
} }
static bool is_lock_function(u64 addr) static bool is_lock_function(struct machine *machine, u64 addr)
{ {
if (!sched_text_start) { if (!sched_text_start) {
struct machine *machine = &session->machines.host;
struct map *kmap; struct map *kmap;
struct symbol *sym; struct symbol *sym;
...@@ -1002,6 +1001,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl ...@@ -1002,6 +1001,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl
{ {
struct thread *thread; struct thread *thread;
struct callchain_cursor *cursor = &callchain_cursor; struct callchain_cursor *cursor = &callchain_cursor;
struct machine *machine = &session->machines.host;
struct symbol *sym; struct symbol *sym;
int skip = 0; int skip = 0;
int ret; int ret;
...@@ -1010,8 +1010,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl ...@@ -1010,8 +1010,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl
if (show_thread_stats) if (show_thread_stats)
return -1; return -1;
thread = machine__findnew_thread(&session->machines.host, thread = machine__findnew_thread(machine, -1, sample->pid);
-1, sample->pid);
if (thread == NULL) if (thread == NULL)
return -1; return -1;
...@@ -1038,7 +1037,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl ...@@ -1038,7 +1037,7 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl
goto next; goto next;
sym = node->ms.sym; sym = node->ms.sym;
if (sym && !is_lock_function(node->ip)) { if (sym && !is_lock_function(machine, node->ip)) {
struct map *map = node->ms.map; struct map *map = node->ms.map;
u64 offset; u64 offset;
...@@ -1060,13 +1059,13 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl ...@@ -1060,13 +1059,13 @@ static int lock_contention_caller(struct evsel *evsel, struct perf_sample *sampl
static u64 callchain_id(struct evsel *evsel, struct perf_sample *sample) static u64 callchain_id(struct evsel *evsel, struct perf_sample *sample)
{ {
struct callchain_cursor *cursor = &callchain_cursor; struct callchain_cursor *cursor = &callchain_cursor;
struct machine *machine = &session->machines.host;
struct thread *thread; struct thread *thread;
u64 hash = 0; u64 hash = 0;
int skip = 0; int skip = 0;
int ret; int ret;
thread = machine__findnew_thread(&session->machines.host, thread = machine__findnew_thread(machine, -1, sample->pid);
-1, sample->pid);
if (thread == NULL) if (thread == NULL)
return -1; return -1;
...@@ -1091,7 +1090,7 @@ static u64 callchain_id(struct evsel *evsel, struct perf_sample *sample) ...@@ -1091,7 +1090,7 @@ static u64 callchain_id(struct evsel *evsel, struct perf_sample *sample)
if (++skip <= CONTENTION_STACK_SKIP) if (++skip <= CONTENTION_STACK_SKIP)
goto next; goto next;
if (node->ms.sym && is_lock_function(node->ip)) if (node->ms.sym && is_lock_function(machine, node->ip))
goto next; goto next;
hash ^= hash_long((unsigned long)node->ip, 64); hash ^= hash_long((unsigned long)node->ip, 64);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册