my team is writing software interacting with a Linux kernel module. We write to sysfs to manage the module. Recently, we've been battling a problem in which the module occasionally does not behave as expected.
One of my colleagues noticed that if we put a sleep
between
subsequent writes to sysfs, the problem does not occur. This probably means that after the first write the module needs some time to do some additional processing, and our code should wait until it's done before performing the second write.
I really don't want to put a random sleep
in the code. However, we have virtually no experience with kernel space. Is there a way to detect that the kernel module is busy doing the additional processing? To track activity of the module? Especially a programmatic way, that we could use instead of sleep
-ing some predefined interval?
Unfortunately, my NDA prevents me from going into details about which module and which sysfs files we interact with.