To print the stack contents and a backtrace to the kernel log, use the
dump_stack()
function in your kernel module. It's declared in
linux/kernel.h
in the include folder in the kernel source directory.