Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __PERF_MACHINE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __PERF_MACHINE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <sys/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include "maps.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include "dsos.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "rwsem.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) struct addr_location;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) struct branch_stack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) struct dso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct dso_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct evsel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct perf_sample;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) struct target;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) union perf_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /* Native host kernel uses -1 as pid index in machine */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define	HOST_KERNEL_ID			(-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define	DEFAULT_GUEST_KERNEL_ID		(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) extern const char *ref_reloc_sym_names[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) struct vdso_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define THREADS__TABLE_BITS	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define THREADS__TABLE_SIZE	(1 << THREADS__TABLE_BITS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) struct threads {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct rb_root_cached  entries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct rw_semaphore    lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	unsigned int	       nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	struct list_head       dead;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct thread	       *last_match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) struct machine {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct rb_node	  rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	pid_t		  pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	u16		  id_hdr_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	bool		  comm_exec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	bool		  kptr_restrict_warned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	bool		  single_address_space;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	char		  *root_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	char		  *mmap_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct threads    threads[THREADS__TABLE_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct vdso_info  *vdso_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	struct perf_env   *env;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	struct dsos	  dsos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	struct maps	  kmaps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	struct map	  *vmlinux_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u64		  kernel_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	pid_t		  *current_tid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	union { /* Tool specific area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		void	  *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		u64	  db_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	bool		  trampolines_mapped;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) static inline struct threads *machine__threads(struct machine *machine, pid_t tid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	/* Cast it to handle tid == -1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	return &machine->threads[(unsigned int)tid % THREADS__TABLE_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  * The main kernel (vmlinux) map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) struct map *machine__kernel_map(struct machine *machine)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	return machine->vmlinux_map;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  * kernel (the one returned by machine__kernel_map()) plus kernel modules maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) struct maps *machine__kernel_maps(struct machine *machine)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	return &machine->kmaps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) int machine__get_kernel_start(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static inline u64 machine__kernel_start(struct machine *machine)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	if (!machine->kernel_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		machine__get_kernel_start(machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	return machine->kernel_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline bool machine__kernel_ip(struct machine *machine, u64 ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	u64 kernel_start = machine__kernel_start(machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	return ip >= kernel_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u8 machine__addr_cpumode(struct machine *machine, u8 cpumode, u64 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct thread *machine__find_thread(struct machine *machine, pid_t pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 				    pid_t tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct comm *machine__thread_exec_comm(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 				       struct thread *thread);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) int machine__process_comm_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) int machine__process_exit_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) int machine__process_fork_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) int machine__process_lost_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) int machine__process_lost_samples_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 					struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) int machine__process_aux_event(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			       union perf_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) int machine__process_itrace_start_event(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 					union perf_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) int machine__process_switch_event(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 				  union perf_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) int machine__process_namespaces_event(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 				      union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 				      struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) int machine__process_cgroup_event(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 				  union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 				  struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) int machine__process_mmap_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) int machine__process_mmap2_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 				 struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) int machine__process_ksymbol(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			     union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			     struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) int machine__process_text_poke(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			       union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			       struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int machine__process_event(struct machine *machine, union perf_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 				struct perf_sample *sample);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) typedef void (*machine__process_t)(struct machine *machine, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct machines {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct machine host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	struct rb_root_cached guests;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) void machines__init(struct machines *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) void machines__exit(struct machines *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) void machines__process_guests(struct machines *machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			      machine__process_t process, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct machine *machines__add(struct machines *machines, pid_t pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 			      const char *root_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) struct machine *machines__find_host(struct machines *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct machine *machines__find(struct machines *machines, pid_t pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) struct machine *machines__findnew(struct machines *machines, pid_t pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) void machines__set_id_hdr_size(struct machines *machines, u16 id_hdr_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) void machines__set_comm_exec(struct machines *machines, bool comm_exec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) struct machine *machine__new_host(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct machine *machine__new_kallsyms(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) int machine__init(struct machine *machine, const char *root_dir, pid_t pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) void machine__exit(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) void machine__delete_threads(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) void machine__delete(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) void machine__remove_thread(struct machine *machine, struct thread *th);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) struct branch_info *sample__resolve_bstack(struct perf_sample *sample,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 					   struct addr_location *al);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct mem_info *sample__resolve_mem(struct perf_sample *sample,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				     struct addr_location *al);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct callchain_cursor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) int thread__resolve_callchain(struct thread *thread,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			      struct callchain_cursor *cursor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			      struct evsel *evsel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			      struct perf_sample *sample,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			      struct symbol **parent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			      struct addr_location *root_al,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			      int max_stack);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  * Default guest kernel is defined by parameter --guestkallsyms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)  * and --guestmodules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static inline bool machine__is_default_guest(struct machine *machine)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	return machine ? machine->pid == DEFAULT_GUEST_KERNEL_ID : false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) static inline bool machine__is_host(struct machine *machine)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	return machine ? machine->pid == HOST_KERNEL_ID : false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) bool machine__is(struct machine *machine, const char *arch);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int machine__nr_cpus_avail(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) struct dso *machine__findnew_dso_id(struct machine *machine, const char *filename, struct dso_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct dso *machine__findnew_dso(struct machine *machine, const char *filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) size_t machine__fprintf(struct machine *machine, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) struct symbol *machine__find_kernel_symbol(struct machine *machine, u64 addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 					   struct map **mapp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	return maps__find_symbol(&machine->kmaps, addr, mapp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct symbol *machine__find_kernel_symbol_by_name(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 						   const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 						   struct map **mapp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	return maps__find_symbol_by_name(&machine->kmaps, name, mapp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) int arch__fix_module_text_start(u64 *start, u64 *size, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int machine__load_kallsyms(struct machine *machine, const char *filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int machine__load_vmlinux_path(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 				     bool (skip)(struct dso *dso, int parm), int parm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) size_t machines__fprintf_dsos(struct machines *machines, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) size_t machines__fprintf_dsos_buildid(struct machines *machines, FILE *fp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 				     bool (skip)(struct dso *dso, int parm), int parm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) void machine__destroy_kernel_maps(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) int machine__create_kernel_maps(struct machine *machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) int machines__create_kernel_maps(struct machines *machines, pid_t pid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) int machines__create_guest_kernel_maps(struct machines *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) void machines__destroy_kernel_maps(struct machines *machines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) typedef int (*machine__dso_t)(struct dso *dso, struct machine *machine, void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) int machine__for_each_dso(struct machine *machine, machine__dso_t fn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 			  void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) int machine__for_each_thread(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 			     int (*fn)(struct thread *thread, void *p),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 			     void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) int machines__for_each_thread(struct machines *machines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 			      int (*fn)(struct thread *thread, void *p),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 			      void *priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) pid_t machine__get_current_tid(struct machine *machine, int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) int machine__set_current_tid(struct machine *machine, int cpu, pid_t pid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 			     pid_t tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * For use with libtraceevent's tep_set_function_resolver()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, char **modp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) void machine__get_kallsyms_filename(struct machine *machine, char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 				    size_t bufsz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) int machine__create_extra_kernel_maps(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 				      struct dso *kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) /* Kernel-space maps for symbols that are outside the main kernel map and module maps */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) struct extra_kernel_map {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	u64 start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	u64 end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	u64 pgoff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	char name[KMAP_NAME_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) int machine__create_extra_kernel_map(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 				     struct dso *kernel,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 				     struct extra_kernel_map *xm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) int machine__map_x86_64_entry_trampolines(struct machine *machine,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 					  struct dso *kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) #endif /* __PERF_MACHINE_H */