It's not necessary to understand how the kernel function tracer works in order to use it or do kernel development, but it is a pretty neat piece of code.
/kernel/trace/ - Directory containing general tracing code.
/include/linux/ftrace.h - Function tracer header.
/kernel/trace/ftrace.c - Function tracer infrastructure.
/arch/arm/kernel/ftrace.c - ARM architecture specific function tracer code.