Skip to content
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

Adding the UAS module to kern module blacklist? #1743

Closed
philippecrowdsec opened this issue Feb 8, 2022 · 19 comments
Closed

Adding the UAS module to kern module blacklist? #1743

philippecrowdsec opened this issue Feb 8, 2022 · 19 comments
Labels
board/raspberrypi Raspberry Pi Boards bug usb-ssd USB SSD related issue

Comments

@philippecrowdsec
Copy link

Describe the issue you are experiencing

UAS mode is bringing marginal performance boost to USB disk R/W but the tradeoff is huge since most disks will generate errors on an RPI4 if plugged on the USB bus without patching the kernel command line. Adding the UAS to the module blacklist could maybe help to avoid those errors in the first place.

Actually you have to mount your USB drive boot partition, edit the cmdline and add something like:
usb-storage.quirks="152d:0579:u" dwc_otg.lpm_enable=0 console=tty1
(152d:0579 coming from a lsusb)

While this works, it's still an extra headache for the users, and using an SSD drive is way safer than an SDcard.

What operating system image do you use?

rpi4-64 (Raspberry Pi 4/400 64-bit OS)

What version of Home Assistant Operating System is installed?

7.1

Did you upgrade the Operating System.

No

Steps to reproduce the issue

  1. Plug a USB drive
  2. Half of times, you'll have issue, seeing in your logs squashfs complaining or lines like
  3. . . . [sda] tag#27 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
    . . . [sda] tag#27 CDB: opcode=0x28 28 00 00 03 b0 3a 00 00 b0 00
  4. Disabling UAS on the given drive, by editing the cmdline.txt will get rid of this problem

Anything in the Supervisor logs that might be useful for us?

nope, the kern.log is the most relevant source

Anything in the Host logs that might be useful for us?

mostly the kern.log / console

System Health information

No response

Additional information

No response

@philippecrowdsec
Copy link
Author

