[PATCH 0/2] Unprivileged sgl-only passthrough
Jens Axboe
axboe at kernel.dk
Wed Oct 18 12:12:27 PDT 2023
On 10/18/23 1:06 PM, Kanchan Joshi wrote:
> On Thu, Oct 19, 2023 at 12:10?AM Jens Axboe <axboe at kernel.dk> wrote:
>>
>> On 10/18/23 12:30 PM, Kanchan Joshi wrote:
>>> Patch 1: Prep. Adds the meta-transfer ability in nvme-pci
>>> Patch 2: Enables fine-granular passthrough with the change that i/o
>>> commands can transfer the data only via SGL.
>>>
>>> Requirement:
>>> - Prepared against block 6.6 tree.
>>> - The patch in uring-passthrough failure handling is required to see the
>>> submission failure (if any)
>>> https://lore.kernel.org/linux-nvme/20231018135718.28820-1-joshi.k@samsung.com/
>>
>> I didn't have time to follow the previous discussion, but what's the
>> reasoning behind allowing it for SGL only?
>
> This was a solution that emerged while discussing how best to fill the
> DMA corruption hole for passthrough.
> With SGL, the buffer length (data/buffer) sanity checks are done by
> the SSD and it fails the IO rather than doing extra transfer.
Yay hardware...
>> IIRC, we do have an inline
>> vec for a small number of vecs, so presumably this would not hit
>> alloc+free for each IO?
>
> 16b dma_pool_alloc/free for each IO that involves metadata. This is to
> keep the nvme-sgl that points to the metadata buffer.
> Hopefully some ideas can emerge (during the review) to see if we can
> do away with it.
OK, so at least nothing if meta data isn't being used. I know of at
least one use case for meta data and passthrough, so would be nice to at
least have an eye on making that situation better.
>> But even so, I would imagine that SGL is slower
>> than PRP? Do we know how much?
>
> I do not know at the moment. Plan is to evaluate this soon.
>
> BTW, SGL-only mode is for unprivileged users only. For root, it
> remains the same as before (prp or sgl depending on the data-transfer
> length).
That's nice at least.
Thanks for the clarifications.
--
Jens Axboe
More information about the Linux-nvme
mailing list