AHCI powersaving issue

Jeremy Chadwick freebsd at jdc.parodius.com
Wed Jan 25 22:07:18 UTC 2012


On Wed, Jan 25, 2012 at 07:23:36PM +0400, Michael BlackHeart wrote:
> Hello, I've a trouble with new achi driver on currently 9 release, but
> it was the same on 8-stable. I've have an:
> 
> smartctl -a /dev/ada0
> 
> === START OF INFORMATION SECTION ===
> Model Family:     Western Digital Scorpio Blue Serial ATA
> Device Model:     WDC WD3200BEVT-22A23T0
> Serial Number:    WD-WXL1AB086780
> 
> And there's an idle state disabled by wdidle3 v1.05.
> 
> But it constantly goes to power saving mode. I can see it 'cos I'm
> hearing a sound of spinning up HDD and SMART param 193
> Load_Cycle_Count rises VERY frequently, something insane about one per
> few minutes.
> 
> This thing solves the problem: camcontrol cmd ada0 -a "EF 85 00 00 00
> 00 00 00 00 00 00 00" and everything goes fine from that moment.
> 
> Output with disabled APM.
> camcontrol identify ada0
> pass0: <WDC WD3200BEVT-22A23T0 01.01A01> ATA-8 SATA 2.x device
> pass0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)
> 
> protocol              ATA/ATAPI-8 SATA 2.x
> device model          WDC WD3200BEVT-22A23T0
> firmware revision     01.01A01
> serial number         WD-WXL1AB086780
> WWN                   50014ee6565acc41
> cylinders             16383
> heads                 16
> sectors/track         63
> sector size           logical 512, physical 512, offset 0
> LBA supported         268435455 sectors
> LBA48 supported       625142448 sectors
> PIO supported         PIO4
> DMA supported         WDMA2 UDMA6
> media RPM             5400
> 
> Feature                      Support  Enabled   Value           Vendor
> read ahead                     yes      yes
> write cache                    yes      yes
> flush cache                    yes      yes
> overlap                        no
> Tagged Command Queuing (TCQ)   no       no
> Native Command Queuing (NCQ)   yes              32 tags
> SMART                          yes      yes
> microcode download             yes      yes
> security                       yes      no
> power management               yes      yes
> advanced power management      yes      no      254/0xFE
> automatic acoustic management  yes      no      254/0xFE        128/0x80
> media status notification      no       no
> power-up in Standby            no       no
> write-read-verify              no       no
> unload                         yes      yes
> free-fall                      no       no
> data set management (TRIM)     no
>
> And finally i've got in /boot/loader.conf:
> hint.ahcich.0.pm_level=0
> 
> I'd like to know how to permanently disable this APM mode because it's
> killing my HDD.

This "problem" has been reported to the list before, on other models of
drives (some models of WD Green drives, for example).  The drive is
excessively parking its heads based upon what Western Digital
implemented in their firmware.

Western Digital goes over this in detail in a FAQ entry, except they go
completely bonkers and start blaming Linux syslogd and other nonsensical
things (that is to say: I understand what they're getting at, they're
saying that syslogd is causing the drive to spin up when it attempts to
write data to log files -- so what?  This is normal.  Any kind of write
I/O would do this, not just syslogd); it seems their explanation tries to
divert from the truth, which is that the drives are aggressively parking
heads.  FAQ entries:

http://wdc.custhelp.com/app/answers/detail/a_id/5357/
http://wdc.custhelp.com/app/answers/detail/a_id/3263/

You will find in these FAQs that alternately you can use "a utility" to
try and work around this issue by setting the value to the maximum
duration (not disable, but maximum duration).  I doubt this works, as I
believe it just sets the IDLE or STANDBY timers to their maximum value
(keep reading).

You should be aware that the WDIDLE3 utility does not work on some
models of drives, and is known (in very rare/odd cases) to break drives
permanently.  Given that WD in their FAQs haven't mentioned support of
the Scorpio Blue (this is a 2.5" laptop drive and intended for such
environments), I would not have run this utility.

The "cryptic command" you mention:
camcontrol cmd ada0 -a "EF 85 00 00 00 00 00 00 00 00 00 00"

Issues ATA command 0xEF (SET FEATURES), with subcommand 0x85.
Subcommand 0x85 is defined per ATA8-ACS revision 4a as:

"Subcommand code 85h disables Advanced Power Management. Subcommand 85h
may not be implemented on all devices that implement SET FEATURES
subcommand 05h."

The last part of the sentence I wanted folks to see, since the behaviour
varies from drive to drive, vendor to vendor, firmware to firmware.  I
realise 0x85 works for you, but since this is an archived mailing
list...

Anyway, continuing:

There does not appear to be a way using camcontrol, aside from the
"cryptic command", to disable APM on an ATA device.

Readers are very likely to point out the idle/standby commands of
camcontrol, but those issue IDLE_IMMEDIATE (0xe1) and STANDBY_IMMEDIATE
(0xe0).  Readers are also likely to point out that "these commands
support timers (-t)".  Use of -t causes the utility to, respectively,
issue IDLE (0xe3) and STANDBY (0xe2) commands instead.  The timer value
is passed directly to the drive itself (yes, the timer stuff is truly
ATA-level).

None of these will disable drive APM.  Per above spec, section 4.5,
"Advanced Power Management is independent of the Standby timer setting".

As for your /boot/loader.conf setting of:
hint.ahcich.0.pm_level=0

This has absolutely nothing to do with drive-level APM.  This controls
whether or not you want your AHCI controller to honour power management
capability at the *controller* level.  It has nothing to do with disks.
You should remove this setting.

So how do you solve this problem?

At this present time the best choice would be to drop a simple script
into /usr/local/etc/rc.d that issues the "cryptic command".

Yes, camcontrol could be extended to support a command like "camcontrol
setfeature disable-apm /dev/XXX", but someone would need to write the
code.

I could implement this , except in the case of SET FEATURES, FreeBSD is
missing proper definitions for the subcommand values in
src/sys/sys/ata.h (for example 0x85 is not there).  This makes it more
difficult to provide a simple userland patch/diff, and instead requires
both userland and kernel (include files) tinkering.  You can see the
list of commands in that .h file, look around line 347 (all the indented
entries after #define ATA_SETFEATURES).  We should really go through
that file and make it match the ATA8-ACS spec as best as possible.

-- 
| Jeremy Chadwick                                 jdc at parodius.com |
| Parodius Networking                     http://www.parodius.com/ |
| UNIX Systems Administrator                 Mountain View, CA, US |
| Making life hard for others since 1977.             PGP 4BD6C0CB |



More information about the freebsd-stable mailing list