Page MenuHomeFreeBSD

nvme: Switch to using unmapped pages for passthrough data transfer
AcceptedPublic

Authored by imp on Aug 22 2025, 1:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 29, 3:59 PM
Unknown Object (File)
Wed, Nov 26, 1:47 PM
Unknown Object (File)
Wed, Nov 26, 1:47 PM
Unknown Object (File)
Sat, Nov 22, 11:49 AM
Unknown Object (File)
Nov 8 2025, 11:33 PM
Unknown Object (File)
Nov 7 2025, 11:23 AM
Unknown Object (File)
Oct 16 2025, 5:45 PM
Unknown Object (File)
Oct 16 2025, 6:09 AM
Subscribers

Details

Reviewers
jhb
mav
markj
kib
Summary

Use unmapped I/O for the data transfers for passthrough ioctls. Nothing
looks into them, so there's no need to map and unmap VAs we'll never
dereference through.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66459
Build 63342: arc lint + arc unit

Event Timeline

imp requested review of this revision.Aug 22 2025, 1:15 AM
kib added inline comments.
sys/dev/nvme/nvme_sysctl.c
56 ↗(On Diff #160791)

Why 'try'? Would it be enough to say 'use unmapped ...'?

This revision is now accepted and ready to land.Aug 22 2025, 12:49 PM

I must say, I would perhaps find it simpler to avoid vmapbuf() and just use vm_fault_quick_hold_pages() if you didn't care about the sysctl. I suspect no one will ever care about the sysctl or toggle it?

This is fine for now (especially given the code slush). I might try to come up with a thin wrapper around vm_fault_quick_hold_pages that can be used here (and in a few other places) and replace the usage of vmapbuf. It's interesting that prior to this change, all callers vmapbuf pass 1 (mapped bufs) to vmapbuf. It might be nice to simplify that API again to remove the unmapped case.

sys/dev/nvme/nvme_sysctl.c
56 ↗(On Diff #160791)

I agree, this doesn't really try, it is always unmapped.

sys/dev/nvme/nvme_sysctl.c
56 ↗(On Diff #160791)
if (mapbuf || !unmapped_buf_allowed) {
        pmap_qenter((vm_offset_t)bp->b_kvabase, bp->b_pages, pidx);
        bp->b_data = bp->b_kvabase + bp->b_offset;
} else
        bp->b_data = unmapped_buf;

inside of vmapbuf is why i wrote 'try'.

56 ↗(On Diff #160791)

But I do agree with 'just do it'.

So I'll update this to always do it and remove the sysctl.
I'll work on a wrapper around vm_fault_quick_hold_pages for future use and see about converting current users, maybe after the branch.

Just do it (I've updated the commit message locally, but arc doesn't autochange)

This revision now requires review to proceed.Aug 22 2025, 4:33 PM
This revision is now accepted and ready to land.Sep 3 2025, 1:43 PM