4 Replies Latest reply on Oct 21, 2017 2:05 PM by trothy

    Can choice of BIOS vs UEFI affect USB 3.0 speed?

    trothy

      I recently got a NUC5PGYH and am setting it up as a NAS for myself. The first thing I did was update the BIOS to the newest version, just to get that out of the way. I then proceeded to install Arch Linux in BIOS mode and haven't had any significant problems since then. Overall, the system runs very well.

       

      The trouble began when I attached two external USB 3.0 hard drives and started copying some large files. I only got a write speed of about 32 MB/s. Naturally I proceeded to doing some benchmarks and indeed the write speeds for both drives were between 48 and 50 MB/s only, which smells like USB 2.0. To rule out any problems with the drives themselves or USB 3.0 support in the newest Linux kernel, I attached them to my desktop computer, where I also have Arch Linux installed with the same kernel and ran some more tests. I got a sustained write speed of 100 to 120 MB/s, which is what I would have expected in the first place, because that's what I usually get with them in Windows. So neither the drives, nor USB 3.0 support in Linux should be at fault. Back at the NUC, I made sure that the drives were really recognized as USB 3.0 using lsusb.

      Bus 002 Device 003: ID 0bc2:3321 Seagate RSS LLC
      Bus 002 Device 002: ID 1058:25ee Western Digital Technologies, Inc.
      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 001 Device 003: ID 8087:0a2a Intel Corp.
      Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      

       

      As you can probably see more clearly in the tree view, both hard drives are on the USB 3.0 bus using the correct xhci driver for USB 3.0.

      /:  Bus 02.Port 1: Dev 1, class="root_hub", Driver=xhci_hcd/6p, 5000M
          |__ Port 1: Dev 2, If 0, class="Mass" Storage, Driver=usb-storage, 5000M
          |__ Port 4: Dev 3, If 0, class="Mass" Storage, Driver=uas, 5000M
      /:  Bus 01.Port 1: Dev 1, class="root_hub", Driver=xhci_hcd/7p, 480M
          |__ Port 5: Dev 2, If 0, class="Hub", Driver=hub/4p, 480M
              |__ Port 1: Dev 3, If 0, class="Wireless", Driver=btusb, 12M
              |__ Port 1: Dev 3, If 1, class="Wireless", Driver=btusb, 12M
      

       

      A lot of searching on the forums turned up exactly nothing. Apparently it's possible in the BIOS of some NUCs to select the xHCI mode, but in my settings there is no such thing, only a USB legacy option. It doesn't do anything to my write speed. I also tried most of the probably unrelated settings concerning the power states and such. Of course I also thought of loading the defaults again and testing that, the result is always the same.

       

      Considering that everything looks well from the operating system side and a very similar Linux installation got great write speeds on the same drives, I can't shake the feeling that maybe the BIOS on the NUC is responsible. I did install Arch Linux in BIOS (legacy) mode instead of UEFI, do you think that could have any effect at all?

        • 1. Re: Can choice of BIOS vs UEFI affect USB 3.0 speed?
          N.Scott.Pearson

          In theory, what happens in BIOS and how you boot (Legacy vs. UEFI) should make absolutely no difference in the performance of USB in Windows.

           

          Here is an experiment that you can run: Go into BIOS Setup (Visual BIOS), select Advanced then Boot and then the Boot Configuration tab. In the upper left box, select Fast Boot. Use F10 followed by Y to save the configuration as you exit Visual BIOS. When you see the Intel NUC splash screen appear, power off the NUC completely (disconnect power brick). After a minute, restore power and then boot into Windows. Check the disk performance over USB.

           

          When you enable Fast Boot, the BIOS does not initialize or configure the USB hardware at all. This should mean that the BIOS - and whether it is using Legacy or UEFI boot - can have no effect on USB performance. The Windows drivers will be wholly responsible for all USB hardware initialization and configuration and thus completely in control of USB performance.

           

          ...S

          1 of 1 people found this helpful
          • 2. Re: Can choice of BIOS vs UEFI affect USB 3.0 speed?
            trothy

            Thank you for your suggestion. With that I should be able to eliminate the BIOS from the list of suspects.

            I'm back on Saturday, so I'll have a go then and report how that went.

            • 3. Re: Can choice of BIOS vs UEFI affect USB 3.0 speed?
              trothy

              I did the fast boot experiment and as expected, it really didn't do anything. Even though I'm quite sure the problem is not with my Linux installation since I get great write speeds on other machines with the same configuration, I started up a different Distro (Knoppix) from a live pen drive, and even though the HDDs were also recognized as USB 3.0, the benchmark write speed remained at just below 50 MB/s and real world copying of large files at around 30 MB/s. While writing is slow, reading happens at around 140 MB/s, both in the live distro and my Arch Linux installation on the eMMC. Obviously there is USB 3.0 at work here, but strangely not when writing.

              After having exhausted the Linux options, I nuked the system and reinstalled Windows 10 to rule out a hardware problem. The result was a sustained write speed of 130 MB/s, which is presumably the most my hard drives can do. Having established that it can't be a pure hardware issue, I went back and reinstalled Arch Linux, this time in UEFI mode, just to be sure. I didn't expect much of that based on your previous answer and you were absolutely right, the issue still persists in this fresh installation.

               

              Where does that leave us? It's absolutely puzzling. It's clearly not a hardware issue, since write speeds in Windows are great. On the other hand, the Intel NUC is the only one of my machines, all with the same distro and kernel version, that doesn't achieve normal USB 3.0 write speeds. So we can't really blame USB 3.0 support in Linux, which has been great for all my computers so far.

               

              The last thing I can think of here is that maybe there is something "special" going on in the NUC's hardware or firmware of some component, which the Intel drivers for Windows handle, but the Linux driver (which presumably was developed to specification) has a problem with, resulting in USB 2.0 write speeds.

              • 4. Re: Can choice of BIOS vs UEFI affect USB 3.0 speed?
                trothy

                I think I figured it out. While it's a well-known fact that ntfs-3g is not terribly efficient (being user-space and all), I didn't think that would be the root cause of my problem, because it's been working well on my other computers. CPU usage during disk access is relatively high (around 50% of each core) due to all the kernel traps, but since that's about what I expected I didn't think much of it.

                 

                So I tried the big_writes mount option of ntfs-3g, which essentially prevents fuse from splitting write buffers into 4K chunks, enabling big write buffers to be transferred from the application in a single step. And it worked. In benchmark conditions this gives me writes of 120 to 200 MB/s and copying of large files is now at close to 90 MB/s. It's still not where it could be, but I'll gladly take this 300% increase.

                 

                So what happened, why don't I have any problems without the big_writes option on my other machines? I can only guess here, but since the NUC is the weakest one of the bunch my money is on the simple fact that it doesn't handle the high CPU usage of ntfs-3g as well as the others.