I use a Measurement Computing DAQ in Ubuntu to perform continuous analog reads and writes from another system connected to the board. I have been using Ubuntu 16.04 (which went up to Linux kernel 4.15) for about five years now. I was recently exploring upgrading the system to Ubuntu 20.04 - 22.04 and each of those operating systems ships with Linux kernel 5.10 - 5.15. I am noticing that I am getting what appears to be periodic interrupts that are quite drastic (about 50 milliseconds) for every kernel 5.10 or higher. So something appears to have changed from the 5.9 kernel to the 5.10 kernel that is affecting system read() and write() calls with the A/D board. The differences can be seen in my data acquisition software:
And also in an average loop time program I have (that loops through successive read and write calls - along with some math in between):
Note how the maximum times I am seeing go from about 43 microseconds for Linux kernel 5.9 and below to 50 milliseconds for Linux kernel 5.10 and above. I obviously would like to fix this problem, but I am not sure what was changed that could have caused it. Does anyone have any idea what the culprit is, and if it could be fixed by perhaps changing a kernel parameter in the GRUB bootloader? Any pointers at all would certainly be appreciated. Thanks!
EDIT:
I have implemented a minimal example where we continuously call write system commands to update the DAC Outputs.
At minimum, the DAC Write command is calling "get_user" to obtain data from user-space to kernel, and calling "outw" to write the data into the DAC Register.
Now when we are executing the minimal example, we're doing back-to-back write system commands and we're noticing this 50 millisecond delay.
However, when we add a 1 microsecond delay between the write system commands, then the 50 millisecond delay vanishes. Is this possibly an issue with trying to access the user-space information or writing from the kernel to the device too quickly?
Is there a way to analyze what the kernel is doing between accessing user-space and writing data from the kernel to device?
git bisect
to the rescue. There are thousands of changes, no one has any clue what exactly affects you, not even kernel developers.git bisect
to fully figure out, kernelnewbies.org maintains "human-readable kernel changelogs" for each Linus's kernel release.. In this case, the page for the kernel version 5.10 might be useful for an overview. On the other hand, the pci-das1602-16 driver seems to have had essentially no changes since November 2016 at least, and the newest kernel mentioned in its README is 3.10.11, so that driver might not exactly be up to the latest kernel coding practices.