Page MenuHomeFreeBSD

nvme/nvmf: Add NVME_GET_CONTROLLER_DATA ioctl to fetch cached cdata
ClosedPublic

Authored by jhb on Dec 27 2024, 8:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 17, 2:47 AM
Unknown Object (File)
Mar 24 2025, 12:04 AM
Unknown Object (File)
Mar 5 2025, 7:11 AM
Unknown Object (File)
Feb 28 2025, 12:01 PM
Unknown Object (File)
Feb 11 2025, 7:24 PM
Unknown Object (File)
Feb 11 2025, 12:40 PM
Unknown Object (File)
Feb 5 2025, 10:07 AM
Unknown Object (File)
Feb 2 2025, 11:09 PM
Subscribers

Details

Summary

Both nvme and nvmf cache a copy of the controller's identify data in
the softc. Add an ioctl to fetch this copy of the cdata. This is
primarily useful for allowing commands like 'devlist' to work against
a disconnected Fabrics host.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Dec 27 2024, 8:29 PM
sbin/nvmecontrol/nvmecontrol.c
103 ↗(On Diff #148443)

Maybe it uglifies the code, but do we want to have a force a pass through command option and path? It would be useful for debugging in case ident changes and the driver fails to update its cache.

sys/dev/nvme/nvme_ctrlr.c
1447

Copyout maybe?

sys/dev/nvmf/host/nvmf.c
1111

Copyout maybe?

sbin/nvmecontrol/nvmecontrol.c
103 ↗(On Diff #148443)

I wondered if there were cases where we would want to always use pass through or not. I could instead restructure the devlist handler to use this ioctl in the case that a fabrics controller is disconnected and leave this path as-is. It wasn't clear to me if there were any cases where the cdata could change or if it was effectively read-only.

sys/dev/nvmf/host/nvmf.c
1111

It's an ioctl, the buffer is already in kernel memory.

sys/dev/nvmf/host/nvmf.c
1111

It's a pointer that's copied into the kernel with the usual ioctl routine. The ident size is bigger than can be encoded on the ioctl cmd. So memcpy works because the kernel and user space are mapped at rhe same time on x86_64. Or am I missing something?

sys/dev/nvmf/host/nvmf.c
1111

No, 4k is smaller than IOCPARAM_MAX (8k).

This revision is now accepted and ready to land.Jan 19 2025, 3:10 AM