Skip to content

fix(loongarch64): Fix Virtio using too much CPU - #118

Merged
li041 merged 3 commits into
syswonder:mainfrom
weifenjihe:fix
Aug 21, 2026
Merged

li041 merged 3 commits into
syswonder:mainfrom
weifenjihe:fix

Conversation

@weifenjihe

Copy link
Copy Markdown
Contributor

Summary

Fix excessive hvisor-virtio CPU usage on LoongArch64.

  • Enable epoll_wait() instead of continuous polling.
  • Wake userspace through eventfd.
  • Acknowledge IRQ 4 (HWI2) after each wakeup.

Tested by building hvisor-tool and hvisor.ko for LoongArch64.

@li041
li041 self-requested a review August 20, 2026 09:42
@li041 li041 changed the title fix(loongarch64):Fix Virtio using too much CPU fix(loongarch64): Fix Virtio using too much CPU Aug 20, 2026
Comment thread tools/virtio/virtio.c
@weifenjihe
weifenjihe requested a review from li041 August 21, 2026 02:13
@li041

li041 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution. This update unifies the LoongArch64 request-handling path with the other architectures: it moves LoongArch64 from the previous polling loop to the modern epoll_wait() event-driven interface, and drains pending requests before entering the wait. This reduces unnecessary CPU usage and keeps the backend behavior more consistent across architectures.

One small follow-up: the current CI code style check is failing on the changed code. Please run clang-format (version 14 used by CI) on driver/hvisor_main.c, include/hvisor.h, and tools/virtio/virtio.c before merging.

Thanks again for the contribution!

@li041 li041 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@li041
li041 merged commit c724e91 into syswonder:main Aug 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants