]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
perf evlist: Adopt backwards ring buffer state enum
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 23 Sep 2019 15:20:38 +0000 (12:20 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Sep 2019 12:51:45 +0000 (09:51 -0300)
As this isn't used at all in mmap.h but in evlist.h, so to cut down the
header dependency tree, move it to where it is used.

Also add mmap.h to the places using it but previously getting it
indirectly via evlist.h.

Add missing pthread.h to evlist.h, as it has a pthread_t struct member
and was getting the header via mmap.h.

Noticed while processing a Jiri's libperf batch touching mmap.h, where
almost everything gets rebuilt because evlist.h is so popular, so cut
down't this rebuild the world party.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Link: https://lkml.kernel.org/n/tip-he0uljeftl0xfveh3d6vtode@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
26 files changed:
tools/perf/arch/s390/util/auxtrace.c
tools/perf/arch/x86/tests/perf-time-to-tsc.c
tools/perf/arch/x86/util/intel-bts.c
tools/perf/arch/x86/util/intel-pt.c
tools/perf/builtin-kvm.c
tools/perf/builtin-record.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bpf.c
tools/perf/tests/code-reading.c
tools/perf/tests/hists_link.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/perf-record.c
tools/perf/tests/sw-clock.c
tools/perf/tests/switch-tracking.c
tools/perf/tests/task-exit.c
tools/perf/ui/gtk/hists.c
tools/perf/util/annotate.c
tools/perf/util/auxtrace.c
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/mmap.h
tools/perf/util/parse-events.c

index b0fb70e38960dc9c339aaa7348eb5bff73f2459e..0db5c58c98e81a52c67e51eb7a0d4b1a94df03a6 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdbool.h>
+#include <stdlib.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
index 42ae47525a76e88702785974187b4a2c3c936f51..e1dd5f8894ba6359cf04e3eea58ea622633bcb80 100644 (file)
@@ -17,6 +17,7 @@
 #include "thread_map.h"
 #include "record.h"
 #include "tsc.h"
+#include "util/mmap.h"
 #include "tests/tests.h"
 
 #include "arch-tests.h"
index 090d90e093df68bfc1b30ab3687e1cacdf6a6ba0..64b409dad6e2e3044d56b91679c4a675ca898f98 100644 (file)
@@ -15,6 +15,7 @@
 #include "../../util/event.h"
 #include "../../util/evsel.h"
 #include "../../util/evlist.h"
+#include "../../util/mmap.h"
 #include "../../util/session.h"
 #include "../../util/pmu.h"
 #include "../../util/debug.h"
index 3d041b89f018c86944a1945ee931a290a65e44f7..6c139611d23196a54e8483e66ddb3834cdfff273 100644 (file)
@@ -18,6 +18,7 @@
 #include "../../util/evlist.h"
 #include "../../util/evsel.h"
 #include "../../util/cpumap.h"
+#include "../../util/mmap.h"
 #include <subcmd/parse-options.h>
 #include "../../util/parse-events.h"
 #include "../../util/pmu.h"
index 72debb7bd20d18bb8aff478cdb99d609adef10c8..30852848ed9ce329916fd6de3dd22b6cbe800e9a 100644 (file)
@@ -5,6 +5,7 @@
 #include "util/build-id.h"
 #include "util/evsel.h"
 #include "util/evlist.h"
+#include "util/mmap.h"
 #include "util/term.h"
 #include "util/symbol.h"
 #include "util/thread.h"
index 093d9ab5633eb0d2691882aa8d6f002fcccafdcc..1bb3d91c6599cc7383715471e40bd2459d24221c 100644 (file)
@@ -20,6 +20,7 @@
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include "util/debug.h"
+#include "util/mmap.h"
 #include "util/target.h"
 #include "util/session.h"
 #include "util/tool.h"
index 771b3ff47dc3b64062a53e38e94bbfd0676810dd..e637a08655dbed93526268352d4115d5569d1c82 100644 (file)
@@ -30,6 +30,7 @@
 #include "util/event.h"
 #include "util/machine.h"
 #include "util/map.h"
+#include "util/mmap.h"
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/synthetic-events.h"
index ff989351567df27089c80ad48ba524977ebad18c..c44280358e58a1716b327c8b4168f728f0c74cdd 100644 (file)
@@ -31,6 +31,7 @@
 #include "util/synthetic-events.h"
 #include "util/evlist.h"
 #include "util/evswitch.h"
+#include "util/mmap.h"
 #include <subcmd/pager.h>
 #include <subcmd/exec-cmd.h>
 #include "util/machine.h"
index 3073a68d17b932e15db98f7b0c8579aa7c85e646..c59d3752d48dd1cb7920a8ee5ba9b17200d43165 100644 (file)
@@ -10,6 +10,7 @@
 #include "tests.h"
 #include "debug.h"
 #include "parse-events.h"
+#include "util/mmap.h"
 #include <errno.h>
 #include <linux/string.h>
 
index 96473191549872b24b2084ec33d417af7fe75fc7..3c8533fdbce5c8c3a683ab3fb6e3e8b422b3c9ea 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm.h"
 #include "debug.h"
 #include "parse-events.h"
+#include "util/mmap.h"
 #define NR_ITERS       111
 #define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test"
 
index 413783b69006f5191ee76d205c2fabea9fc62445..bc6db3e7a1c58a45f55553609b92582e3884fa00 100644 (file)
@@ -24,6 +24,7 @@
 #include "symbol.h"
 #include "event.h"
 #include "record.h"
+#include "util/mmap.h"
 #include "util/synthetic-events.h"
 #include "thread.h"
 
index 8be4d0b61e3a4d0d5306092e27a22aff066ebcde..1a3bdc0a2d142a9d2b73d629d1d01a0bb1d6a7c1 100644 (file)
@@ -8,6 +8,7 @@
 #include "machine.h"
 #include "parse-events.h"
 #include "hists_common.h"
+#include "util/mmap.h"
 #include <errno.h>
 #include <linux/kernel.h>
 
index 8e2ec5f72042c6ee5d33191855b93a4a6ae9b520..c6030fdf7d4c332b0998d687dcf67c67f978d785 100644 (file)
@@ -13,6 +13,7 @@
 #include "record.h"
 #include "thread_map.h"
 #include "tests.h"
+#include "util/mmap.h"
 
 #define CHECK__(x) {                           \
        while ((x) < 0) {                       \
index 4d42e455feb70f81777a9ca2f4f58312fb6931b6..3a22dce991ba94c2ecc7499a9f9de9d05570ac6b 100644 (file)
@@ -11,6 +11,7 @@
 #include "evsel.h"
 #include "thread_map.h"
 #include "tests.h"
+#include "util/mmap.h"
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
index 5c2576174ae9e38595a9737cf84b4daef6a74171..e20eaadb1a352e9160e53d7d5e7a592e4ded9c01 100644 (file)
@@ -11,6 +11,7 @@
 #include "record.h"
 #include "tests.h"
 #include "debug.h"
+#include "util/mmap.h"
 #include <errno.h>
 
 #ifndef O_DIRECTORY
index 669fd88e7f30d54bd33f57ea11eecb92cc6fe401..ea8bcaa13ea5fd73d3f8193228918296a69404bf 100644 (file)
@@ -11,6 +11,7 @@
 #include "debug.h"
 #include "record.h"
 #include "tests.h"
+#include "util/mmap.h"
 
 static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
 {
index fbff60815be85b11ede60b91172401b850073f31..84519df87f309ecf466acdf54be13b04dac9bf03 100644 (file)
@@ -12,6 +12,7 @@
 #include "util/evsel.h"
 #include "util/evlist.h"
 #include "util/cpumap.h"
+#include "util/mmap.h"
 #include "util/thread_map.h"
 #include <perf/evlist.h>
 
index c92e287e0f538a73090d49019d86ee819ad16576..e5c3f2ee223a6e0750316db297af5905b4d99583 100644 (file)
@@ -16,6 +16,7 @@
 #include "thread_map.h"
 #include "record.h"
 #include "tests.h"
+#include "util/mmap.h"
 
 static int spin_sleep(void)
 {
index 718838b5e7249cc8eedee604c91b186b0d10ff58..7fc39af48a7638d0baeba7f1481acc28132b415b 100644 (file)
@@ -5,6 +5,7 @@
 #include "target.h"
 #include "thread_map.h"
 #include "tests.h"
+#include "util/mmap.h"
 
 #include <errno.h>
 #include <signal.h>
index 6c2efc10bf5caa031c65288b27f32339f83de4fa..ed1a97b2c4b01de690d6bd2044a9bdae14d2fdd3 100644 (file)
@@ -8,6 +8,7 @@
 #include "../string2.h"
 #include "gtk.h"
 #include <signal.h>
+#include <stdlib.h>
 #include <linux/string.h>
 
 #define MAX_COLUMNS                    32
index d441cca6a517d25f1a7e52f64e4191b738f8c309..69d0a1991b292cfde38eedb836db175561f9b054 100644 (file)
@@ -34,6 +34,7 @@
 #include "bpf-event.h"
 #include "block-range.h"
 #include "string2.h"
+#include "util/mmap.h"
 #include "arch/common.h"
 #include <regex.h>
 #include <pthread.h>
index 1d22ffd972ac2e9cbd1ff88442aa754c91668e42..4bd92f5bfb5fd0334916b379188a5999cccbd559 100644 (file)
@@ -51,6 +51,7 @@
 #include "arm-spe.h"
 #include "s390-cpumsf.h"
 #include "util.h" // page_size
+#include "util/mmap.h"
 
 #include <linux/ctype.h>
 #include <linux/kernel.h>
index c96c743cc1d22b286bd3ae3b05c12080dc37baa8..f700dbe043b7f0ac440eabafc7bcb88f036ef0b4 100644 (file)
@@ -10,6 +10,7 @@
 #include <inttypes.h>
 #include <poll.h>
 #include "cpumap.h"
+#include "util/mmap.h"
 #include "thread_map.h"
 #include "target.h"
 #include "evlist.h"
index b33c5d67410a5b40ccf1d0c913ced8ecf00b4694..8b9c35efea67e874f72cb545c794115aa6aee2f8 100644 (file)
@@ -11,7 +11,7 @@
 #include <internal/evlist.h>
 #include "events_stats.h"
 #include "evsel.h"
-#include "mmap.h"
+#include <pthread.h>
 #include <signal.h>
 #include <unistd.h>
 
@@ -20,6 +20,34 @@ struct thread_map;
 struct perf_cpu_map;
 struct record_opts;
 
+/*
+ * State machine of bkw_mmap_state:
+ *
+ *                     .________________(forbid)_____________.
+ *                     |                                     V
+ * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
+ *                     ^  ^              |   ^               |
+ *                     |  |__(forbid)____/   |___(forbid)___/|
+ *                     |                                     |
+ *                      \_________________(3)_______________/
+ *
+ * NOTREADY     : Backward ring buffers are not ready
+ * RUNNING      : Backward ring buffers are recording
+ * DATA_PENDING : We are required to collect data from backward ring buffers
+ * EMPTY        : We have collected data from backward ring buffers.
+ *
+ * (0): Setup backward ring buffer
+ * (1): Pause ring buffers for reading
+ * (2): Read from ring buffers
+ * (3): Resume ring buffers for recording
+ */
+enum bkw_mmap_state {
+       BKW_MMAP_NOTREADY,
+       BKW_MMAP_RUNNING,
+       BKW_MMAP_DATA_PENDING,
+       BKW_MMAP_EMPTY,
+};
+
 #define PERF_EVLIST__HLIST_BITS 8
 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
 
index 01524608a984f61b3979ad2e7289df1c71625779..ab086ede044ab2d5f69db57994b18b2393d288f7 100644 (file)
@@ -45,34 +45,6 @@ struct mmap {
        int             comp_level;
 };
 
-/*
- * State machine of bkw_mmap_state:
- *
- *                     .________________(forbid)_____________.
- *                     |                                     V
- * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
- *                     ^  ^              |   ^               |
- *                     |  |__(forbid)____/   |___(forbid)___/|
- *                     |                                     |
- *                      \_________________(3)_______________/
- *
- * NOTREADY     : Backward ring buffers are not ready
- * RUNNING      : Backward ring buffers are recording
- * DATA_PENDING : We are required to collect data from backward ring buffers
- * EMPTY        : We have collected data from backward ring buffers.
- *
- * (0): Setup backward ring buffer
- * (1): Pause ring buffers for reading
- * (2): Read from ring buffers
- * (3): Resume ring buffers for recording
- */
-enum bkw_mmap_state {
-       BKW_MMAP_NOTREADY,
-       BKW_MMAP_RUNNING,
-       BKW_MMAP_DATA_PENDING,
-       BKW_MMAP_EMPTY,
-};
-
 struct mmap_params {
        int prot, mask, nr_cblocks, affinity, flush, comp_level;
        struct auxtrace_mmap_params auxtrace_mp;
index a33a1d5059a27ddf341aa496881a458ed9a78491..9cf1371c90a3c39c22684a0154bc2db0e7b21f1b 100644 (file)
@@ -34,6 +34,7 @@
 #include "asm/bug.h"
 #include "util/parse-branch-options.h"
 #include "metricgroup.h"
+#include "util/mmap.h"
 
 #define MAX_NAME_LEN 100