Skip to content

Commit c3558de

Browse files
committed
Rework PCI emulation to better expose inner data
The previous structure for PCI device emulation made it inconvenient to access the inner data of devices for initialization during setup. This attempts to flatten some of the data model at the cost of more monoporphization.
1 parent bf46fe9 commit c3558de

File tree

26 files changed

+1354
-1300
lines changed

26 files changed

+1354
-1300
lines changed

propolis/src/block/file.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ impl Driver {
105105
})
106106
}
107107
fn blocking_loop(&self, sctx: &mut SyncCtx) {
108+
let mut idled = false;
108109
loop {
109110
if sctx.check_yield() {
110111
break;
@@ -113,14 +114,18 @@ impl Driver {
113114
let mut guard = self.queue.lock().unwrap();
114115
if let Some(req) = guard.pop_front() {
115116
drop(guard);
117+
idled = false;
116118
let ctx = sctx.dispctx();
117119
match process_request(&self.fp, &req, &ctx) {
118120
Ok(_) => req.complete(block::Result::Success, &ctx),
119121
Err(_) => req.complete(block::Result::Failure, &ctx),
120122
}
121123
} else {
122124
// wait until more requests are available
123-
self.idle_threads.add_permits(1);
125+
if !idled {
126+
self.idle_threads.add_permits(1);
127+
idled = true;
128+
}
124129
let _guard = self
125130
.cv
126131
.wait_while(guard, |g| {

0 commit comments

Comments
 (0)