2007-06-01 21:42:00

by David Greaves

[permalink] [raw]
Subject: 2.6.22-rc3 hibernate(?) disables SMART on ide

I have 2 ide disks. If I enable SMART and hibernate/suspend2disk, SMART is
disabled when I resume.

Same as in 2.6.21.1

cu:~# smartctl -son /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

cu:~# /usr/net/bin/hibernate
[poweron resume here]
cu:~# smartctl -a /dev/hda
smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda ATA II family
Device Model: ST320420A
Serial Number: 3CL04RKY
Firmware Version: 3.21
User Capacity: 20,404,101,120 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 4
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Fri Jun 1 22:37:15 2007 BST
SMART support is: Available - device has SMART capability.
SMART support is: Disabled

SMART Disabled. Use option -s with argument 'on' to enable it.

here's some syslog


Jun 1 21:56:25 cu kernel: Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
Jun 1 21:56:25 cu kernel: ide: Assuming 33MHz system bus speed for PIO modes;
override with idebus=xx
Jun 1 21:56:25 cu kernel: VP_IDE: IDE controller at PCI slot 0000:00:0f.1
Jun 1 21:56:25 cu kernel: ACPI: PCI Interrupt 0000:00:0f.1[A] -> GSI 20 (level,
low) -> IRQ 16
Jun 1 21:56:25 cu kernel: VP_IDE: chipset revision 6
Jun 1 21:56:25 cu kernel: VP_IDE: not 100%% native mode: will probe irqs later
Jun 1 21:56:25 cu kernel: VP_IDE: VIA vt8237 (rev 00) IDE UDMA133 controller on
pci0000:00:0f.1
Jun 1 21:56:25 cu kernel: ide0: BM-DMA at 0x9000-0x9007, BIOS settings:
hda:DMA, hdb:DMA
Jun 1 21:56:25 cu kernel: ide1: BM-DMA at 0x9008-0x900f, BIOS settings:
hdc:pio, hdd:DMA
Jun 1 21:56:25 cu kernel: Probing IDE interface ide0...
Jun 1 21:56:25 cu kernel: Switched to high resolution mode on CPU 0
Jun 1 21:56:25 cu kernel: hda: ST320420A, ATA DISK drive
Jun 1 21:56:25 cu kernel: hdb: Maxtor 5A300J0, ATA DISK drive
Jun 1 21:56:25 cu kernel: ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Jun 1 21:56:25 cu kernel: Probing IDE interface ide1...
Jun 1 21:56:25 cu kernel: hdd: PLEXTOR CD-R PX-W2410A, ATAPI CD/DVD-ROM drive
Jun 1 21:56:25 cu kernel: ide1 at 0x170-0x177,0x376 on irq 15
Jun 1 21:56:25 cu kernel: hda: max request size: 128KiB
Jun 1 21:56:25 cu kernel: hda: 39851760 sectors (20404 MB) w/2048KiB Cache,
CHS=39535/16/63, UDMA(66)
Jun 1 21:56:25 cu kernel: hda: cache flushes not supported
Jun 1 21:56:25 cu kernel: hda: hda1 hda2 hda3
Jun 1 21:56:25 cu kernel: hdb: max request size: 512KiB
Jun 1 21:56:25 cu kernel: hdb: 585940320 sectors (300001 MB) w/2048KiB Cache,
CHS=36473/255/63, UDMA(133)
Jun 1 21:56:25 cu kernel: hdb: cache flushes supported
Jun 1 21:56:25 cu kernel: hdb: hdb1 hdb2

anything else needed?

David


2007-06-02 11:39:44

by Tejun Heo

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

