SATA hot swap on L4T 28.2.1

Hi,

I am trying to figure out if hot swapping a SATA disk on the latest version of L4T works.

I have seen these 2 threads that are related but I am confused:

https://devtalk.nvidia.com/default/topic/1023698/?comment=5208358

https://devtalk.nvidia.com/default/topic/1023894/jetson-tx2/sata-hotplug-on-tx2/

I first unmount my disk using the following command:

sudo udisksctl unmount -b /dev/sda1

then I get the following messages:

[   21.789817] ata1: irq_stat 0x00400000, PHY RDY changed                   
[   21.796369] ata1: SError: { PHYRdyChg 10B8B Dispar LinkSeq TrStaTrns }
[   21.803662] ata1: hard resetting link
[   22.534014] ata1: SATA link down (SStatus 0 SControl 300)
[   27.537976] ata1: hard resetting link
[   27.861955] ata1: SATA link down (SStatus 0 SControl 300)
[   27.867527] ata1: limiting SATA link speed to 1.5 Gbps
[   32.865924] ata1: hard resetting link
[   33.190022] ata1: SATA link down (SStatus 0 SControl 310)
[   33.195656] ata1.00: disabled
[   33.199777] ata1: EH complete
[   33.224764] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[   33.230727] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x04 driverbyte=0x00
[   33.244200] sd 0:0:0:0: [sda] Stopping disk
[   33.255048] sd 0:0:0:0: [sda] Start/Stop Unit failed: Result: hostbyte=0x04 driverbyte=0x00

if I power up my disk in less that 5 seconds, after the initial power off, the disk can be hot swapped (time diff 27->32). If I power it on after 6 seconds(or longer), nothing happens. I cannot detect the device anymore.

So, my question is: Is the hot swap functionallity on L4T 28.2.1 working? If not, I understand it is a software issue. Will there be support for SATA hot swap in future versions of L4T?

Thanks in advance.

Joseph

I don’t have a hot swap bay to test with, and from what I can tell hot swap SATA is not supported. If I were to actually try to do something with this I might consider any kernel feature related to hot swap would possibly work better when integrated in the kernel instead of when loaded as a module (I’m thinking perhaps if there is no automatic mechanism to detect the need for a driver, then it would be better for the driver to always be loaded…don’t know, just speculating).

You might also try to force a rescan. I’m not sure, but on a dev kit probably this would be it:

sudo echo '0 0 0' > /sys/class/scsi_host/host0/scan

…it might be host1 instead of host0.

Hi linuxdev,

the kernel has support only for TEGRA AHCI SATA and that is not included as a module.

Scanning the bus is not possible, using the above command, as both hosts dissappear 5 seconds after you remove the drive (there is nothing in the scsi_host folder). If you reconnect the drive after a second, it works, but in any case, it is not needed. Thanks for the tips.

Joseph

The interesting thing about this is that the directory “/sys/class/scsi_host/host0/” (and files within that directory) exist because of the driver being present and knowing the hardware exists regardless of whether hot swap is possible. You may be right about not supporting hot swap because adding a hardware device back in should cause host0 to show up again even if there is an error in writing to the “scan” file. I don’t know what needs to be present for hot swap. Anyone know if perhaps there is a detect pin or event which the Jetson isn’t wired for?

The software to actually perform useful work with hot swap is what people usually miss, but without the kernel knowing the drive is there this won’t do any good. I normally just use “sudo umount” of any used partitions without “udisksctl”. I’m curious what might change if you have never mounted the disk? So if you boot up, the disk is never mounted and thus never needs umount, are you able to pull the disk and wait over five seconds and get the disk (or the “/sys/class/scsi_host/host#/” subdirectory) back? If you use “sudo umount /dev/sd<whatever_partition>” instead of “udisksctl” does anything change?

Hi linuxdev,

the problem does not occur when I execute the unmount command. I am able to unmount and mount as many times as i want, as long as I do not physically remove the drive. I actually execute:

udisksctl unmount -b /dev/sda1

The log I included is from the moment when I physically disconnect the disk, until I reconnect it a couple of seconds later. Unmounting alone does not cause any problems.

I also tried to boot without the disk mounted and then try to mount it. The /dev/sda entry does not exist at all.

Could this be a hardware issue, i.e. some pin not connected or damaged? Why does it need 6-7 seconds before /sys/class/scsi_host/host0 disappears? Is there a timeout value that can be controlled?

Do you happen to know the name of the source file for the SATA driver, so that I can take a look?

Thanks in advance.

BR

Joe

I have no hot swap capable hardware to test with, so it is hard to have any meaningful conclusions.

It may be correct that the hardware does not support this even with correct software, but someone from NVIDIA will have to comment on whether SATA hotswap has some hardware requirement not present (or verify that this is possible). It is unlikely that there is damage, I believe it is just an optional behavior which has not been implemented (I don’t see a special hot swap option for kernel config of SATA).