oxidecomputer / oxidecomputer/propolis

nvme: we should limit max MDTS

Open
#986 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

guest-os storage
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.