Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf lock: Change type of lock_stat->addr to u64

As evsel__intval() returns u64, we can just use it as is.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220127000050.3011493-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
e1c3177b 7672d00a

+9 -26
+9 -26
tools/perf/builtin-lock.c
··· 47 47 struct hlist_node hash_entry; 48 48 struct rb_node rb; /* used for sorting */ 49 49 50 - /* 51 - * FIXME: evsel__intval() returns u64, 52 - * so address of lockdep_map should be treated as 64bit. 53 - * Is there more better solution? 54 - */ 55 - void *addr; /* address of lockdep_map, used as ID */ 50 + u64 addr; /* address of lockdep_map, used as ID */ 56 51 char *name; /* for strcpy(), we cannot use const */ 57 52 58 53 unsigned int nr_acquire; ··· 101 106 struct list_head list; 102 107 int state; 103 108 u64 prev_event_time; 104 - void *addr; 109 + u64 addr; 105 110 106 111 int read_count; 107 112 }; ··· 310 315 return container_of(node, struct lock_stat, rb); 311 316 } 312 317 313 - static struct lock_stat *lock_stat_findnew(void *addr, const char *name) 318 + static struct lock_stat *lock_stat_findnew(u64 addr, const char *name) 314 319 { 315 320 struct hlist_head *entry = lockhashentry(addr); 316 321 struct lock_stat *ret, *new; ··· 356 361 struct perf_sample *sample); 357 362 }; 358 363 359 - static struct lock_seq_stat *get_seq(struct thread_stat *ts, void *addr) 364 + static struct lock_seq_stat *get_seq(struct thread_stat *ts, u64 addr) 360 365 { 361 366 struct lock_seq_stat *seq; 362 367 ··· 395 400 static int report_lock_acquire_event(struct evsel *evsel, 396 401 struct perf_sample *sample) 397 402 { 398 - void *addr; 399 403 struct lock_stat *ls; 400 404 struct thread_stat *ts; 401 405 struct lock_seq_stat *seq; 402 406 const char *name = evsel__strval(evsel, sample, "name"); 403 - u64 tmp = evsel__intval(evsel, sample, "lockdep_addr"); 407 + u64 addr = evsel__intval(evsel, sample, "lockdep_addr"); 404 408 int flag = evsel__intval(evsel, sample, "flags"); 405 - 406 - memcpy(&addr, &tmp, sizeof(void *)); 407 409 408 410 ls = lock_stat_findnew(addr, name); 409 411 if (!ls) ··· 464 472 static int report_lock_acquired_event(struct evsel *evsel, 465 473 struct perf_sample *sample) 466 474 { 467 - void *addr; 468 475 struct lock_stat *ls; 469 476 struct thread_stat *ts; 470 477 struct lock_seq_stat *seq; 471 478 u64 contended_term; 472 479 const char *name = evsel__strval(evsel, sample, "name"); 473 - u64 tmp = evsel__intval(evsel, sample, "lockdep_addr"); 474 - 475 - memcpy(&addr, &tmp, sizeof(void *)); 480 + u64 addr = evsel__intval(evsel, sample, "lockdep_addr"); 476 481 477 482 ls = lock_stat_findnew(addr, name); 478 483 if (!ls) ··· 524 535 static int report_lock_contended_event(struct evsel *evsel, 525 536 struct perf_sample *sample) 526 537 { 527 - void *addr; 528 538 struct lock_stat *ls; 529 539 struct thread_stat *ts; 530 540 struct lock_seq_stat *seq; 531 541 const char *name = evsel__strval(evsel, sample, "name"); 532 - u64 tmp = evsel__intval(evsel, sample, "lockdep_addr"); 533 - 534 - memcpy(&addr, &tmp, sizeof(void *)); 542 + u64 addr = evsel__intval(evsel, sample, "lockdep_addr"); 535 543 536 544 ls = lock_stat_findnew(addr, name); 537 545 if (!ls) ··· 576 590 static int report_lock_release_event(struct evsel *evsel, 577 591 struct perf_sample *sample) 578 592 { 579 - void *addr; 580 593 struct lock_stat *ls; 581 594 struct thread_stat *ts; 582 595 struct lock_seq_stat *seq; 583 596 const char *name = evsel__strval(evsel, sample, "name"); 584 - u64 tmp = evsel__intval(evsel, sample, "lockdep_addr"); 585 - 586 - memcpy(&addr, &tmp, sizeof(void *)); 597 + u64 addr = evsel__intval(evsel, sample, "lockdep_addr"); 587 598 588 599 ls = lock_stat_findnew(addr, name); 589 600 if (!ls) ··· 765 782 pr_info("Address of instance: name of class\n"); 766 783 for (i = 0; i < LOCKHASH_SIZE; i++) { 767 784 hlist_for_each_entry(st, &lockhash_table[i], hash_entry) { 768 - pr_info(" %p: %s\n", st->addr, st->name); 785 + pr_info(" %#llx: %s\n", (unsigned long long)st->addr, st->name); 769 786 } 770 787 } 771 788 }