(also relates to this post I made in the community forums for deeper explanations : https://community.home-assistant.io/t/raspberri-pi-4-9-steps-howto-get-both-hassio-boot-data-run-over-an-ssd/372548)

@philippecrowdsec
Copy link
Author

raspberrypi/linux#3855

@agners agners added the board/raspberrypi Raspberry Pi Boards label Feb 8, 2022
@agners
Copy link
Member

agners commented Feb 8, 2022

Afaik, there are known drives which do work with UAS enabled. I guess they would get slowed down with such a generic ban.

I'd rather prefer to have a set of usb-storage.quirks.

@agners agners added the usb-ssd USB SSD related issue label Feb 8, 2022
@philippecrowdsec
Copy link
Author

Yeah indeed, there are some setups that work. But, this is dependent on a combination of PI version, cable, hub, disk. So a lot can go wrong.

The drawback of a generic ban is to lower the potential max throughput of a disk of about 50%, but given the speed of the USB3 bus of a PI, rather 20%. But anyway, there is no need for 50 Mb/s instead of 30 Mb/S on a PI using HA. I'm not even sure a large setup would be able to use 10 Mb/s of throughput.

On the other hand, for the people that have issues (not a marginal amount I'd guess), the process of mounting the drive, editing the command line and all is pretty daunting. Beyond the fact that having both boot & data is better, even just migrating the data to an external drive (offered by default by HA) is often failing because of this.

So even if its a trade-off, it's lowering unused max perf, in favor of more simplicity (no complicated command to issue for the user to migrate to an SSD or impossible to find combo of cable, hub, drive, pi to make it work) and security (more people using a SSD, vastly more stable and durable than an SDcard)

Then if the user wants to get the most out of its disk, it's easier to remove the UAS from the module blacklist for some, than editing the cmdline for most.

@agners
Copy link
Member

agners commented Feb 8, 2022

Valid points.

What is Raspberry Pi doing on that front? Do they blacklist by default? Did they consider blacklist it?

@philippecrowdsec
Copy link
Author

Excellent question and I've no good answer to help here.
My guess here is that distro-makers (or containers bakers) are all having their own receipt here. You could use a PI to make a FreeNAS and this patch would then greatly harm the perf of this NAS so adding it by default to Raspbian would likely be counterproductive.

Most use cases of the PI I know about are related to running it on an SDcard. I never really dug into the HDD/SSD problem before falling in love with HA and wanting to have a stable environment to run it.

I found a thread here though: raspberrypi/linux#3855

Googling "github: raspberry pi SSD UAS module to kernel blacklist" returned a few results.

@agners
Copy link
Member

agners commented Feb 8, 2022

Hm, so they opted to not blacklist uas by default.

Afaik UAS is also used to get TRIM working on SSD, which is rather important for wear-leveling and maintain performance. I wonder if there might not also be drives which only support UAS?

@tmm1 do you have thoughts on this?

Blocking UAS generally seems like quite a hammer on a technology which should be the future of USB mass storage devices. I kinda tend to follow the Raspberry Pis lead.

From this Raspberry Pi forum thread it sounds like the problem is not really on RPi4 side but just bad drives? FWIW, my Samsung USB 3.0 SSD works flawlessly with UAS.

@tmm1
Copy link
Contributor

tmm1 commented Feb 8, 2022

Seems like the wrong approach to me.

since most disks will generate errors on an RPI4 if plugged on the USB bus without patching the kernel command line.

We work with a lot of consumer HDDs and my experience is the opposite. Most of them work just fine, and take advantage of UAS.

The problems seems to occur more with older DIY enclosures that people are using for SSDs.

I'd rather prefer to have a set of usb-storage.quirks.

Agree with this, if the goal is to make things easier and work out of the box then we should bundle the list of quirks so most setups work.

@agners
Copy link
Member

agners commented Feb 8, 2022

Let's do that then. It seems that the JMicron already make a rather big share of the trouble makers. I found those in the Raspberry Pi Forum where there is also confirmation that those also helped:

@philippecrowdsec
Copy link
Author

philippecrowdsec commented Feb 8, 2022 via email

@tmm1
Copy link
Contributor

tmm1 commented Feb 8, 2022

Here are some we are including: fancybits@72b2fde

@philippecrowdsec
Copy link
Author

philippecrowdsec commented Feb 8, 2022 via email

@axlthorell
Copy link

I have the StarTech USB-SATA 3.0 adapter and use a Kingston A400 120gb SSD. It works with UAS but after a while the system log in HA is slow to load and with UAS turned off it's now much more responsive.

  • 14b0:0206:u

@wokkeltje13
Copy link

I have the StarTech USB-SATA 3.0 adapter and use a Kingston A400 120gb SSD. It works with UAS but after a while the system log in HA is slow to load and with UAS turned off it's now much more responsive.

  • 14b0:0206:u

For me this fixed also made a huge difference with displaying the logs. Seems to be the same StarTech adapter.

Disk: Crucial BX500 with StarTech.com SATA to USB Cable - USB 3.0 to 2.5" SATA III Hard Drive Adapter

  • 174c:55aa

@agners
Copy link
Member

agners commented May 5, 2022

Added 174c:55aa:u to the list as well. With that we should have a pretty good default blacklist as part of HAOS 8.0.

@agners agners closed this as completed May 5, 2022
@carsten-h
Copy link

carsten-h commented May 16, 2022

Added 174c:55aa:u to the list as well.

This is interesting. I had to use this quirk in my Argon One M.2 case since HA OS 5.10 I think, because my logs have been really slow to show: home-assistant/supervisor#3014.
This is the 64bit version of HA OS.

I also have a Pi 4 4GB inside the Argon One M.2 case but I am using Raspberry Pi OS Bullseye in 32bit.
There I have no problems when using this controller. UAS is working fine without any problem.

Is is possible that is is a 64bit only problem? Maybe there is somewhere an error in the 64 bit implementation?

@philippecrowdsec
Copy link
Author

It looks to me like a USB3 power and/or implementation problem.

Raspberry is not known to implement the most "by the book" USB hardware and there is also often a power shortage problem. Now to add to this mess, USB3 hubs are usually cheap and poorly designed, here again not very respectful of any norm. Combining the two, you get a very shaky gateway between an exigent SSD drive and an exigent OS. What could possibly go wrong? Well the UAS mode for a start, which is a combo of the old (but good) SCSI norm, adapted to the USB3 bus. It's way better & faster than the older BOT module that was used for this, but it's stricter. And when you get this unlikely teaming between RPI/USB hubs & varying quality of SSD drives, you can caught in this problem.

Now honestly deactivating the UAS for an SSD serving HA on an RPi, I'd bet there are very few corner cases where you would feel any performance difference I think. But I totally get the decision of the maintainers to support the majority case and not lose performances over complying even with the unlucky ones but sacrificing perfs. Anyway, this thread (and the one on HA forum) are there to hint the minority users having this problem to a pragmatic solution.

@dafunkydan
Copy link

Another incompatible Adapter:
idVendor:174c
idProduct:225c

Sold as "UGREEN USB 3.0 SATA Adapter für 2.5 Zoll SSD und HDD Festplatten SATA auf USB Adapter unterstützt SATA III UASP Ruhemodus SMART Trim usw.", bought 07/2022 has the nasty UAS-Incompatibility as well.
Appending the Quirk manually did the Job.

@agners
Copy link
Member

agners commented Jan 23, 2023

Thanks for your report, this PR adds that device as well: #2310

Ideally new devices should be reported in a new issue, so we have them tracked separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board/raspberrypi Raspberry Pi Boards bug usb-ssd USB SSD related issue
Projects
None yet
Development

No branches or pull requests

7 participants