# toggle sata power management errors

## albright

Hi all - I have a brand new thinkpad T440s (which is all in all a

pretty magnificent machine; e.g. I am now surfing the web

with screen half bright using 5.77 watts!).

But enough of that. Here's the problem

If I toggle the sata power link management in powertop or

via laptop-mode (which happens with ac plug out or in

events), I get errors.

It seems that sata can be set to power save mode, but setting

it back to performance mode causes these errors.

Here are some from /var/log/messages from when the problem occurred;

the drive then becomes read only and I have to reboot by power button

 *Quote:*   

> Jan  4 23:03:17 olwe kernel: ata1.00: failed to get NCQ Send/Recv Log Emask 0x1
> 
> Jan  4 23:03:17 olwe kernel: ata1.00: failed to get NCQ Send/Recv Log Emask 0x1
> 
> Jan  4 23:03:17 olwe kernel: ata1.00: configured for UDMA/133
> ...

 

I can of course prevent this by disabling sata power management - it does not seem to

affect power use all that much that I can see.

However, my worry is that this is a hardware problem and I should get the machine replaced,

or is this a bug in the power management software?

There doesn't seem to be much on the web about this lately and I would welcome any

advice or help ...

----------

## albright

small update on this

typically, the problem does not occur for mint linux; I can toggle

the /sys/class/scsi_host/hostX/link_power_management_policy

from min_power to max_performance either manually or via

powertop.

Since mint uses kernel 3.11.10 I built one with my config and

the problem persists in 3.11

must be something in my kernel config ... no idea what of course   :Crying or Very sad: 

----------

## albright

small update on this

typically, the problem does not occur for mint linux; I can toggle

the /sys/class/scsi_host/hostX/link_power_management_policy

from min_power to max_performance either manually or via

powertop.

Since mint uses kernel 3.11.10 I built one with my config and

the problem persists in 3.11

must be something in my kernel config ... no idea what of course   :Crying or Very sad: 

----------

## albright

more on this; the problem seems to be laptop-mode

at least, since disabling it, the problem has disappeared

I don't know what setting in laptop-mode would cause this

however.

----------

## loneranger

 *albright wrote:*   

> more on this; the problem seems to be laptop-mode
> 
> at least, since disabling it, the problem has disappeared
> 
> I don't know what setting in laptop-mode would cause this
> ...

 

Hi albright,

I'm seeing the same issue on my desktop:

```
[    0.980795] ata3.00: failed to get NCQ Send/Recv Log Emask 0x1

```

I'm not using Gentoo (using Arch) but was hoping that you can give me any advice on where to look for the issue (was redirected here from Arch's forum)?

How serious is this error? Can I just ignore it (this SSD is being my ROOT drive)?

I tried to run SysLinux on the same machine and didn't notice any error messages from dmesg. I then compared SATA power profiles and in both cases they are max_performance...

I would appreciate your help!

----------

## albright

 *Quote:*   

> How serious is this error? Can I just ignore it (this SSD is being my ROOT drive)? 

 

It's very serious and not ignorable. It will corrupt your SSD's filesystem leading to loss of data,

failed programs and possibly total system failure.

Please ignore what I said about laptop mode tools which is not the real reason for the

problem, which is the switching from min_power to max_performance in SATA power

link management. 

If you are not doing this switching of power modes (and with a desktop, I would doubt

you are) then you should not see *this* particular problem.

My problem stems from bad firmware on some samsung ssds (same errors happen in

windows; see http://forums.lenovo.com/t5/T400-T500-and-newer-T-series/T440s-is-killing-Samsung-840-pro-SSD-s/td-p/1366903).

My workaround is to use medium_power instead of min_power in SATA power management policy.

----------

## loneranger

Thank you for your reply!

I tried to play with power profile changes but that didn't make any effect...I will keep looking:)

Thanks again!

----------

## loneranger

I tested other distributions and found out that Ubuntu 12.04/13.10 (kernels 3.5/3.11.0 respectively) and SystemRescue 4.2 (kernel 3.10.30) don't have this issue with my SSD.

So it looks like there was a kernel change introduced in the recent kernels that is messing with my SSD drive.

From the diff for Ubuntu's kernels for 12.04 and 13.10 I was not able to figure out the change (too many changes). Could you give me a direction which part might be a problem?

I posted a kernel configs below (couldn't find Arch config changes, so posting Ubuntu's):

Ubuntu 13.10: http://kernel.ubuntu.com/~kernel-ppa/configs/saucy/amd64-config.flavour.generic

Ubuntu 14.04: http://kernel.ubuntu.com/~kernel-ppa/configs/trusty/amd64-config.flavour.generic

----------

## Realnot

Hello guys, I have the same problem on my Optiplex 7010 with a Samsung 840 EVO.

```

[    0.000000] Command line: BOOT_IMAGE=/kernel-3.12.13-gentoo root=/dev/sda2 ro libata.force=ncq libata.noacpi=1

[    0.000000] BIOS-e820: [mem 0x00000000d7fb4000-0x00000000d7ffffff] ACPI data

[    0.000000] ACPI: SSDT 00000000d7ffde68 00415 (v01 SataRe SataTabl 00001000 INTL 20091112)

[    0.000000] Kernel command line: BOOT_IMAGE=/kernel-3.12.13-gentoo root=/dev/sda2 ro libata.force=ncq libata.noacpi=1

[    0.000000] Memory: 16322824K/16693824K available (7977K kernel code, 699K rwdata, 2748K rodata, 952K init, 988K bss, 371000K reserved)

[    0.200706] libata version 3.00 loaded.

[    0.524652] ata1: SATA max UDMA/133 abar m2048@0xf7c36000 port 0xf7c36100 irq 41

[    0.524681] ata2: SATA max UDMA/133 abar m2048@0xf7c36000 port 0xf7c36180 irq 41

[    0.524708] ata3: SATA max UDMA/133 abar m2048@0xf7c36000 port 0xf7c36200 irq 41

[    0.524732] ata4: DUMMY

[    0.524741] ata5: DUMMY

[    0.524751] ata6: DUMMY

[    0.829664] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

[    0.829681] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)

[    0.831546] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.831546] ata1.00: ATA-9: Samsung SSD 840 EVO 120GB, EXT0BB0Q, max UDMA/133

[    0.831547] ata1.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    0.831665] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)

[    0.831723] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.831725] ata1.00: configured for UDMA/133

[    0.835570] ata2.00: ATA-8: WDC WD7500BPKX-00HPJT0, 01.01A01, max UDMA/133

[    0.835571] ata2.00: 1465149168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    0.838861] ata3.00: ATAPI: TSSTcorp DVD-ROM SN-108BB, D100, max UDMA/100

[    0.839579] ata2.00: configured for UDMA/133

[    0.841246] ata3.00: configured for UDMA/100

[    0.944268] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)

[    0.947412] Write protecting the kernel read-only data: 12288k

[    2.338542] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)

[   11.095538] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[   11.095710] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[   11.095713] ata1.00: configured for UDMA/133

[   11.097379] ata1: EH complete

[   11.238906] ata2.00: configured for UDMA/133

[   11.238911] ata2: EH complete
```

```

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)

00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)

00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation Q77 Express Chipset LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
```

```

1024+0 records in

1024+0 records out

1073741824 bytes (1.1 GB) copied, 12.2847 s, 87.4 MB/s
```

```

/dev/sda:

 Timing cached reads:   26316 MB in  2.00 seconds = 13172.45 MB/sec

 Timing buffered disk reads: 702 MB in  3.00 seconds = 233.65 MB/sec

```

```

Firmware Version: EXT0BB0Q
```

Here you can see the complete output from smartctl: http://bpaste.net/show/290865/

Here the correct speed for this disk: https://wiki.archlinux.org/index.php/SSD_Benchmarking#SAMSUNG_840_120GB

```

[    0.831546] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.831547] ata1.00: 234441648 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    0.831723] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.835571] ata2.00: 1465149168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[   11.095538] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[   11.095710] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1
```

The NCQ work for the WD Black 750GB on ATA2 and fail on the SSD 840 EVO. Here there is my .config http://bpaste.net/show/290878/

Someone know how to solve this problem? I'm still find a solution...

----------

## snIP3r

hi all!

same problem here. i have two 840 evo's and 2 4tb wd-red's. but ncq does only work with the wd-red's:

```

area52 ~ # dmesg |grep NCQ

[    1.299179] ata3.00: 7814037168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    1.299481] ata4.00: 7814037168 sectors, multi 16: LBA48 NCQ (depth 31/32), AA

[    1.300332] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    1.300455] ata1.00: 234441648 sectors, multi 1: LBA48 NCQ (depth 31/32), AA

[    1.300902] ata2.00: failed to get NCQ Send/Recv Log Emask 0x1

[    1.301027] ata2.00: 234441648 sectors, multi 1: LBA48 NCQ (depth 31/32), AA

[    1.302089] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    1.302315] ata2.00: failed to get NCQ Send/Recv Log Emask 0x1

```

power management seems to be disabled:

```

/sys/class/scsi_host/host1/link_power_management_policy:

max_performance

```

ata1 and ata2 are the 840 evo's and ata3 and ata4 are the wd-red's. does anyone know a way how to activate ncq on the 840 evo?

thx in advance

snIP3r

----------

## 59729

Same problem here

```
lappen@nuc ~ $ dmesg | grep -i failed

[    0.760682] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1

[    0.760974] ata1.00: failed to get NCQ Send/Recv Log Emask 0x1
```

Samsung 840 Evo latest firmware, even used the restoration tool 

```
nuc lappen # hdparm -i /dev/sda

/dev/sda:

 Model=Samsung SSD 840 EVO 120GB, FwRev=EXT0CB6Q, SerialNo=S1D5NSCF384069F

 Config={ Fixed }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0

 BuffType=unknown, BuffSize=unknown, MaxMultSect=1, MultSect=1

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=234441648

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

```

Headless server don't think I have any powermanagement going on

----------

## 59729

https://bugzilla.kernel.org/show_bug.cgi?id=72341

Seems to be a firmware issue for the SSD, either the SSD doesn't support the feuture or it should support but is broken, According to the thread samsung doesn't answer and it's not fixed in the latest firmware so I guess we should not expect any fix from samsung. No idea what it's for

----------

