rcore-os / rCore-Tutorial-Book-v3

A book about how to write OS kernels in Rust easily.
https://rcore-os.github.io/rCore-Tutorial-Book-v3/
GNU General Public License v3.0
1.13k stars 206 forks source link

idx should always increase #206

Open PorterLu opened 2 months ago

PorterLu commented 2 months ago

Hi,

"idx总是递增的, 并且到达qsz后又回到0"

Problem:

I've discovered that the 'idx' variable may need to increment continuously and fetch the descriptor after applying the modulus operator. This necessity arises because my custom frontend driver operates optimally only when 'avail.idx' increases without wrapping around. Similarly, the backend utilizes 'used.idx,' which also increases without wrapping.

Proof

I'm employing the virtio non-legacy mode along with vrtio-blk to write 4096 blocks. Interestingly, I've observed that the frontend driver performs effectively when 'idx' doesn't wrap around.