oxidecomputer / oxidecomputer/propolis
nvme: we should limit max MDTS
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 270
- Forks
- 42
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 6
Description
there is a practical maximum data transfer size, which is 1024 pages currently: PRPs translate into iovec and IOV_MAX is 1024. if a guest NVMe driver submits three PRP lists worth of read/write pages we'll have >1024 iovec, p{read,write}v will return EINVAL, and eventually this will get back to the guest as an error for the NVMe command.
on MDTS from the spec:
The value is in units of the minimum memory page size (CAP.MPSMIN) and is reported as a power of two (2^n). A value of 0h indicates that there is no maximum data transfer size.
the default MDTS of zero if the caller of PciNvme::create() doesn't provide one is definitely misleading. in practice currently the practical bounds here would be 0 < MDTS <= [derived from IOV_MAX], which happens to currently be 0 < MDTS <= 10.
I'm mildly curious what the maximum sizes a guest would choose to use, because empirically Linux seems to limit to 256KiB, well below both 4MiB and "no limit". that observation could, of course, be that fio broke up larger I/Os, I dunno.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at PciNvme::create() and trace how MDTS is selected and reported to the guest, then inspect the PRP-to-iovec path and p{read,write}v limits. Done means the advertised MDTS cannot permit transfers beyond the practical IOV_MAX bound, while preserving the NVMe specification's power-of-two units and zero semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100