-
Notifications
You must be signed in to change notification settings - Fork 1
Development #110
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
Development #110
Conversation
Caution Review failedThe pull request is closed. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (4)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (3)
drivers/virtio/VirtioBlk.c (3)
299-312
: Make write buffer const in implementation to match the headerKeep signatures consistent and protect writes.
Apply:
-int VirtioBlkWrite(uint64_t sector, void* buffer) { +int VirtioBlkWrite(uint64_t sector, const void* buffer) { ... - vq_desc_table[head_idx + 1].addr = VIRT_TO_PHYS((uint64_t)buffer); + vq_desc_table[head_idx + 1].addr = VIRT_TO_PHYS((uint64_t)buffer);
221-229
: VMemAlloc per-request is heavyweight; consider a small object cacheAllocating and mapping full pages for tiny structs/status bytes per I/O is costly and increases TLB pressure. Use a slab/pool or pre-allocated per-request structures.
I can sketch a fixed-size pool (power-of-two) with a free list and no locks under virtio_lock if helpful.
Also applies to: 289-297
24-24
: Wrap-around handling for last_used_idxKeep last_used_idx as uint16_t (good). When comparing to vq_used_ring->idx, the loop is fine, but ensure producers can’t starve consumers. Consider reading used->idx once per outer iteration to reduce live racing.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
drivers/virtio/VirtioBlk.c
(3 hunks)drivers/virtio/VirtioBlk.h
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
drivers/virtio/VirtioBlk.h (1)
drivers/virtio/VirtioBlk.c (1)
VirtioBlkWrite
(280-346)
drivers/virtio/VirtioBlk.c (4)
kernel/etc/Console.c (1)
PrintKernel
(181-199)kernel/atomic/Spinlock.h (2)
SpinLock
(26-60)SpinUnlock
(120-122)mm/VMem.c (2)
VMemAlloc
(243-309)VMemFree
(311-375)kernel/atomic/Atomics.c (1)
AtomicInc
(6-8)
🔇 Additional comments (2)
drivers/virtio/VirtioBlk.c (2)
8-8
: Including Virtio.h here is correctLocalizing the dependency to the implementation file is the right call.
171-175
: Sanity-check queue_size vs descriptor allocationsAfter reading queue_size, consider validating it’s divisible by 3 if you only support fixed 3-desc chains, or implement wrap-aware chaining across the ring boundary to avoid unusable tail fragments.
I can provide a trivial boundary-crossing chain builder (idx, (idx+1)%vq_size, (idx+2)%vq_size) if you want to keep the simple allocator.
Also applies to: 177-193
virtio driver read/write
Summary by CodeRabbit
New Features
Documentation
Chores