android_kernel_xiaomi_sm8350/kernel/trace/Makefile
Pavankumar Kondeti 1f833081fb sched/tracing: GKI friendly long preempt/irq disable traces
Hook into preemptirq trace points and print the call stacks of
scenarios where preemption/irqs is disabled for more than
a use configured threshold. The threshold tunables are available
under /proc/sys/preemptirq directory. All the units are in nano seconds.

The following commands can be used to enable the trace. The stacktrace
trigger prints the stacktrace when the trace event is printed.

echo 1 > /d/tracing/events/preemptirq_long/enable
echo stacktrace > /d/tracing/events/preemptirq_long/preempt_disable_long/trigger
echo stacktrace > /d/tracing/events/preemptirq_long/irq_disable_long/trigger

Sample output is copied below. Note that this format works with both systrace
and commandline ftrace utilities.

   init-1     [005] d..2   187.905211: irq_disable_long: delta=15244480(ns)
   init-1     [005] d..3   187.905216: <stack trace>

 => test_irq_disable_long
 => trace_irq_enable_rcuidle
 => trace_hardirqs_on
 => console_unlock
 => vprintk_emit
 => devkmsg_emit
 => devkmsg_write
 => do_iter_readv_writev
 => do_iter_write
 => do_writev
 => __arm64_sys_writev
 => el0_svc_common
 => el0_svc_handler
 => el0_svc

   kworker/u16:4-419   [000] .N.2   187.905221: preempt_disable_long: delta=4923646(ns)
   kworker/u16:4-419   [000] .N.3   187.905226: <stack trace>
 => test_preempt_disable_long
 => trace_preempt_enable_rcuidle
 => trace_preempt_on
 => preempt_count_sub
 => perf_event_read
 => __perf_event_read_value
 => perf_event_read_value
 => memlat_monitor_work
 => process_one_work
 => worker_thread
 => kthread
 => ret_from_fork

Change-Id: If87a8d65359632b93da10b691e9b83e37000aeb3
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-07-24 12:40:43 +05:30

96 lines
3.1 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Do not instrument the tracer itself:
ifdef CONFIG_FUNCTION_TRACER
ORIG_CFLAGS := $(KBUILD_CFLAGS)
KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS))
ifdef CONFIG_FTRACE_SELFTEST
# selftest needs instrumentation
CFLAGS_trace_selftest_dynamic.o = $(CC_FLAGS_FTRACE)
obj-y += trace_selftest_dynamic.o
endif
endif
ifdef CONFIG_FTRACE_STARTUP_TEST
CFLAGS_trace_kprobe_selftest.o = $(CC_FLAGS_FTRACE)
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe_selftest.o
endif
# If unlikely tracing is enabled, do not trace these files
ifdef CONFIG_TRACING_BRANCHES
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
endif
# for GCOV coverage profiling
ifdef CONFIG_GCOV_PROFILE_FTRACE
GCOV_PROFILE := y
endif
CFLAGS_trace_benchmark.o := -I$(src)
CFLAGS_trace_events_filter.o := -I$(src)
obj-$(CONFIG_TRACE_CLOCK) += trace_clock.o
obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o
obj-$(CONFIG_RING_BUFFER) += ring_buffer.o
obj-$(CONFIG_RING_BUFFER_BENCHMARK) += ring_buffer_benchmark.o
obj-$(CONFIG_TRACING) += trace.o
obj-$(CONFIG_TRACING) += trace_output.o
obj-$(CONFIG_TRACING) += trace_seq.o
obj-$(CONFIG_TRACING) += trace_stat.o
obj-$(CONFIG_TRACING) += trace_printk.o
obj-$(CONFIG_TRACING_MAP) += tracing_map.o
obj-$(CONFIG_PREEMPTIRQ_DELAY_TEST) += preemptirq_delay_test.o
obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
obj-$(CONFIG_PREEMPTIRQ_TRACEPOINTS) += trace_preemptirq.o
obj-$(CONFIG_IRQSOFF_TRACER) += trace_irqsoff.o
obj-$(CONFIG_PREEMPT_TRACER) += trace_irqsoff.o
obj-$(CONFIG_SCHED_TRACER) += trace_sched_wakeup.o
obj-$(CONFIG_HWLAT_TRACER) += trace_hwlat.o
obj-$(CONFIG_NOP_TRACER) += trace_nop.o
obj-$(CONFIG_STACK_TRACER) += trace_stack.o
obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o
obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o
obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += fgraph.o
ifeq ($(CONFIG_BLOCK),y)
obj-$(CONFIG_EVENT_TRACING) += blktrace.o
endif
obj-$(CONFIG_EVENT_TRACING) += trace_events.o
obj-$(CONFIG_EVENT_TRACING) += trace_export.o
obj-$(CONFIG_FTRACE_SYSCALLS) += trace_syscalls.o
ifeq ($(CONFIG_PERF_EVENTS),y)
obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
endif
obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
obj-$(CONFIG_EVENT_TRACING) += trace_events_trigger.o
obj-$(CONFIG_HIST_TRIGGERS) += trace_events_hist.o
obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o
obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o
obj-$(CONFIG_TRACEPOINTS) += power-traces.o
ifeq ($(CONFIG_PM),y)
obj-$(CONFIG_TRACEPOINTS) += rpm-traces.o
endif
ifeq ($(CONFIG_TRACING),y)
obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
endif
obj-$(CONFIG_DYNAMIC_EVENTS) += trace_dynevent.o
obj-$(CONFIG_PROBE_EVENTS) += trace_probe.o
obj-$(CONFIG_UPROBE_EVENTS) += trace_uprobe.o
obj-$(CONFIG_QCOM_RTB) += msm_rtb.o
obj-$(CONFIG_TRACEPOINT_BENCHMARK) += trace_benchmark.o
obj-$(CONFIG_IPC_LOGGING) += ipc_logging.o
ifdef CONFIG_DEBUG_FS
obj-$(CONFIG_IPC_LOGGING) += ipc_logging_debug.o
endif
libftrace-y := ftrace.o
obj-$(CONFIG_PREEMPTIRQ_TRACEPOINTS) += preemptirq_long.o