Have you looked into using eBPF instead of writing a kernel module?
http://ebpf.io for some more insights.
At the very least, it'll provide some useful tooling for you to debug problems in kernel-space.
http://ebpf.io for some more insights.
At the very least, it'll provide some useful tooling for you to debug problems in kernel-space.
Check out https://github.com/iovisor/bpftrace and the example tools/ for a taste. You'll likely want to play with kprobes/kretprobes.
https://github.com/iovisor/bpftrace
I would also strongly recommend Brendan Greggs book: http://www.brendangregg.com/bpf-performance-tools-book.html