Skip to content

Replace signal-based Virtio event notification with eventfd #64

@agicy

Description

@agicy

Background & Problem

Currently, hvisor uses a custom signal (SIGHVI) to notify user space about Virtio interrupts. This approach suffers from high kernel overhead due to context switching, limited scalability, and poor compatibility with modern asynchronous I/O models.

Proposed Solution

Replace the signal mechanism with eventfd. This provides a lightweight, file-descriptor-based notification interface.
Crucially, this change is a prerequisite for future integration with io_uring, which will allow for high-performance asynchronous I/O.

Implementation Details

Kernel Space (driver/hvisor.c):

  • Remove SIGHVI generation and task tracking.
  • Implement eventfd context management.
  • Modify virtio_irq_handler to write to the eventfd counter instead of sending signals.
  • Update ioctl to initialize and bind eventfd for user processes.

User Space (tools/virtio.c):

  • Remove sigwait and signal handling logic.
  • Obtain the eventfd via ioctl.
  • Update the main loop to wait on the eventfd (currently via blocking read, preparing the logic for future io_uring submission).
  • Process Virtio queues upon eventfd readability.

Expected Outcomes

  • Performance: Reduced notification latency and system overhead.
  • Architecture: Decoupled signal logic from driver code.
  • Future-proofing: Ready for seamless migration to io_uring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions