^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) Subsystem Trace Points: power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) The power tracing system captures events related to power transitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) within the kernel. Broadly speaking there are three major subheadings:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) - Power state switch which reports events related to suspend (S-states),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) cpuidle (C-states) and cpufreq (P-states)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) - System clock related changes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) - Power domains related changes and transitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) This document describes what each of the tracepoints is and why they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) might be useful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) Cf. include/trace/events/power.h for the events definitions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 1. Power state switch events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) ============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 1.1 Trace API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) A 'cpu' event class gathers the CPU-related events: cpuidle and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) cpufreq.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) cpu_idle "state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) cpu_frequency "state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) cpu_frequency_limits "min=%lu max=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) A suspend event is used to indicate the system going in and out of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) suspend mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) machine_suspend "state=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Note: the value of '-1' or '4294967295' for state means an exit from the current state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) i.e. trace_cpu_idle(4, smp_processor_id()) means that the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) enters the idle state 4, while trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) means that the system exits the previous idle state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) The event which has 'state=4294967295' in the trace is very important to the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) space tools which are using it to detect the end of the current state, and so to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) correctly draw the states diagrams and to calculate accurate statistics etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 2. Clocks events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) The clock events are used for clock enable/disable and for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) clock rate change.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) clock_enable "%s state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) clock_disable "%s state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) clock_set_rate "%s state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) The first parameter gives the clock name (e.g. "gpio1_iclk").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) The second parameter is '1' for enable, '0' for disable, the target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) clock rate for set_rate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 3. Power domains events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) The power domain events are used for power domains transitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) power_domain_target "%s state=%lu cpu_id=%lu"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) The first parameter gives the power domain name (e.g. "mpu_pwrdm").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) The second parameter is the power domain target state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 4. PM QoS events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) The PM QoS events are used for QoS add/update/remove request and for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) target/flags update.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) pm_qos_update_target "action=%s prev_value=%d curr_value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) pm_qos_update_flags "action=%s prev_value=0x%x curr_value=0x%x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) The first parameter gives the QoS action name (e.g. "ADD_REQ").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) The second parameter is the previous QoS value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) The third parameter is the current QoS value to update.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) There are also events used for device PM QoS add/update/remove request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) dev_pm_qos_add_request "device=%s type=%s new_value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) dev_pm_qos_update_request "device=%s type=%s new_value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) dev_pm_qos_remove_request "device=%s type=%s new_value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The first parameter gives the device name which tries to add/update/remove
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) QoS requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY").
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) The third parameter is value to be added/updated/removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) And, there are events used for CPU latency QoS add/update/remove request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) pm_qos_add_request "value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) pm_qos_update_request "value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) pm_qos_remove_request "value=%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) The parameter is the value to be added/updated/removed.