kernellinux-device-driversoftirq

Is there a way to debug softirq?


my purpose :

log debug info(ratio , address, else)of softirq generation in specific situation. any information can be helpful.

I suppose some suspicious device driver but has no clue which generated heavy load.

I'll thanks for any recommend like "read this manual".


Solution

  • Is there a way to debug softirq?

    Probably yes, since the Linux kernel is open source. Actually, it is even free software.

    So you could download its source code (at end of 2020, Linux 5.10), and study it, and improve it.

    You might read more about syscalls(2) (including bpf(2) & poll(2) & socket(2)) then use strace(1) or dmesg(1) or perf(1) or gprof(1). See also socket(7) with netlink(7) and libnetlink(7)

    You technically could write your own GCC plugin to compile your Linux kernel, so that your GCC compiler automatically improves your Linux kernel (e.g. by automatically "adding" appropriate instrumentation code).

    You might also write your Linux kernel module.

    In a few months (perhaps February 2021) you might use Bismon for such a purpose (static analysis of the source code of your kernel, or module). Consider also using Frama-C or Clang static analyzer.

    Be aware of Rice's theorem and afraid of Heisenbugs.

    For the kernel side, ask also on kernelnewbies.

    My recommendation would be to minimize kernel changes, and if possible and permitted, code more application code (maybe related to systemd(1), which I don't understand much) and less kernel code.