[PATCH v2 0/3] Restrict non-root passthrough

Kanchan Joshi joshi.k at samsung.com
Fri Oct 20 06:28:34 PDT 2023


The series restricts i/o commands (that transfer data/meta) of regular
user to use SGL.
This upside is that kernel can offload the buffer sanity checks to the
device. The downsides are: (i) users are restricted to SGL capable device
, and (ii) performance may reduce depending on the device/workload.

I have not tagged 'Stable' on patch 3 yet since it is not yet clear
whether to go ahead with this.

A short performance test [1] shows this data.

4K randwrite workload
*********************
(a) Data PRP, Meta PRP: 777K
(b) Data SGL, Meta PRP: 776K
(c) Data SGL, Meta SGL: 667K

32K randwrite workload
**********************
~131K for all three cases above.

So there was ~14% decline for small IOs on this particular sample.
At this point I am not sure how common/general this situation is.

@Jens: I confirmed that above decline is not because of extra 16b
dma_alloc/free that I had to add (patch 2). Preallocating an array of
required entries did not change anything.
That said, I am not sure if this can show up in a very high-iops
scenario.

Changes since v1:
- Prepared against for-next (therefore reduced code size).
- Move the SGL checks to core rather than pci.

[1]
fio -iodepth=64 -rw=randwrite -ioengine=io_uring_cmd -bs=4k -numjobs=1 -runtime=30 -md_per_io_size=8 -group_reporting -iodepth_batch_submit=16 -iodepth_batch_complete_min=1 -iodepth_batch_complete_max=16 -cmd_type=nvme -fixedbufs=1 -hipri=1 -filename=/dev/ng0n1 -name=t

Kanchan Joshi (3):
  nvme: flag to force SGL
  nvme-pci: data/meta transfer via SGL
  nvme: restrict non-root passthrough to SGL

 drivers/nvme/host/ioctl.c | 11 ++++++++
 drivers/nvme/host/nvme.h  |  6 +++++
 drivers/nvme/host/pci.c   | 54 +++++++++++++++++++++++++++++++++++----
 3 files changed, 66 insertions(+), 5 deletions(-)

-- 
2.25.1




More information about the Linux-nvme mailing list