Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6bfbb42
nvme: keep IO queue sizes as u32's
luqmana Oct 5, 2021
6ef32cc
nvme: Skip Mutex on NVMe queues and use atomics for head/tail pointers.
luqmana Oct 5, 2021
e45d123
nvme: keep Arc ref to corresponding cq from each sq
luqmana Oct 5, 2021
85000ee
nvme: factor out submitting completions
luqmana Oct 5, 2021
bc1d40c
nvme: clean up bit twiddling for managing queue state by using bitstr…
luqmana Oct 5, 2021
5f86538
nvme: only allowing writing to completion queue if you have a permit
luqmana Oct 5, 2021
0350efb
nvme: create proper error type instead of &'static str
luqmana Oct 5, 2021
234d562
nvme: kick SQ's on CQ doorbell if we previously didn't have a permit …
luqmana Oct 5, 2021
8a2bbff
nvme: refactor cq push method and add comment for unwrap.
luqmana Oct 5, 2021
655c0a6
remove extraneous comment
luqmana Oct 6, 2021
b475e63
nvme: reduce pub methods on queues.
luqmana Oct 6, 2021
c3c4d78
nvme: remove multi-namespace support for now and expose a single name…
luqmana Oct 7, 2021
a7a5d65
nvme: hook up nvme device to pass IO requests to block dev
luqmana Oct 7, 2021
5d29a44
nvme: poke block dev on appropriate doorbell events
luqmana Oct 7, 2021
aa29549
nvme: re-enable nvme devices for propolis-standalone
luqmana Oct 7, 2021
7288b5f
nvme: re-enable usdt probes
luqmana Oct 7, 2021
350435b
nvme: complete malformed command with error instead of panic-ing
luqmana Oct 7, 2021
1a56bd8
block: pass Operation to IO completion callbacks.
luqmana Oct 11, 2021
9b0d5a8
nvme: try to continue popping requests off the same SQ in case we imm…
luqmana Oct 11, 2021
a00f12d
nvme: fold atomic kick flag into existing atomic queue state.
luqmana Oct 11, 2021
e7f0eef
nvme: add tests to exercise the completion/submission queues.
luqmana Oct 12, 2021
1af299a
Don't expose dispatcher guts and just use with_ctx method.
luqmana Oct 12, 2021
5ac5228
nvme: switch back to mutex for queue state to simplify
luqmana Oct 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion propolis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ tokio = { version = "1", features = ["full"] }
futures = "0.3"

[dev-dependencies]
tempfile = "3.2"
crossbeam-channel = "0.5"
rand = "0.8"
tempfile = "3.2"
5 changes: 3 additions & 2 deletions propolis/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ pub enum Result {
Unsupported,
}

pub type CompleteFn = dyn FnOnce(Result, &DispCtx) + Send + Sync + 'static;
pub type CompleteFn =
dyn FnOnce(Operation, Result, &DispCtx) + Send + Sync + 'static;

/// Block device operation request
pub struct Request {
Expand Down Expand Up @@ -100,7 +101,7 @@ impl Request {
/// Indiciate disposition of completed request
pub fn complete(mut self, res: Result, ctx: &DispCtx) {
let func = self.donef.take().unwrap();
func(res, ctx);
func(self.op, res, ctx);
}
}
impl Drop for Request {
Expand Down
3 changes: 1 addition & 2 deletions propolis/src/hw/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod chipset;
pub mod ibmpc;
// XXX: skip nvme for now
//pub mod nvme;
pub mod nvme;
pub mod pci;
pub mod ps2ctrl;
pub mod qemu;
Expand Down
16 changes: 6 additions & 10 deletions propolis/src/hw/nvme/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl NvmeCtrl {
cmd.qid,
cmd.intr_vector,
GuestAddr(cmd.prp),
cmd.qsize as u32,
cmd.qsize,
ctx,
) {
Ok(_) => cmds::Completion::success(),
Expand Down Expand Up @@ -67,7 +67,7 @@ impl NvmeCtrl {
cmd.qid,
cmd.cqid,
GuestAddr(cmd.prp),
cmd.qsize as u32,
cmd.qsize,
ctx,
) {
Ok(_) => cmds::Completion::success(),
Expand Down Expand Up @@ -117,18 +117,14 @@ impl NvmeCtrl {
) -> cmds::Completion {
match cmd.cns {
IDENT_CNS_NAMESPACE => match cmd.nsid {
n if n > 0 && n <= super::ns::MAX_NUM_NAMESPACES as u32 => {
1 => {
assert!(size_of::<bits::IdentifyNamespace>() <= PAGE_SIZE);
let buf = cmd
.data(ctx.mctx.memctx())
.next()
.expect("missing prp entry for ident response");
if let Ok(ns) = self.get_ns(n) {
assert!(ctx.mctx.memctx().write(buf.0, &ns.ident));
cmds::Completion::success()
} else {
cmds::Completion::generic_err(STS_INVALID_NS)
}
assert!(ctx.mctx.memctx().write(buf.0, &self.ns_ident));
cmds::Completion::success()
}
// 0 is not a valid NSID (See NVMe 1.0e, Section 6.1 Namespaces)
// We also don't currently support namespace management
Expand All @@ -143,7 +139,7 @@ impl NvmeCtrl {
.data(ctx.mctx.memctx())
.next()
.expect("missing prp entry for ident response");
assert!(ctx.mctx.memctx().write(buf.0, &self.ident));
assert!(ctx.mctx.memctx().write(buf.0, &self.ctrl_ident));
cmds::Completion::success()
}
// We currently present NVMe version 1.0 in which CNS is a 1-bit field
Expand Down
10 changes: 6 additions & 4 deletions propolis/src/hw/nvme/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl AdminCmd {
};
AdminCmd::CreateIOSubQ(CreateIOSQCmd {
prp: raw.prp1,
qsize: (raw.cdw10 >> 16) as u16 + 1, // Convert from 0's based
qsize: (raw.cdw10 >> 16) + 1, // Convert from 0's based
qid: raw.cdw10 as u16,
cqid: (raw.cdw11 >> 16) as u16,
queue_prio,
Expand All @@ -84,7 +84,7 @@ impl AdminCmd {
bits::ADMIN_OPC_CREATE_IO_CQ => {
AdminCmd::CreateIOCompQ(CreateIOCQCmd {
prp: raw.prp1,
qsize: (raw.cdw10 >> 16) as u16 + 1, // Convert from 0's based
qsize: (raw.cdw10 >> 16) + 1, // Convert from 0's based
qid: raw.cdw10 as u16,
intr_vector: (raw.cdw11 >> 16) as u16,
intr_enable: (raw.cdw11 & 0b10) != 0,
Expand Down Expand Up @@ -132,7 +132,8 @@ pub struct CreateIOCQCmd {
///
/// The size of the Completion Queue to be created.
/// See NVMe 1.0e Section 4.1.3 Queue Size
pub qsize: u16,
/// NOTE: This has already been converted from a 0's based value.
pub qsize: u32,

/// Queue Identifier (QID)
///
Expand Down Expand Up @@ -171,7 +172,8 @@ pub struct CreateIOSQCmd {
///
/// The size of the Completion Queue to be created.
/// See NVMe 1.0e Section 4.1.3 Queue Size
pub qsize: u16,
/// NOTE: This has already been converted from a 0's based value.
pub qsize: u32,

/// Queue Identifier (QID)
///
Expand Down
Loading