=================================================== SATA hotplug speed fix =================================================== Whenever you unplug a SATA disk, the Linux kernel first assumes that the link is bad, so it tries to recover before determining that the device has been removed. If too many errors occur in a short time during recovery, then the kernel tries limits the link speed, first to 3.0 Gbps (on a 6.0 Gbps controller), then to 1.5 Gbps. There is no way to manually clear these errors. Example of removing disk: [7270679.195473] ata4: exception Emask 0x10 SAct 0x0 SErr 0x4010000 action 0xe frozen [7270679.195937] ata4: irq_stat 0x00400040, connection status changed [7270679.196887] ata4: SError: { PHYRdyChg DevExch } [7270679.197998] ata4: hard resetting link [7270679.920032] ata4: SATA link down (SStatus 0 SControl 300) [7270684.920027] ata4: hard resetting link [7270685.240034] ata4: SATA link down (SStatus 0 SControl 300) [7270685.240049] ata4: limiting SATA link speed to 1.5 Gbps [7270690.240030] ata4: hard resetting link [7270690.560030] ata4: SATA link down (SStatus 0 SControl 300) [7270690.560039] ata4.00: disabled [7270690.576025] ata4: EH complete [7270690.576038] ata4.00: detaching (SCSI 3:0:0:0) Immediately plugging in another disk: [7270695.660961] ata4: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen [7270695.661416] ata4: irq_stat 0x00000040, connection status changed [7270695.662327] ata4: SError: { RecovComm PHYRdyChg CommWake DevExch } [7270695.663518] ata4: limiting SATA link speed to 1.5 Gbps [7270695.663524] ata4: hard resetting link [7270705.684030] ata4: softreset failed (device not ready) [7270705.684498] ata4: hard resetting link [7270712.632035] ata4: SATA link up 1.5 Gbps (SStatus 123 SControl 300) [7270712.640555] ata4.00: ATA-7: Hitachi HDS721010KLA330, GKAOAB0A, max UDMA/133 [7270712.640560] ata4.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA [7270712.641499] ata4.00: configured for UDMA/133 [7270712.656024] ata4: EH complete When installed, this module simply prevents libata from limiting the SATA link speed after link errors occur. It works by installing a kretprobe on sata_down_spd_limit which saves the original sata_speed_limit value, and restores it when the function returns. =================================================== Supported architectures =================================================== Currently, only x86 and x86_64 are supported. =================================================== Installing =================================================== If you just want to build the module without installing it, run: ./build To install the module using DKMS, so that the module automatically gets built whenever you upgrade your kernel, run: sudo ./dkms_install =================================================== Loading/Unloading =================================================== If you installed the module using DKMS, run: sudo modprobe sata_hotplug_spd_fix If you just built the module itself, run: sudo insmod ./sata_hotplug_spd_fix.ko To unload the module, and remove the patch, run: sudo rmmod sata_hotplug_spd_fix