It's not necessary to understand in detail how the kernel function tracer works in order to use it or to do kernel development, but it is a pretty neat piece of code even so.
kernel/trace directory contains general tracing code.
include/linux/ftrace.h header file provides the function tracer interface.
kernel/trace/ftrace.c file implements architecture independent function tracer infrastructure.
arch/arm/kernel/ftrace.c file provides ARM architecture specific
function tracer code.