perf auxtrace: Remove auxtrace_mmap__read_snapshot_head()
authorLeo Yan <leo.yan@linaro.org>
Mon, 9 Aug 2021 11:14:05 +0000 (19:14 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 9 Aug 2021 20:01:23 +0000 (17:01 -0300)
Since the function auxtrace_mmap__read_snapshot_head() is exactly same
with auxtrace_mmap__read_head(), whether the session is in snapshot mode
or not, it's unified to use function auxtrace_mmap__read_head() for
reading AUX buffer head.

And the function auxtrace_mmap__read_snapshot_head() is unused so this
patch removes it.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Daniel Díaz <daniel.diaz@linaro.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: coresight@lists.linaro.org
Cc: x86@kernel.org
Link: http://lore.kernel.org/lkml/20210809111407.596077-8-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h

index cb19669d2a5b112b51b1cd0b27ebff4d7b440e25..2dcf3d12ba32220fb729b6fad877f14f0931f102 100644 (file)
@@ -1686,14 +1686,11 @@ static int __auxtrace_mmap__read(struct mmap *map,
        union perf_event ev;
        void *data1, *data2;
 
-       if (snapshot) {
-               head = auxtrace_mmap__read_snapshot_head(mm);
-               if (auxtrace_record__find_snapshot(itr, mm->idx, mm, data,
-                                                  &head, &old))
-                       return -1;
-       } else {
-               head = auxtrace_mmap__read_head(mm);
-       }
+       head = auxtrace_mmap__read_head(mm);
+
+       if (snapshot &&
+           auxtrace_record__find_snapshot(itr, mm->idx, mm, data, &head, &old))
+               return -1;
 
        if (old == head)
                return 0;
index 4f91763681341d6796a7ad90c59538bd09606b55..d68a5e80b217668e042364e208636aac7d178734 100644 (file)
@@ -440,16 +440,6 @@ struct auxtrace_cache;
 
 #ifdef HAVE_AUXTRACE_SUPPORT
 
-static inline u64 auxtrace_mmap__read_snapshot_head(struct auxtrace_mmap *mm)
-{
-       struct perf_event_mmap_page *pc = mm->userpg;
-       u64 head = READ_ONCE(pc->aux_head);
-
-       /* Ensure all reads are done after we read the head */
-       smp_rmb();
-       return head;
-}
-
 static inline u64 auxtrace_mmap__read_head(struct auxtrace_mmap *mm)
 {
        struct perf_event_mmap_page *pc = mm->userpg;