-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Device Information | 设备信息
- SOC: rk3399
- Model: smart am40
Armbian Version | 系统版本
- Kernel Version: [e.g. 5.15.100] 5.x, 6.x
- Release: [e.g. jammy/bullseye] bookworm
Describe the bug | 问题描述
Hardware: smart am40
System: armbian
Kernal is using this patch #1317 (comment), so the version is 5.15.111
I'm using smart am40 as my NAS, plug-in a SSD disk via USB3.0, something like this https://item.jd.com/100052013346.html
SSD should work at 480-500MB/s
USB3.0 should also be at least 500MB/s
SATA should not be the bottleneck neither.
But tests show the speed is just 170MB/s
so where is the bottleneck?
After several round of debuging together with chatgpt, I find the root cause is UASP:
诊断:瓶颈就是 Driver=usb-storage (BOT 模式)
解释:BOT (Bulk-Only Transport) 是 USB 存储设备最基本的传输协议,自 USB 1.1 时代就存在。它的效率相对较低,每次只能处理一个命令,并且在命令队列、错误恢复等方面不如 UASP 高效。它会导致传输速度通常远低于 USB 3.0 的理论上限,甚至达不到 SATA SSD 在 USB 3.0 下应有的 300-400MB/s 速度。
UASP (USB Attached SCSI Protocol) 是一种更新、更高效的协议,旨在充分利用 USB 3.0 (或更高版本) 的高速带宽。它允许同时处理多个命令(命令队列),并改善了错误处理,从而显著提高传输性能,尤其是对于 SSD 这种本来就具备高 IOPS 和低延迟的设备。当 UASP 正常工作时,lsusb -t 通常会显示 Driver=uas。
你的 170MB/s 读取和 270MB/s 写入速度,正是 USB 3.0 在 BOT 模式下的典型表现,对于 SSD 来说,这个速度确实是不正常的低。而 5000M 的带宽在这里只是显示连接速率,不代表实际传输效率。
......
软件层面:Armbian 系统是否支持 UASP?
虽然现代 Linux 内核普遍支持 UASP,但像 Armbian 这样的特定嵌入式发行版,其内核版本、编译配置以及对某些芯片的支持程度可能会有所不同。如何确认:
内核版本: 你可以通过 uname -r 命令查看 Armbian 的内核版本。通常,Linux 内核 3.0 及以上版本就已开始支持 UASP,但性能和兼容性在后续版本中不断完善。较新的 Armbian 版本通常会使用较新的内核,这更有利于 UASP 支持。
内核模块: 正常情况下,如果硬盘盒和你的主控都支持 UASP,Linux 会自动加载 uas 模块。你可以用 lsmod | grep uas 命令查看这个模块是否已加载。如果未加载,即使硬件支持,软件也无法启用 UASP。
尝试强制启用(谨慎操作): 虽然不推荐一般用户直接修改内核参数或 udev 规则来强制加载 uas 驱动(因为可能导致兼容性问题),但如果你确认硬盘盒支持 UASP 而系统就是不加载 uas 驱动,这可能成为一个高级排查方向。
通常情况下,如果硬盘盒本身支持 UASP 且连接到 USB 3.0 端口,大多数现代 Linux 系统(包括较新版本的 Armbian)都会自动识别并使用 uas 驱动。 你目前的情况更像是硬盘盒本身不支持 UASP,或者其桥接芯片与 Armbian 系统的兼容性存在问题,导致无法启用 UASP。
I think my case is a common case when using those device as NAS.
So the configuration should be changed