Fix virtio kernel panic after processing 100 thousands outputs #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fix for issue #300 .
The bug occurred where the VirtIO device was generating unnecessary interrupt requests (IRQs) after consuming guest-supplied buffers. The kernel normally ignores these unhandled IRQs silently. However, the kernel maintains a counter of ignored IRQs, and when this counter exceeds 100000, it incorrectly assumes the driver is malfunctioning and triggers a kernel panic. This behavior is only visible when the kernel is compiled with debug information, which produces the message "virtqueue interrupt with no work for."
The root cause was the VirtIO device sending superfluous IRQs that the kernel driver didn't need. The solution was straightforward: modify the VirtIO device to stop generating IRQs when processing buffers sent by the kernel driver. So in short terms, we only need to trigger IRQs for inputs coming from the host, and never trigger IRQs to notify that an input coming from the guest was processed.