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 inject: Do not inject BUILD_ID record if MMAP2 has it

When PERF_RECORD_MISC_MMAP_BUILD_ID is set, the event has a build-id
of the DSO already so no need to add it again.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210524225051.1190486-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
f7fc0d1c 0c3f7b38

+24
+24
tools/perf/builtin-inject.c
··· 399 399 err = perf_event__process_mmap2(tool, event, sample, machine); 400 400 perf_event__repipe(tool, event, sample, machine); 401 401 402 + if (event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID) { 403 + struct dso *dso; 404 + 405 + dso = findnew_dso(event->mmap2.pid, event->mmap2.tid, 406 + event->mmap2.filename, NULL, machine); 407 + if (dso) { 408 + /* mark it not to inject build-id */ 409 + dso->hit = 1; 410 + } 411 + dso__put(dso); 412 + } 413 + 402 414 return err; 403 415 } 404 416 ··· 451 439 .ino_generation = event->mmap2.ino_generation, 452 440 }; 453 441 struct dso *dso; 442 + 443 + if (event->header.misc & PERF_RECORD_MISC_MMAP_BUILD_ID) { 444 + /* cannot use dso_id since it'd have invalid info */ 445 + dso = findnew_dso(event->mmap2.pid, event->mmap2.tid, 446 + event->mmap2.filename, NULL, machine); 447 + if (dso) { 448 + /* mark it not to inject build-id */ 449 + dso->hit = 1; 450 + } 451 + dso__put(dso); 452 + return 0; 453 + } 454 454 455 455 dso = findnew_dso(event->mmap2.pid, event->mmap2.tid, 456 456 event->mmap2.filename, &dso_id, machine);