Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix virtio kernel panic after processing 100 thousands outputs #301

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

edubart
Copy link
Contributor

@edubart edubart commented Dec 28, 2024

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.

@edubart edubart added the bug Something isn't working label Dec 28, 2024
@edubart edubart self-assigned this Dec 28, 2024
@edubart edubart linked an issue Dec 28, 2024 that may be closed by this pull request
@edubart edubart requested a review from diegonehab January 3, 2025 17:17
@edubart edubart added this to the v0.19.0 milestone Jan 3, 2025
@edubart edubart force-pushed the fix/virtio-stdout-panic branch from 087e6d4 to 46b11f2 Compare January 9, 2025 17:10
@edubart edubart merged commit 46b11f2 into main Jan 9, 2025
8 checks passed
@edubart edubart deleted the fix/virtio-stdout-panic branch January 9, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

bug: kernel panic when running long loop with VirtIO console
2 participants