-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kernel: Enable *NVMe-over-TCP* for rk35xx/rk3588/rockchip64/uefi/wsl #6368
Conversation
- Enable NVMe over TCP kernel support for the board families `rk35xx` (vendor), `rockchip-rk3588` (edge), `rockchip64` (current, edge) as well as the generic `uefi` target (current, edge) and `wsl` (current, edge) - Note: for `wsl` only host-mode is supported, target-mode is not available - Support for `legacy` kernels not added due to incompatibilities between kernel versions <5.14 and >=5.14. Kernels <5.14 need to patch in this commit to be compatible: torvalds/linux@3c3ee16532c1 - NVMe over TCP specs and slides: https://nvmexpress.org/wp-content/uploads/March-2019-NVMe-TCP-What-You-Need-to-Know-About-the-Specification.pdf - Guides: https://www.linuxjournal.com/content/data-flash-part-iii-nvme-over-fabrics-using-tcp and https://blogs.oracle.com/linux/post/nvme-over-tcp - NVMe-oF authentication support: https://blogs.oracle.com/linux/post/nvme-inband-authentication - NVMe-oF TLS support (kernel >=6.7 required): https://lwn.net/Articles/942817/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! "yes, and" for the future:
- when faced with outdated .configs, use
./compile.sh BOARD=x BRANCH=y rewrite-kernel-config
, then commit; that way when you do the actual change, it's isolated. - BCACHEFS needs more or less the same treatment ;-)
Ah yes, totally agree with you. This came to my mind as well, but only after I had already sent the PR and I didn't want to revert and do it again 😅 Next time! |
@rpardini What would be the best place to copy-paste this to, so more people can see this little guide? Do you have an idea? |
Ref the contents: good write up. I think the comparison to NFS is a bit unfair, poor NFS, a more apples-to-apples opponent would be iSCSI, maybe. I'm not the best to ask with docs and such and where to store them, but maybe in a .md file in https://github.com/armbian/documentation ? We're in sore need of updates there, see armbian/documentation#352 , there have been meetings about docs etc. @igorpecovnik ? |
Yes, unfortunately current docs is a bit messy but we are working on ... IMO anywhere around here
Yes, meetings are, 3-5 people came around, structure / path is set, progress remain slow. |
Oh yeah, totally! My writeup is indeed opinionated. I did the comparison with NFS instead of iSCSI for two reasons mostly:
So yeah, it's an opinionated text with some information and links I wish I had when I first learn about its existence :)
Alright thanks! I'll see what I can do to contribute.
I have only read a few articles about Bcachefs recently, not tried it out. But I can have a look what needs to be done in order to make it available for some Armbian boards. |
iSCSI wouldn't get close to NVMe's perf at (X>1)gbit/s, due to its own overhead and queue depth limitations. |
Oh, interesting!
Yeah that's true. When I did a quick search, it seems like there's loads of software for iSCSI on Windows. Not so much with NVME-oF. But I guess that will develop over time :) |
Description
This PR enables NVMe over TCP kernel support for the board families
rk35xx
(vendor),rockchip-rk3588
(edge),rockchip64
(current, edge) as well as the genericuefi
target (current, edge) andwsl
(current, edge)¹.I used
kernel-config
to only change stuff in "Device drivers" --> "NVMe", other values were changed/updated automatically bykernel-config
. Especially foruefi
andwsl
targets since they have not been updated in a while. Host used to runkernel-config
: x86/AMD64 machine withgcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
.This PR also serves as a little guide/writeup/documentation since I myself struggled to find information on this topic at first😀 Let me know if this would be a good fit for the wiki or if that's out-of-scope.
¹ (Note: for
wsl
only host-mode is supported, target-mode is not available).AR-2282
What is NVMe over TCP?
TL;DR: It's a fast and efficient network storage as a recent alternative to NFS or iSCSI.
NVMe over TCP is part of NVMe over Fabrics (NVMe-oF), which enables remote network access to NVMe devices (SSDs). There are other transport layers like RDMA for enterprise networks, but kernel 5.0 introduced NVMe-oF using TCP, which means special hardware required. You can simply use your device's ethernet port and your home network.
Once a host ist connected to a NVMe SSD over the network, the host has direct access and device behaves as if it was physically plugged into the host. This means, you can not only transfer files and such, but also partition the device or send a secure erase command via
nvme-cli
for example.There advantages using NVMe over TCP over something like NFS, since NVMe over TCP has very low overhead, meaning the performance should be as close to the physical limits of your hardware as possible; namely your ethernet/network speed, the speed of your SSD and the PCIe connection speed (see below for some performance benchmarks). NFS also has problems when writing to databases like SQLite over NFS, since NFS does locking differently than a real file system.
NVMe over TCP specs and slides: https://nvmexpress.org/wp-content/uploads/March-2019-NVMe-TCP-What-You-Need-to-Know-About-the-Specification.pdf
How can I configure and use NVMe over TCP?
For example you could use this to connect multiple NVMe SSDs on different SBCs to form a storage array, basically a JBOD.
Here are some guides on how to export an NVMe SSD on a target machine to make it available on the network, and then how to connect to it from another host.
nvme-cli
is your friend :)nvmetcli
instead of with files: https://documentation.suse.com/sles/12-SP5/html/SLES-all/cha-nvmeof.htmlAdvanced topics:
Note regarding legacy kernels: I have not enabled NVMe over TCP on legacy kernels, since kernels <5.14 and >=5.14 are not able to connect through NVMe over TCP to each other. If you still want to export your NVMe SSD on a machine using legacy kernel 5.10, apply a patch from this commit to the legacy kernel. I tested this method by patching it myself and it worked.
How Has This Been Tested?
Kernel successfully compiled for the following targets:
Tested an export on the target host (FriendlyElec CM3588 NAS) using the
nvmet-tcp
module and connected to it with a FriendlyElec NanoPi R5C using thenvme-tcp
module andnvme-cli
.modinfo
on the various modules (NanoPi R5C edge 6.7):Benchmarks comparing NVMe over TCP with NFS
Test setup:
Read test (no real difference in speed):
Fio read benchmark using NFS
Fio read benchmark using NVMe over TCP
Summary: no performance difference with my setup.
Write test with the following command:
fio --bs=64k --numjobs=4 --iodepth=4 --loops=1 --ioengine=libaio --direct=1 --invalidate=1 --fsync_on_close=1 --randrepeat=1 --norandommap --time_based --runtime=60 --size=300M --name=read-phase --rw=randwrite
Fio write benchmark using NFS
Fio write benchmark using NVMe over TCP
Summary:
49.5MB/s WRITE
with NFS vs111MB/s WRITE
with NVMe over TCP. Meaning over double the speed compared to NFS in this specific scenario.Checklist: