Comments (7)
Me too. my qemu version is
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.17)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
from virtio-drivers.
This issue is a bit magical; after adding #[inline(never)]
to the can_pop
function in VirtQueue
under src/queue.rs
, the test case can running normally. Or here:
while !self.can_pop() {
info!("add_notify_wait_pop: can_pop=false");
spin_loop();
}
By adding an output log statement, it runs normally. I suspect it might be due to a lack of volatile read?
I modified codes in VirtQueue
and other structs, make these variables volatile and the bug solved. I'll PR later.
from virtio-drivers.
I don't think volatile access should be necessary for the used ring (e.g. in VirtQueue::can_pop
), because it is shared memory not MMIO. My guess would be that we're missing a read barrier somewhere, which is allowing the compiler (or possibly the CPU?) to reorder memory access in a way that gives incorrect values.
from virtio-drivers.
I don't think volatile access should be necessary for the used ring (e.g. in
VirtQueue::can_pop
), because it is shared memory not MMIO. My guess would be that we're missing a read barrier somewhere, which is allowing the compiler (or possibly the CPU?) to reorder memory access in a way that gives incorrect values.
Maybe you are right.
Despite the test case of riscv in virtio-drivers can run properly, I have another test case which can not run properly yet.
My test case is in s-mode, sv39, rv64. In my test case the virtio-blk-mmio(legacy) hungs, and virtio-blk-mmio(modern) reports 'not ready' when it read blocks.
But the virtio net driver runs well.(both legacy and modern)
I'll try to investigate what happens.
from virtio-drivers.
After talking to some other people about this, I think the issue is that we should be using atomics for some of these shared memory accesses. I'll send a PR shortly for you to test.
from virtio-drivers.
@fslongjin Can you test if #128 fixes your issues reliably?
from virtio-drivers.
@fslongjin Can you test if #128 fixes your issues reliably?
sure, I'll test it tomorrow morning~
from virtio-drivers.
Related Issues (20)
- Unable to build with feature `tcp` enabled HOT 1
- Virtio GPU: Redrawing with timer interrupt on RISCV HOT 1
- Async support? HOT 1
- The shared buffer address is not in the dma allocation address range. HOT 1
- 2022-08-27最新版本可能存在问题 HOT 1
- how to configure interrupt for virtio-blk / virtio-console on riscv-qemu? HOT 1
- `VirtIOBlk::read_blocks` returns `IoError` if `buf` is >= 2GiB HOT 2
- `VirtioVsockHdr` and `rx_queue_buffers` should be allocated from DMA range. HOT 1
- `write_volatile` on aarch64 may not properly set ESR
- Publish to crates.io HOT 3
- Audit and fix endianness issues
- Expose writability of memory regions to Hal interface HOT 1
- Support VirtIO 1.2 `VIRTIO_F_RING_RESET`
- Some question about virtio-net HOT 1
- Network driver issues on multicore systems HOT 3
- Support memory buffers from noncontagious physical pages
- getting a IoError but no clue what it means or how to fix HOT 11
- is there any means to unload virtio driver? HOT 2
- VirtIOInput stops accepting input after certain number of events HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virtio-drivers.