init.qti.kernel.early_debug-pineapple.sh 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #=============================================================================
  2. # Copyright (c) 2022-2023 Qualcomm Technologies, Inc.
  3. # All Rights Reserved.
  4. # Confidential and Proprietary - Qualcomm Technologies, Inc.
  5. #
  6. # Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
  7. #
  8. # Redistribution and use in source and binary forms, with or without
  9. # modification, are permitted provided that the following conditions are met:
  10. # * Redistributions of source code must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. # * Redistributions in binary form must reproduce the above copyright
  13. # notice, this list of conditions and the following disclaimer in the
  14. # documentation and/or other materials provided with the distribution.
  15. # * Neither the name of The Linux Foundation nor
  16. # the names of its contributors may be used to endorse or promote
  17. # products derived from this software without specific prior written
  18. # permission.
  19. #
  20. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. # IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. # NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  24. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  25. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  26. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  27. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  29. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  30. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. #=============================================================================
  32. enable_sched_events()
  33. {
  34. local instance=/sys/kernel/tracing
  35. echo > $instance/trace
  36. echo > $instance/set_event
  37. # timer
  38. echo 1 > $instance/events/timer/timer_expire_entry/enable
  39. echo 1 > $instance/events/timer/timer_expire_exit/enable
  40. echo 1 > $instance/events/timer/hrtimer_cancel/enable
  41. echo 1 > $instance/events/timer/hrtimer_expire_entry/enable
  42. echo 1 > $instance/events/timer/hrtimer_expire_exit/enable
  43. echo 1 > $instance/events/timer/hrtimer_init/enable
  44. echo 1 > $instance/events/timer/hrtimer_start/enable
  45. #enble FTRACE for softirq events
  46. echo 1 > $instance/events/irq/enable
  47. #enble FTRACE for Workqueue events
  48. echo 1 > $instance/events/workqueue/enable
  49. # sched
  50. #echo 1 > $instance/events/sched/sched_cpu_hotplug/enable
  51. echo 1 > $instance/events/sched/sched_migrate_task/enable
  52. echo 1 > $instance/events/sched/sched_pi_setprio/enable
  53. echo 1 > $instance/events/sched/sched_switch/enable
  54. echo 1 > $instance/events/sched/sched_wakeup/enable
  55. echo 1 > $instance/events/sched/sched_wakeup_new/enable
  56. echo 1 > $instance/events/schedwalt/halt_cpus/enable
  57. echo 1 > $instance/events/schedwalt/halt_cpus_start/enable
  58. # hot-plug
  59. echo 1 > $instance/events/cpuhp/enable
  60. echo 1 > $instance/events/power/cpu_frequency/enable
  61. echo 1 > $instance/tracing_on
  62. }
  63. enable_rproc_events()
  64. {
  65. local instance=/sys/kernel/tracing/instances/rproc_qcom
  66. mkdir $instance
  67. echo > $instance/trace
  68. echo > $instance/set_event
  69. # enable rproc events as soon as available
  70. /vendor/bin/init.qti.write.sh $instance/events/rproc_qcom/enable 1
  71. echo 1 > $instance/tracing_on
  72. }
  73. # Suspend events are also noisy when going into suspend/resume
  74. enable_suspend_events()
  75. {
  76. local instance=/sys/kernel/tracing/instances/suspend
  77. mkdir $instance
  78. echo > $instance/trace
  79. echo > $instance/set_event
  80. echo 1 > $instance/events/power/suspend_resume/enable
  81. echo 1 > $instance/events/power/device_pm_callback_start/enable
  82. echo 1 > $instance/events/power/device_pm_callback_end/enable
  83. echo 1 > $instance/tracing_on
  84. }
  85. enable_clock_reg_events()
  86. {
  87. local instance=/sys/kernel/tracing/instances/clock_reg
  88. mkdir $instance
  89. echo > $instance/trace
  90. echo > $instance/set_event
  91. # clock
  92. echo 1 > $instance/events/clk/enable
  93. echo 1 > $instance/events/clk_qcom/enable
  94. # interconnect
  95. echo 1 > $instance/events/interconnect/enable
  96. # regulator
  97. echo 1 > $instance/events/regulator/enable
  98. # rpmh
  99. echo 1 > $instance/events/rpmh/enable
  100. echo 1 > $instance/tracing_on
  101. }
  102. enable_memory_events()
  103. {
  104. local instance=/sys/kernel/tracing/instances/memory
  105. mkdir $instance
  106. echo > $instance/trace
  107. echo > $instance/set_event
  108. #memory pressure events/oom
  109. #echo 1 > $instance/events/psi/psi_event/enable
  110. #echo 1 > $instance/events/psi/psi_window_vmstat/enable
  111. echo 1 > $instance/events/arm_smmu/enable
  112. echo 1 > $instance/tracing_on
  113. }
  114. # binder tracing can be noisy
  115. enable_binder_events()
  116. {
  117. local instance=/sys/kernel/tracing/instances/binder
  118. mkdir $instance
  119. echo > $instance/trace
  120. echo > $instance/set_event
  121. echo 1 > $instance/events/binder/enable
  122. echo 1 > $instance/tracing_on
  123. }
  124. enable_rwmmio_events()
  125. {
  126. if [ ! -d /sys/kernel/tracing/events/rwmmio ]
  127. then
  128. return
  129. fi
  130. local instance=/sys/kernel/tracing/instances/rwmmio
  131. mkdir $instance
  132. echo > $instance/trace
  133. echo > $instance/set_event
  134. echo 1 > $instance/events/rwmmio/rwmmio_read/enable
  135. echo 1 > $instance/events/rwmmio/rwmmio_write/enable
  136. echo 1 > $instance/tracing_on
  137. }
  138. find_build_type()
  139. {
  140. linux_banner=`cat /proc/version`
  141. if [[ "$linux_banner" == *"-consolidate"* ]]
  142. then
  143. debug_build=true
  144. fi
  145. }
  146. debug_build=false
  147. enable_tracing_events()
  148. {
  149. # bail out if its perf config
  150. find_build_type
  151. if [ "$debug_build" = false ]
  152. then
  153. return
  154. fi
  155. # bail out if ftrace events aren't present
  156. if [ ! -d /sys/kernel/tracing/events ] ; then
  157. return
  158. fi
  159. enable_sched_events
  160. enable_rproc_events
  161. enable_suspend_events
  162. enable_binder_events
  163. enable_clock_reg_events
  164. enable_memory_events
  165. enable_rwmmio_events
  166. }
  167. enable_tracing_events