David Greaves wrote:
> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk, SMART is
> disabled when I resume.
>
> Same as in 2.6.21.1
>
> cu:~# smartctl -son /dev/hda
> smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
> Home page is http://smartmontools.sourceforge.net/
>
> === START OF ENABLE/DISABLE COMMANDS SECTION ===
> SMART Enabled.
>
> cu:~# /usr/net/bin/hibernate
> [poweron resume here]
> cu:~# smartctl -a /dev/hda
> smartctl version 5.36 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce Allen
> Home page is http://smartmontools.sourceforge.net/
>
> === START OF INFORMATION SECTION ===
> Model Family: Seagate Barracuda ATA II family
> Device Model: ST320420A
> Serial Number: 3CL04RKY
> Firmware Version: 3.21
> User Capacity: 20,404,101,120 bytes
> Device is: In smartctl database [for details use: -P show]
> ATA Version is: 4
> ATA Standard is: Exact ATA specification draft version not indicated
> Local Time is: Fri Jun 1 22:37:15 2007 BST
> SMART support is: Available - device has SMART capability.
> SMART support is: Disabled
>
> SMART Disabled. Use option -s with argument 'on' to enable it.

According to the ATA standard, the device (drive) itself is responsible
for preserving SMART enabled status over power cycles. It seems your
drive doesn't wanna do that. I don't think mangling with SMART setup in
the kernel is wise thing to do. Bruce, any ideas? Maybe hook smartd
such that it gets suspend/resume events?

Thanks.

--
tejun

2007-06-02 21:28:00

by Bodo Eggert

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

Tejun Heo <[email protected]> wrote:
> David Greaves wrote:

>> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk, SMART is
>> disabled when I resume.

<snip>

Maybe it's disabled by the BIOS?

> According to the ATA standard, the device (drive) itself is responsible
> for preserving SMART enabled status over power cycles. It seems your
> drive doesn't wanna do that. I don't think mangling with SMART setup in
> the kernel is wise thing to do. Bruce, any ideas? Maybe hook smartd
> such that it gets suspend/resume events?

1) Enabling smart is a single command
2) The command should not fail, and if it fails, it's probably because
it's not supported. There is nothing userspace can do better or worse.
3) There should be no bad effect from enabling smart, except if the BIOS
insists on not booting because of a bad RAID disk. (That's why I like
to disable it in the BIOS)
4) Not enabling smart is a common failure in many setups. Usurally the admin
will have to enumerate the attached disks and patch the smartctl startup
scripts.
5) Sometimes there is no smartd (or udev) running, and you'll still not want
to re-enable smart each time you suspend.
6) A simple udev rule or smartd hook should be bigger than the code required
in-kernel.

Therefore I suggest setting the smart-enabled-bit in the kernel, in spite of
not being the kernel's duty. It would be a 99,99% DTRT.

OTOH: What would happen if the drive's command queue is full?
What happens for DMA handling (can we hitch-hike)?
Is it possible to just enqueue "enable_smart($DEV)"?

--
Top 100 things you don't want the sysadmin to say:
48. Tell me again what that '-r' option to rm does

Fri?, Spammer: [email protected] [email protected]

2007-06-02 21:53:26

by David Greaves

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

Tejun Heo wrote:
> David Greaves wrote:
>> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk, SMART is
>> disabled when I resume.
>>
>> Same as in 2.6.21.1
>
> According to the ATA standard, the device (drive) itself is responsible
> for preserving SMART enabled status over power cycles. It seems your
> drive doesn't wanna do that. I don't think mangling with SMART setup in
> the kernel is wise thing to do. Bruce, any ideas? Maybe hook smartd
> such that it gets suspend/resume events?

Sorry, FYI, I made the same mistake as when I reported the wol problem - I was
booting 2.6.21.1.

I am having problems with 2.6.22-rc3 but when it does suspend/resume I can
confirm that the problem is still there (of course).

However your comments still stand.

One unpleasant side effect is that I get

hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hda: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xb0
hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hda: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xb0
...
and
hdb: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdb: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xb0
hdb: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdb: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xb0
...

when the system comes back (induced from smartd I guess) until I do a:
smartctl -son

David

2007-06-02 22:18:44

by Jeff Garzik

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

Bodo Eggert wrote:
> Therefore I suggest setting the smart-enabled-bit in the kernel, in spite of
> not being the kernel's duty. It would be a 99,99% DTRT.

NAK. That's hardcoding policy in the kernel.

Jeff


2007-06-04 12:47:59

by Alan

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

> 3) There should be no bad effect from enabling smart, except if the BIOS
> insists on not booting because of a bad RAID disk. (That's why I like
> to disable it in the BIOS)

