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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) The contents of this directory allow users to specify PMU events in their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) CPUs by their symbolic names rather than raw event codes (see example below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) The main program in this directory, is the 'jevents', which is built and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) executed _BEFORE_ the perf binary itself is built.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) The 'jevents' program tries to locate and process JSON files in the directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) tree tools/perf/pmu-events/arch/foo.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 	- Regular files with '.json' extension in the name are assumed to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	  JSON files, each of which describes a set of PMU events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	- The CSV file that maps a specific CPU to its set of PMU events is to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	  be named 'mapfile.csv' (see below for mapfile format).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	- Directories are traversed, but all other files are ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	- To reduce JSON event duplication per architecture, platform JSONs may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	  use "ArchStdEvent" keyword to dereference an "Architecture standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	  events", defined in architecture standard JSONs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	  Architecture standard JSONs must be located in the architecture root
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	  folder. Matching is based on the "EventName" field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) The PMU events supported by a CPU model are expected to grouped into topics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) such as Pipelining, Cache, Memory, Floating-point etc. All events for a topic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) should be placed in a separate JSON file - where the file name identifies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) the topic. Eg: "Floating-point.json".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) All the topic JSON files for a CPU model/family should be in a separate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) sub directory. Thus for the Silvermont X86 CPU:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	$ ls tools/perf/pmu-events/arch/x86/silvermont
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	cache.json     memory.json    virtual-memory.json
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	frontend.json  pipeline.json
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) The JSONs folder for a CPU model/family may be placed in the root arch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) folder, or may be placed in a vendor sub-folder under the arch folder
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) for instances where the arch and vendor are not the same.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) Using the JSON files and the mapfile, 'jevents' generates the C source file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 'pmu-events.c', which encodes the two sets of tables:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	- Set of 'PMU events tables' for all known CPUs in the architecture,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	  (one table like the following, per JSON file; table name 'pme_power8'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	  is derived from JSON file name, 'power8.json').
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		struct pmu_event pme_power8[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 			...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 				.name = "pm_1plus_ppc_cmpl",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 				.event = "event=0x100f2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 				.desc = "1 or more ppc insts finished,",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 			...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	- A 'mapping table' that maps each CPU of the architecture, to its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	  'PMU events table'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		struct pmu_events_map pmu_events_map[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			.cpuid = "004b0000",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 			.version = "1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			.type = "core",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 			.table = pme_power8
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) After the 'pmu-events.c' is generated, it is compiled and the resulting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 'pmu-events.o' is added to 'libperf.a' which is then used to build perf.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) NOTES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	1. Several CPUs can support same set of events and hence use a common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	   JSON file. Hence several entries in the pmu_events_map[] could map
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	   to a single 'PMU events table'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	2. The 'pmu-events.h' has an extern declaration for the mapping table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	   and the generated 'pmu-events.c' defines this table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	3. _All_ known CPU tables for architecture are included in the perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	   binary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) At run time, perf determines the actual CPU it is running on, finds the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) matching events table and builds aliases for those events. This allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) users to specify events by their name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	$ perf stat -e pm_1plus_ppc_cmpl sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) where 'pm_1plus_ppc_cmpl' is a Power8 PMU event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) However some errors in processing may cause the alias build to fail.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) Mapfile format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) The mapfile enables multiple CPU models to share a single set of PMU events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) It is required even if such mapping is 1:1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) The mapfile.csv format is expected to be:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	Header line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	CPUID,Version,Dir/path/name,Type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) where:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	Comma:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		is the required field delimiter (i.e other fields cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		have commas within them).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		Lines in which the first character is either '\n' or '#'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		are ignored.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	Header line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		The header line is the first line in the file, which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		always _IGNORED_. It can be empty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	CPUID:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		CPUID is an arch-specific char string, that can be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		to identify CPU (and associate it with a set of PMU events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		it supports). Multiple CPUIDS can point to the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		File/path/name.json.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			CPUID == 'GenuineIntel-6-2E' (on x86).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 			CPUID == '004b0100' (PVR value in Powerpc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	Version:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		is the Version of the mapfile.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	Dir/path/name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		is the pathname to the directory containing the CPU's JSON
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		files, relative to the directory containing the mapfile.csv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	Type:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 		indicates whether the events are "core" or "uncore" events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	Eg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	$ grep silvermont tools/perf/pmu-events/arch/x86/mapfile.csv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	GenuineIntel-6-37,v13,silvermont,core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	GenuineIntel-6-4D,v13,silvermont,core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	GenuineIntel-6-4C,v13,silvermont,core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	i.e the three CPU models use the JSON files (i.e PMU events) listed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	in the directory 'tools/perf/pmu-events/arch/x86/silvermont'.