michaelmelanson / michaelmelanson/panda-os

Block I/O: Scatter-gather support for virtio requests

Open
#36 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

drivers enhancement performance
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Summary

Implement scatter-gather support in the virtio block driver to submit multiple non-contiguous sectors in a single virtio request, improving throughput for fragmented I/O patterns.

Current state

  • The virtio block driver (panda-kernel/src/drivers/virtio_block/) supports async I/O with interrupt-driven completion
  • Each request currently transfers a single contiguous range of sectors
  • Multiple small reads (e.g., from ext2 indirect block lookups) each require a separate virtio request

Desired behaviour

  • A single virtio block request can reference multiple non-contiguous (physical) memory buffers
  • The virtio descriptor chain uses indirect descriptors or chained descriptors to express scatter-gather lists
  • The ext2 driver and VFS layer can submit batched read requests
  • Fewer virtio queue submissions for the same amount of data

Key files

  • panda-kernel/src/drivers/virtio_block/ — virtio block driver
  • panda-kernel/src/drivers/virtio/ — virtio queue infrastructure (descriptor chains)
  • panda-kernel/src/vfs/ext2/ — ext2 filesystem driver (primary consumer)

Implementation notes

  • Virtio spec supports scatter-gather natively via descriptor chains
  • Each descriptor in the chain points to a (physical address, length) pair
  • The block device header and status byte are separate descriptors; data descriptors go in between
  • Need to handle the case where physical pages are not contiguous even if virtual pages are

Testing

  • Kernel test: read multiple non-contiguous sectors in one request, verify data correctness
  • Performance test: compare sequential read throughput before and after (measure with OP_ENVIRONMENT_TIME once available)
  • Verify ext2 multi-block reads work correctly with scatter-gather

Documentation

  • Document the scatter-gather API in the block driver
  • Add comments explaining the descriptor chain layout for scatter-gather requests

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the virtio block driver in panda-kernel/src/drivers/virtio_block/ and the descriptor-chain infrastructure in panda-kernel/src/drivers/virtio/. Then inspect the ext2 consumer in panda-kernel/src/vfs/ext2/ and the existing async request path. Done means non-contiguous buffers can be submitted in one request, ext2 multi-block reads remain correct, and the requested kernel and performance tests are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.