With a couple of exceptions unfortunately. Belongs in udev and smartd so
its controllable and flexible (and also swappable).

Alan

2007-06-04 16:29:36

by Mark Lord

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

David Greaves wrote:
> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk, SMART is
> disabled when I resume.

Just a thought: This *may* be fixable at the drive, with "hdparm -K1".

Cheers

2007-06-04 17:23:17

by David Greaves

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

Mark Lord wrote:
> David Greaves wrote:
>> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk,
>> SMART is
>> disabled when I resume.
>
> Just a thought: This *may* be fixable at the drive, with "hdparm -K1".

Thanks Mark, good idea.
Just tried and it didn't help though :(

in fact, hda gave
cu:~# hdparm -K1 /dev/hda

/dev/hda:
setting drive keep features to 1 (on)
HDIO_DRIVE_CMD(keepsettings) failed: Input/output error

and in dmesg:
hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hda: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xef

The drive, FWIW, is:
=== START OF INFORMATION SECTION ===
Model Family: Seagate Barracuda ATA II family
Device Model: ST320420A
Serial Number: 3CL04RKY
Firmware Version: 3.21
User Capacity: 20,404,101,120 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 4
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Mon Jun 4 18:20:46 2007 BST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled


David

2007-06-05 04:18:16

by Mark Lord

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

David Greaves wrote:
> Mark Lord wrote:
>> David Greaves wrote:
>>> I have 2 ide disks. If I enable SMART and hibernate/suspend2disk,
>>> SMART is
>>> disabled when I resume.
>> Just a thought: This *may* be fixable at the drive, with "hdparm -K1".
>
> Thanks Mark, good idea.
> Just tried and it didn't help though :(
>
> in fact, hda gave
> cu:~# hdparm -K1 /dev/hda
>
> /dev/hda:
> setting drive keep features to 1 (on)
> HDIO_DRIVE_CMD(keepsettings) failed: Input/output error
>
> and in dmesg:
> hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
> hda: drive_cmd: error=0x04 { DriveStatusError }
> ide: failed opcode was: 0xef

That's odd. Could you try that again,
with the latest (either v7.3 or v7.4) version of hdparm
(from sourceforge) ?

2007-06-05 09:04:14

by David Greaves

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

Mark Lord wrote:
> That's odd. Could you try that again,
> with the latest (either v7.3 or v7.4) version of hdparm
> (from sourceforge) ?

Using Debian's 7.3 via apt-get experimental - is that OK or would you like me to
compile the upstream?

2.6.21.1

cu:~# hdparm -V
hdparm v7.3
cu:~# hdparm -K1 /dev/hda

/dev/hda:
setting drive keep features to 1 (on)
HDIO_DRIVE_CMD(keepsettings) failed: Input/output error

dmesg:
skge eth0: Link is up at 1000 Mbps, full duplex, flow control both
hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hda: drive_cmd: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xef

David

2007-06-05 15:33:41

by Mark Lord

[permalink] [raw]
Subject: Re: 2.6.22-rc3 hibernate(?) disables SMART on ide

David Greaves wrote:
> Mark Lord wrote:
>> That's odd. Could you try that again,
>> with the latest (either v7.3 or v7.4) version of hdparm
>> (from sourceforge) ?
>
> Using Debian's 7.3 via apt-get experimental - is that OK or would you like me to
> compile the upstream?

No, what you have is good, thanks.

> cu:~# hdparm -K1 /dev/hda
>
> /dev/hda:
> setting drive keep features to 1 (on)
> HDIO_DRIVE_CMD(keepsettings) failed: Input/output error
>
> dmesg:
> skge eth0: Link is up at 1000 Mbps, full duplex, flow control both
> hda: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
> hda: drive_cmd: error=0x04 { DriveStatusError }
> ide: failed opcode was: 0xef

I just find it odd that the drive rejects the command,
but Seagate do seem to be the first to drop older features nowadays.
But I thought their PATA units might have kept that functionality.

I have some modern seagate SATA drives here -- I'll try it on those too,
just for my own education.

Thanks.