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

perf evlist: Adopt backwards ring buffer state enum

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>

+53 -29
+1
tools/perf/arch/s390/util/auxtrace.c
··· 1 1 #include <stdbool.h> 2 + #include <stdlib.h> 2 3 #include <linux/kernel.h> 3 4 #include <linux/types.h> 4 5 #include <linux/bitops.h>
+1
tools/perf/arch/x86/tests/perf-time-to-tsc.c
··· 17 17 #include "thread_map.h" 18 18 #include "record.h" 19 19 #include "tsc.h" 20 + #include "util/mmap.h" 20 21 #include "tests/tests.h" 21 22 22 23 #include "arch-tests.h"
+1
tools/perf/arch/x86/util/intel-bts.c
··· 15 15 #include "../../util/event.h" 16 16 #include "../../util/evsel.h" 17 17 #include "../../util/evlist.h" 18 + #include "../../util/mmap.h" 18 19 #include "../../util/session.h" 19 20 #include "../../util/pmu.h" 20 21 #include "../../util/debug.h"
+1
tools/perf/arch/x86/util/intel-pt.c
··· 18 18 #include "../../util/evlist.h" 19 19 #include "../../util/evsel.h" 20 20 #include "../../util/cpumap.h" 21 + #include "../../util/mmap.h" 21 22 #include <subcmd/parse-options.h> 22 23 #include "../../util/parse-events.h" 23 24 #include "../../util/pmu.h"
+1
tools/perf/builtin-kvm.c
··· 5 5 #include "util/build-id.h" 6 6 #include "util/evsel.h" 7 7 #include "util/evlist.h" 8 + #include "util/mmap.h" 8 9 #include "util/term.h" 9 10 #include "util/symbol.h" 10 11 #include "util/thread.h"
+1
tools/perf/builtin-record.c
··· 20 20 #include "util/evlist.h" 21 21 #include "util/evsel.h" 22 22 #include "util/debug.h" 23 + #include "util/mmap.h" 23 24 #include "util/target.h" 24 25 #include "util/session.h" 25 26 #include "util/tool.h"
+1
tools/perf/builtin-top.c
··· 30 30 #include "util/event.h" 31 31 #include "util/machine.h" 32 32 #include "util/map.h" 33 + #include "util/mmap.h" 33 34 #include "util/session.h" 34 35 #include "util/symbol.h" 35 36 #include "util/synthetic-events.h"
+1
tools/perf/builtin-trace.c
··· 31 31 #include "util/synthetic-events.h" 32 32 #include "util/evlist.h" 33 33 #include "util/evswitch.h" 34 + #include "util/mmap.h" 34 35 #include <subcmd/pager.h> 35 36 #include <subcmd/exec-cmd.h> 36 37 #include "util/machine.h"
+1
tools/perf/tests/backward-ring-buffer.c
··· 10 10 #include "tests.h" 11 11 #include "debug.h" 12 12 #include "parse-events.h" 13 + #include "util/mmap.h" 13 14 #include <errno.h> 14 15 #include <linux/string.h> 15 16
+1
tools/perf/tests/bpf.c
··· 19 19 #include "llvm.h" 20 20 #include "debug.h" 21 21 #include "parse-events.h" 22 + #include "util/mmap.h" 22 23 #define NR_ITERS 111 23 24 #define PERF_TEST_BPF_PATH "/sys/fs/bpf/perf_test" 24 25
+1
tools/perf/tests/code-reading.c
··· 24 24 #include "symbol.h" 25 25 #include "event.h" 26 26 #include "record.h" 27 + #include "util/mmap.h" 27 28 #include "util/synthetic-events.h" 28 29 #include "thread.h" 29 30
+1
tools/perf/tests/hists_link.c
··· 8 8 #include "machine.h" 9 9 #include "parse-events.h" 10 10 #include "hists_common.h" 11 + #include "util/mmap.h" 11 12 #include <errno.h> 12 13 #include <linux/kernel.h> 13 14
+1
tools/perf/tests/keep-tracking.c
··· 13 13 #include "record.h" 14 14 #include "thread_map.h" 15 15 #include "tests.h" 16 + #include "util/mmap.h" 16 17 17 18 #define CHECK__(x) { \ 18 19 while ((x) < 0) { \
+1
tools/perf/tests/mmap-basic.c
··· 11 11 #include "evsel.h" 12 12 #include "thread_map.h" 13 13 #include "tests.h" 14 + #include "util/mmap.h" 14 15 #include <linux/err.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/string.h>
+1
tools/perf/tests/openat-syscall-tp-fields.c
··· 11 11 #include "record.h" 12 12 #include "tests.h" 13 13 #include "debug.h" 14 + #include "util/mmap.h" 14 15 #include <errno.h> 15 16 16 17 #ifndef O_DIRECTORY
+1
tools/perf/tests/perf-record.c
··· 11 11 #include "debug.h" 12 12 #include "record.h" 13 13 #include "tests.h" 14 + #include "util/mmap.h" 14 15 15 16 static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) 16 17 {
+1
tools/perf/tests/sw-clock.c
··· 12 12 #include "util/evsel.h" 13 13 #include "util/evlist.h" 14 14 #include "util/cpumap.h" 15 + #include "util/mmap.h" 15 16 #include "util/thread_map.h" 16 17 #include <perf/evlist.h> 17 18
+1
tools/perf/tests/switch-tracking.c
··· 16 16 #include "thread_map.h" 17 17 #include "record.h" 18 18 #include "tests.h" 19 + #include "util/mmap.h" 19 20 20 21 static int spin_sleep(void) 21 22 {
+1
tools/perf/tests/task-exit.c
··· 5 5 #include "target.h" 6 6 #include "thread_map.h" 7 7 #include "tests.h" 8 + #include "util/mmap.h" 8 9 9 10 #include <errno.h> 10 11 #include <signal.h>
+1
tools/perf/ui/gtk/hists.c
··· 8 8 #include "../string2.h" 9 9 #include "gtk.h" 10 10 #include <signal.h> 11 + #include <stdlib.h> 11 12 #include <linux/string.h> 12 13 13 14 #define MAX_COLUMNS 32
+1
tools/perf/util/annotate.c
··· 34 34 #include "bpf-event.h" 35 35 #include "block-range.h" 36 36 #include "string2.h" 37 + #include "util/mmap.h" 37 38 #include "arch/common.h" 38 39 #include <regex.h> 39 40 #include <pthread.h>
+1
tools/perf/util/auxtrace.c
··· 51 51 #include "arm-spe.h" 52 52 #include "s390-cpumsf.h" 53 53 #include "util.h" // page_size 54 + #include "util/mmap.h" 54 55 55 56 #include <linux/ctype.h> 56 57 #include <linux/kernel.h>
+1
tools/perf/util/evlist.c
··· 10 10 #include <inttypes.h> 11 11 #include <poll.h> 12 12 #include "cpumap.h" 13 + #include "util/mmap.h" 13 14 #include "thread_map.h" 14 15 #include "target.h" 15 16 #include "evlist.h"
+29 -1
tools/perf/util/evlist.h
··· 11 11 #include <internal/evlist.h> 12 12 #include "events_stats.h" 13 13 #include "evsel.h" 14 - #include "mmap.h" 14 + #include <pthread.h> 15 15 #include <signal.h> 16 16 #include <unistd.h> 17 17 ··· 19 19 struct thread_map; 20 20 struct perf_cpu_map; 21 21 struct record_opts; 22 + 23 + /* 24 + * State machine of bkw_mmap_state: 25 + * 26 + * .________________(forbid)_____________. 27 + * | V 28 + * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY 29 + * ^ ^ | ^ | 30 + * | |__(forbid)____/ |___(forbid)___/| 31 + * | | 32 + * \_________________(3)_______________/ 33 + * 34 + * NOTREADY : Backward ring buffers are not ready 35 + * RUNNING : Backward ring buffers are recording 36 + * DATA_PENDING : We are required to collect data from backward ring buffers 37 + * EMPTY : We have collected data from backward ring buffers. 38 + * 39 + * (0): Setup backward ring buffer 40 + * (1): Pause ring buffers for reading 41 + * (2): Read from ring buffers 42 + * (3): Resume ring buffers for recording 43 + */ 44 + enum bkw_mmap_state { 45 + BKW_MMAP_NOTREADY, 46 + BKW_MMAP_RUNNING, 47 + BKW_MMAP_DATA_PENDING, 48 + BKW_MMAP_EMPTY, 49 + }; 22 50 23 51 #define PERF_EVLIST__HLIST_BITS 8 24 52 #define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS)
-28
tools/perf/util/mmap.h
··· 45 45 int comp_level; 46 46 }; 47 47 48 - /* 49 - * State machine of bkw_mmap_state: 50 - * 51 - * .________________(forbid)_____________. 52 - * | V 53 - * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY 54 - * ^ ^ | ^ | 55 - * | |__(forbid)____/ |___(forbid)___/| 56 - * | | 57 - * \_________________(3)_______________/ 58 - * 59 - * NOTREADY : Backward ring buffers are not ready 60 - * RUNNING : Backward ring buffers are recording 61 - * DATA_PENDING : We are required to collect data from backward ring buffers 62 - * EMPTY : We have collected data from backward ring buffers. 63 - * 64 - * (0): Setup backward ring buffer 65 - * (1): Pause ring buffers for reading 66 - * (2): Read from ring buffers 67 - * (3): Resume ring buffers for recording 68 - */ 69 - enum bkw_mmap_state { 70 - BKW_MMAP_NOTREADY, 71 - BKW_MMAP_RUNNING, 72 - BKW_MMAP_DATA_PENDING, 73 - BKW_MMAP_EMPTY, 74 - }; 75 - 76 48 struct mmap_params { 77 49 int prot, mask, nr_cblocks, affinity, flush, comp_level; 78 50 struct auxtrace_mmap_params auxtrace_mp;
+1
tools/perf/util/parse-events.c
··· 34 34 #include "asm/bug.h" 35 35 #include "util/parse-branch-options.h" 36 36 #include "metricgroup.h" 37 + #include "util/mmap.h" 37 38 38 39 #define MAX_NAME_LEN 100 39 40