Skip to contentSkip to conversation

Loud "pop" coming from hard drive on reboot

DISCUSSION Bodo Eggert 13 participants 33 messages Apr 18, 2007 – Apr 23, 2007 8 messages not in the archive libata

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 10 lines · Tejun Heo

This really isn't a regression. It's been always like that with libata.
libata doesn't make devices go into standby mode and shutdown(8) does
it for libata. The problem here is that libata does issue SYNCHRONIZE_CACHE on shutdown. So, the sequence of event is...

1. shutdown(8) issues SYNCHRONIZE_CACHE followed by STANDBY_NOW
2. kernel shutdown starts
3. libata shutdown issues SYNCHRONIZE_CACHE
4. power goes off

Quoted 8 lines

Some drives seem to spin up at step #3 even when its cache is clean and power goes off right after the disk finishes the command. So, it's really bad when it happens - spin down, spin up followed by immediate power off.

SCSI part of the fix is queued in scsi-misc-2.6 tree and libata-dev part is acked and waiting to be merged, so the fix will be available in 2.6.22. However, it's disabled by default to remain compatible with the

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 1 line

current behavior and requires userland change to fully fix the problem.

^^^^^^^^^^^^^^^^
It sounds like the Schilling kind of compatibility: "The old burner destroyed your disk on buffer underruns, therefore the new thing should do the same instead of giving you a perfectly readable data disk."

Guys, not destroying hardware is _NOT_ bad!

Signature · 4 lines
Anger, fear, aggression. The Dark Side of the Force are they.
Once you start down the Dark Path, forever will it dominate your destiny.
        -- Jedi Master Yoda
Friß, Spammer: [email protected]
#9 lore raw
Quoted 11 lines · Bodo Eggert
Quoted 3 lines

SCSI part of the fix is queued in scsi-misc-2.6 tree and libata-dev part is acked and waiting to be merged, so the fix will be available in 2.6.22. However, it's disabled by default to remain compatible with the

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Quoted 1 line

current behavior and requires userland change to fully fix the problem.

^^^^^^^^^^^^^^^^
It sounds like the Schilling kind of compatibility: "The old burner destroyed your disk on buffer underruns, therefore the new thing should do the same instead of giving you a perfectly readable data disk."

Guys, not destroying hardware is _NOT_ bad!

Not that simple. Most disks don't spin up on SYNCHRONIZE_CACHE if its cache is clean. Sadly some disks actually spin up when it receives spin down command while spun down to immediately spin down again, so we would be fixing problem for some number of disks while breaking others. :-(

Signature · 1 line
tejun
#10 lore raw
Quoted 4 lines

Not that simple. Most disks don't spin up on SYNCHRONIZE_CACHE if its cache is clean. Sadly some disks actually spin up when it receives spin down command while spun down to immediately spin down again, so we would be fixing problem for some number of disks while breaking others. :-(

Snoop the last command sent to the drive, that tells you if you can skip the cache flush ?

#11 lore raw
Quoted 4 lines · Alan Cox
Quoted 1 line

Not that simple. Most disks don't spin up on SYNCHRONIZE_CACHE if its cache is clean. Sadly some disks actually spin up when it receives spin down command while spun down to immediately spin down again, so we would be fixing problem for some number of disks while breaking others. :-(

Snoop the last command sent to the drive, that tells you if you can skip the cache flush ?

Thought about that and querying power state before doing shutdown sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown(). We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. Also, I felt very uneasy about faking successful completion to SYNCHRONIZE_CACHE.

I dunno. It's already too late for 2.6.21. I was hoping we could get distros to update shutdown utilities in not-too-distant future but I have no experience with that. Is that just a wishful thinking?

Signature · 1 line
tejun
#12 lore raw
Quoted 10 lines · Tejun Heo
Quoted 4 lines · Alan Cox
Quoted 1 line

Not that simple. Most disks don't spin up on SYNCHRONIZE_CACHE if its cache is clean. Sadly some disks actually spin up when it receives spin down command while spun down to immediately spin down again, so we would be fixing problem for some number of disks while breaking others. :-(

Snoop the last command sent to the drive, that tells you if you can skip the cache flush ?

Thought about that and querying power state before doing shutdown sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown(). We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. Also, I felt very uneasy about faking successful completion to SYNCHRONIZE_CACHE.

I dunno. It's already too late for 2.6.21. I was hoping we could get distros to update shutdown utilities in not-too-distant future but I have no experience with that. Is that just a wishful thinking?

FWIW, the the following message describes the proposed solution.

http://thread.gmane.org/gmane.linux.scsi/30487/focus=17392

Signature · 1 line
tejun
#13 lore raw
In reply to Tejun Heo
Quoted 5 lines

Thought about that and querying power state before doing shutdown sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown(). We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. Also, I felt very uneasy about faking successful completion to SYNCHRONIZE_CACHE.

If you see a synchronize cache succeed and you then see the drive shutdown succeed then you know that a sync cache can be faked as ok safely. Any other command in between or after and it doesn't get faked

This seems pretty easy to deal with at command issue.

Quoted 3 lines

I dunno. It's already too late for 2.6.21. I was hoping we could get distros to update shutdown utilities in not-too-distant future but I have no experience with that. Is that just a wishful thinking?

Probably not, but it will take a year or so and throughout this time period everyone with the wrong combination of shutdown and kernel (which will be a lot of people who compile their own kernels) are going to have problems caused by what is a very obscure piece of libata internal behaviour they'll never even know about.

#14 lore raw
Quoted 7 lines · Alan Cox
Quoted 1 line

Thought about that and querying power state before doing shutdown sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown(). We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. Also, I felt very uneasy about faking successful completion to SYNCHRONIZE_CACHE.

If you see a synchronize cache succeed and you then see the drive shutdown succeed then you know that a sync cache can be faked as ok safely. Any other command in between or after and it doesn't get faked

This seems pretty easy to deal with at command issue.

Yeah, right. I guess I'm too anal about SYNCHRONIZE_CACHE.

Quoted 7 lines
Quoted 1 line

I dunno. It's already too late for 2.6.21. I was hoping we could get distros to update shutdown utilities in not-too-distant future but I have no experience with that. Is that just a wishful thinking?

Probably not, but it will take a year or so and throughout this time period everyone with the wrong combination of shutdown and kernel (which will be a lot of people who compile their own kernels) are going to have problems caused by what is a very obscure piece of libata internal behaviour they'll never even know about.

Okay, will do another round of the patch.

Thanks.

Signature · 1 line
tejun
#15 lore raw
In reply to Alan Cox
Quoted 16 lines · Alan Cox
Quoted 3 lines

Thought about that and querying power state before doing shutdown sequence but things get somewhat ugly because shutdown sequence is driven from sd->shutdown(). We'll have to snoop both sync and shutdown commands and check whether the system is shutting down. Also, I felt very uneasy about faking successful completion to SYNCHRONIZE_CACHE.

If you see a synchronize cache succeed and you then see the drive shutdown succeed then you know that a sync cache can be faked as ok safely. Any other command in between or after and it doesn't get faked

This seems pretty easy to deal with at command issue.

Quoted 3 lines

I dunno. It's already too late for 2.6.21. I was hoping we could get distros to update shutdown utilities in not-too-distant future but I have no experience with that. Is that just a wishful thinking?

Quoted 8 lines

Probably not, but it will take a year or so and throughout this time period everyone with the wrong combination of shutdown and kernel (which will be a lot of people who compile their own kernels) are going to have problems caused by what is a very obscure piece of libata internal behaviour they'll never even know about.

So this is the pop I hear on my new laptop that is using libata=combined_mode when I shut my system down. I didn't get the pop with the same disk drive in an older laptop that was only ide. It sounds like a relay closing or opening, but is really my drive head doing an emergency retract/park?

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
"They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty decreases."  (Thomas Jefferson)
#16 lore raw
Quoted 6 lines · Stephen Clark
Quoted 1 line

So this is the pop I hear on my new laptop that is using libata=combined_mode when I shut my system down. I didn't get the pop with the same disk drive in an older laptop that was only ide. It sounds like a relay closing or opening, but is really my drive head doing an emergency retract/park?

Most(?) disks' heads are spring-/power-based so that whenever they lose power, the spring retracts the head back to the park zone.

Whether it is the disk head or something else.. take out the disk, and retry. Might not be that easy with laptops, though.

Jan

#17 lore raw
Quoted 11 lines · Jan Engelhardt
Quoted 7 lines · Stephen Clark

So this is the pop I hear on my new laptop that is using libata=combined_mode when I shut my system down. I didn't get the pop with the same disk drive in an older laptop that was only ide. It sounds like a relay closing or opening, but is really my drive head doing an emergency retract/park?

Quoted 10 lines

Most(?) disks' heads are spring-/power-based so that whenever they lose power, the spring retracts the head back to the park zone.

Whether it is the disk head or something else.. take out the disk, and retry. Might not be that easy with laptops, though.

Jan

It is definitely the disk drive. It is located in the right front corner of my laptop so I put my ear by it during shutdown and that is where the click is coming from. As I said before I had this same drive in another laptop that was strictly ide so it used the older ide driver and it never did this.

Steve

Signature · 3 lines
"They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty decreases."  (Thomas Jefferson)
#18 lore raw
Quoted 3 lines · Stephen Clark

It is definitely the disk drive. It is located in the right front corner of my laptop so I put my ear by it during shutdown and that is where the click is coming from.

Isn't there also a speaker located there?

#19 lore raw
In reply to Alan Cox
Quoted 6 lines · Alan Cox

If you see a synchronize cache succeed and you then see the drive shutdown succeed then you know that a sync cache can be faked as ok safely. Any other command in between or after and it doesn't get faked

This seems pretty easy to deal with at command issue.

Yup. It could be as trivial as this (untested, and not as nice as Alan's full suggestion).

---

include/linux/libata.h renamed from include/linux/libata.h.orig +0 -0
@@ -499,6 +499,7 @@
	struct ata_ering	ering;
	int			spdn_cnt;
	unsigned int		horkage;	/* List of broken features */
+	int			needs_flush;	/* bool: 1==written since last flush */
#ifdef CONFIG_SATA_ACPI
	/* ACPI objects info */
	acpi_handle obj_handle;
drivers/ata/libata-scsi.c renamed from drivers/old/libata-scsi.c +0 -0
@@ -2749,18 +2749,20 @@
			return atapi_xlat;

	switch (cmd) {

- case READ_6:
- case READ_10:
- case READ_16:
-

	case WRITE_6:
	case WRITE_10:
	case WRITE_16:

+ dev->needs_flush = 1;
+ case READ_6:
+ case READ_10:
+ case READ_16:

		return ata_scsi_rw_xlat;

	case SYNCHRONIZE_CACHE:
-		if (ata_try_flush_cache(dev))
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
			return ata_scsi_flush_xlat;
+			dev->needs_flush = 0;
+		}
		break;

	case VERIFY:
#20 lore raw
Quoted 10 lines · Mark Lord
Quoted 6 lines · Alan Cox

If you see a synchronize cache succeed and you then see the drive shutdown succeed then you know that a sync cache can be faked as ok safely. Any other command in between or after and it doesn't get faked

This seems pretty easy to deal with at command issue.

Yup. It could be as trivial as this (untested, and not as nice as Alan's full suggestion).

Here it is again, without the borked pathnames.

---

include/linux/libata.h +0 -0
@@ -499,6 +499,7 @@
	struct ata_ering	ering;
	int			spdn_cnt;
	unsigned int		horkage;	/* List of broken features */
+	int			needs_flush;	/* bool: 1==written since last flush */
#ifdef CONFIG_SATA_ACPI
	/* ACPI objects info */
	acpi_handle obj_handle;
drivers/ata/libata-scsi.c +0 -0
@@ -2749,18 +2749,20 @@
			return atapi_xlat;

	switch (cmd) {

- case READ_6:
- case READ_10:
- case READ_16:
-

	case WRITE_6:
	case WRITE_10:
	case WRITE_16:

+ dev->needs_flush = 1;
+ case READ_6:
+ case READ_10:
+ case READ_16:

		return ata_scsi_rw_xlat;

	case SYNCHRONIZE_CACHE:
-		if (ata_try_flush_cache(dev))
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
			return ata_scsi_flush_xlat;
+			dev->needs_flush = 0;
+		}
		break;

	case VERIFY:
#21 lore raw
In reply to Mark Lord

Review

Quoted 3 lines
(quoted diff) +2 -0
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
 			return ata_scsi_flush_xlat;
+			dev->needs_flush = 0;

Works better if you swap the dev-> and return lines

Alan

#22 lore raw
Quoted 5 lines · Alan Cox

Review

Quoted 3 lines
(quoted diff) +2 -0
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
 			return ata_scsi_flush_xlat;
+			dev->needs_flush = 0;

Works better if you swap the dev-> and return lines

Heh, yeah, I noticed that!

Here it is, *tested* now, with another fix.

It would be nice if somebody who can hear the "pop" would also test this, as it will confirm that this is a complete fix for the problem. My "pop" drives are busy elsewhere right now.

Tejun might use something like this, or do something better in libata-core, but it's still helpful to have confirmation that we're on the right track.

This patch eliminates the redundant "SYNCHRONIZE_CACHE" request at shutdown which is causing undue wear/tear/alarm to various systems.

---

include/linux/libata.h +0 -0
@@ -499,6 +499,7 @@
	struct ata_ering	ering;
	int			spdn_cnt;
	unsigned int		horkage;	/* List of broken features */
+	int			needs_sync_cache; /* 0==sync-cache not needed */
#ifdef CONFIG_SATA_ACPI
	/* ACPI objects info */
	acpi_handle obj_handle;
drivers/ata/libata-scsi.c +0 -0
@@ -2749,18 +2749,20 @@
			return atapi_xlat;

	switch (cmd) {

- case READ_6:
- case READ_10:
- case READ_16:
-

	case WRITE_6:
	case WRITE_10:
	case WRITE_16:

+ dev->needs_sync_cache = 1;
+ case READ_6:
+ case READ_10:
+ case READ_16:

		return ata_scsi_rw_xlat;

	case SYNCHRONIZE_CACHE:
-		if (ata_try_flush_cache(dev))
+		if (dev->needs_sync_cache && ata_try_flush_cache(dev)) {
+			dev->needs_sync_cache = 0;
			return ata_scsi_flush_xlat;
+		}
		break;

	case VERIFY:

@@ -2769,6 +2771,7 @@

	case ATA_12:
	case ATA_16:
+		dev->needs_sync_cache = 1;
		return ata_scsi_pass_thru;

	case START_STOP:
#23 lore raw
Quoted 5 lines · Mark Lord
Quoted 4 lines · Alan Cox
Quoted 3 lines
(quoted diff) +2 -0
+        if (dev->needs_flush && ata_try_flush_cache(dev)) {
             return ata_scsi_flush_xlat;
+            dev->needs_flush = 0;
Quoted 8 lines
Quoted 1 line

Works better if you swap the dev-> and return lines

Heh, yeah, I noticed that!

Here it is, *tested* now, with another fix.

It would be nice if somebody who can hear the "pop" would also test this, as it will confirm that this is a complete fix for the problem.

You'll probably be able to here the "pop" on sleep-to-disk.

Quoted 4 lines

My "pop" drives are busy elsewhere right now.

Tejun might use something like this, or do something better in libata-core, but it's still helpful to have confirmation that we're on the right track.

Yeap, I was thinking about more conservative check but this looks simple and sweet. :-)

Signature · 1 line
tejun
#24 lore raw
Quoted 8 lines · Tejun Heo

Mark Lord wrote:
..

Quoted 2 lines

It would be nice if somebody who can hear the "pop" would also test this, as it will confirm that this is a complete fix for the problem.

You'll probably be able to here the "pop" on sleep-to-disk.

Quoted 1 line

My "pop" drives are busy elsewhere right now.

The system I do have to test with has a "pop",
but that's from the speakers not the drive.

However, the S.M.A.R.T. data was also shown earlier to provide a record of the unnecessary wear and tear.

Here it is from two hibernates (Linux "suspend-to-disk") before patching:

-  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1711
+  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1712
..
- 12 Power_Cycle_Count       0x0032   099   099   020    Old_age   Always       -       1051
+ 12 Power_Cycle_Count       0x0032   099   099   020    Old_age   Always       -       1053
..
-192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       126
-193 Load_Cycle_Count        0x0032   015   015   000    Old_age   Always       -       170404
+192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       128
+193 Load_Cycle_Count        0x0032   015   015   000    Old_age   Always       -       170405

With the patch applied, I don't see *any* new activity in those S.M.A.R.T. attributes over multiple hibernates (Linux "suspend-to-disk").

Next up, I'll try a few shutdowns and see.

But we should still get Stephen Clark or one of the other reporters to confirm it on their systems.

-ml

#25 lore raw
Quoted 3 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T. attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

       case ATA_16:

+ dev->needs_sync_cache = 1;

Ie. comment out that last "dev->needs_sync_cache" line.

Cheers

#26 lore raw
Quoted 21 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T. attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

       case ATA_16:

+ dev->needs_sync_cache = 1;

Quoted 10 lines

Ie. comment out that last "dev->needs_sync_cache" line.

Cheers
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

No joy - even with that line commented out I get a click and my Power-Off_Retract_Count has incremented.

Steve

Signature · 3 lines
"They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty decreases."  (Thomas Jefferson)
#27 lore raw
Quoted 20 lines · Stephen Clark
Quoted 18 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

Quoted 9 lines
Quoted 6 lines
       case ATA_16:

+ dev->needs_sync_cache = 1;

Ie. comment out that last "dev->needs_sync_cache" line.

No joy - even with that line commented out I get a click and my Power-Off_Retract_Count has incremented.

I found a solution of sorts on Fedora 6:

Edit /etc/rc0.d/S01halt, changing the third-from-last line so it reads:

HALTARGS="-d -h -n"

Then use the halt(8) command to shut down and turn off the power manually. No click and the "retract" counter does not increment. (Even this procedure incremented the counter until I changed the script.)

Seems safe, using the IDE drivers, since they sync the cache anyway.

#28 lore raw
Quoted 47 lines · Chuck Ebbert
Quoted 28 lines · Stephen Clark
Quoted 24 lines · Mark Lord
Quoted 6 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

      case ATA_16:

+ dev->needs_sync_cache = 1;

Quoted 10 lines
Quoted 5 lines

Ie. comment out that last "dev->needs_sync_cache" line.

No joy - even with that line commented out I get a click and my Power-Off_Retract_Count has incremented.

I found a solution of sorts on Fedora 6:

Edit /etc/rc0.d/S01halt, changing the third-from-last line so it reads:

Quoted 11 lines

HALTARGS="-d -h -n"

Then use the halt(8) command to shut down and turn off the power manually. No click and the "retract" counter does not increment. (Even this procedure incremented the counter until I changed the script.)

Seems safe, using the IDE drivers, since they sync the cache anyway.

Hi Chuck,

I got a chance to try this and it works for me also. No pop and my retract counter does not increment.

Steve

Signature · 3 lines
"They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty decreases."  (Thomas Jefferson)
#29 lore raw
In reply to Chuck Ebbert

Bingo!
I switched from ata_piix.c to piix_ide.c and the "pop" disappeared.

I must say that the "pop" also disappeared after suspending to disk using suspend2 (obviously without executing halt -n -h -p) . In both cases it was present with the previous setup.

This is with a pure PATA setup with no SATA ports and the disk is:

hda: TOSHIBA MK8025GAS, ATA DISK drive

Many thanks!
regards,
Fabio

Quoted 50 lines · Chuck Ebbert
Quoted 20 lines · Stephen Clark
Quoted 18 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

Quoted 9 lines
Quoted 6 lines
       case ATA_16:

+ dev->needs_sync_cache = 1;

Ie. comment out that last "dev->needs_sync_cache" line.

No joy - even with that line commented out I get a click and my Power-Off_Retract_Count has incremented.

I found a solution of sorts on Fedora 6:

Edit /etc/rc0.d/S01halt, changing the third-from-last line so it reads:

HALTARGS="-d -h -n"

Then use the halt(8) command to shut down and turn off the power manually. No click and the "retract" counter does not increment. (Even this procedure incremented the counter until I changed the script.)

Seems safe, using the IDE drivers, since they sync the cache anyway.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#30 lore raw

So, removing -d halt option solves this problem?

2007/4/20, Fabio Comolli <[email protected]>:

Quoted 70 lines

Bingo!
I switched from ata_piix.c to piix_ide.c and the "pop" disappeared.

I must say that the "pop" also disappeared after suspending to disk using suspend2 (obviously without executing halt -n -h -p) . In both cases it was present with the previous setup.

This is with a pure PATA setup with no SATA ports and the disk is:

hda: TOSHIBA MK8025GAS, ATA DISK drive

Many thanks!
regards,
Fabio

Quoted 50 lines · Chuck Ebbert
Quoted 20 lines · Stephen Clark
Quoted 18 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Now I'll poke at the shutdown again.

Meanwhile, Stephen: Could you try without this line in the patched file:

Quoted 9 lines
Quoted 6 lines
       case ATA_16:

+ dev->needs_sync_cache = 1;

Ie. comment out that last "dev->needs_sync_cache" line.

No joy - even with that line commented out I get a click and my Power-Off_Retract_Count has incremented.

I found a solution of sorts on Fedora 6:

Edit /etc/rc0.d/S01halt, changing the third-from-last line so it reads:

HALTARGS="-d -h -n"

Then use the halt(8) command to shut down and turn off the power manually. No click and the "retract" counter does not increment. (Even this procedure incremented the counter until I changed the script.)

Seems safe, using the IDE drivers, since they sync the cache anyway.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#31 lore raw

Hi.

Quoted 2 lines · emisca

So, removing -d halt option solves this problem?

According to the halt manpage, -n implies -d (in other words, -d is not removed at all).
Regards,
Fabio

#33 lore raw

Jan,
mine does not pop running Linux but only during the shutdown. As I wrote before, switching from PATA to IDE has solved the problem for me.
Regards,
Fabio

Quoted 13 lines · Jan Engelhardt
Quoted 4 lines · Fabio Comolli

hda: TOSHIBA MK8025GAS, ATA DISK drive

MK...? These sort of disks do that stupid pop. Mine -- a MK2003GAH -- does it even while running Linux, if the disk is _idle_.
See http://lkml.org/lkml/2006/11/15/413 - hope it provides some pointers.

Regards,
Jan
--

#34 lore raw
In reply to Mark Lord
Quoted 6 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Quoted 6 lines

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Just to add to the fun, my problems are happening with the "old" IDE drivers...

#35 lore raw
Quoted 10 lines · Chuck Ebbert
Quoted 9 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

Quoted 6 lines
Quoted 3 lines

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Just to add to the fun, my problems are happening with the "old" IDE drivers...

The issue you are experiencing results in the same problem (disk doing power off retract) but it has a totally different root cause - your notebook loses power on reboot. It is actually a hardware problem and as you have reported the same problem is present when using "the other" OS.

I think that the issue needs to be fixed (by detecting affected notebook(s) using DMI?) in Linux PM handling and not in IDE subsystem because:

* there may be some other hardware devices affected by the power loss (== they require shutdown sequence)

* the same problem will bite if somebody decides to use libata (FC7?)

Bart

#36 lore raw
Quoted 27 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Chuck Ebbert
Quoted 9 lines · Mark Lord
Quoted 4 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

Quoted 6 lines
Quoted 3 lines

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Just to add to the fun, my problems are happening with the "old" IDE drivers...

The issue you are experiencing results in the same problem (disk doing power off retract) but it has a totally different root cause - your notebook loses power on reboot. It is actually a hardware problem and as you have reported the same problem is present when using "the other" OS.

I think that the issue needs to be fixed (by detecting affected notebook(s) using DMI?) in Linux PM handling and not in IDE subsystem because:

Quoted 6 lines

* there may be some other hardware devices affected by the power loss (== they require shutdown sequence)

* the same problem will bite if somebody decides to use libata (FC7?)

Bart

OpenSUSE 10.3 is still in Alpha stage (at least a few months away from release), but they too have switched to libata by default. (You can override by adding a boot param).

Greg

Signature · 3 lines
Greg Freemyer
The Norcross Group
Forensics for the 21st Century
#37 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 12 lines · Bartlomiej Zolnierkiewicz
Quoted 11 lines · Chuck Ebbert
Quoted 10 lines · Mark Lord
Quoted 3 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Quoted 8 lines
Quoted 2 lines

Just to add to the fun, my problems are happening with the "old" IDE drivers...

The issue you are experiencing results in the same problem (disk doing power off retract) but it has a totally different root cause - your notebook loses power on reboot. It is actually a hardware problem and as you have reported the same problem is present when using "the other" OS.

My "power off retract count" increases whether I do a halt/poweroff or a reboot. The only difference is the volume of the noise.

And I just noticed my "seek error rate" is increasing.

/me plans purchase of another drive, definitely not Seagate...

Quoted 7 lines

I think that the issue needs to be fixed (by detecting affected notebook(s) using DMI?) in Linux PM handling and not in IDE subsystem because:

* there may be some other hardware devices affected by the power loss (== they require shutdown sequence)

* the same problem will bite if somebody decides to use libata (FC7?)

Yeah, this needs fixing too. I've been playing with another notebook and the power does stay on during reboot, so I wonder how widespread the problem is?

#38 lore raw
Quoted 32 lines · Chuck Ebbert
Quoted 12 lines · Bartlomiej Zolnierkiewicz
Quoted 11 lines · Chuck Ebbert
Quoted 10 lines · Mark Lord
Quoted 3 lines · Mark Lord

With the patch applied, I don't see *any* new activity in those S.M.A.R.T.
attributes over multiple hibernates (Linux "suspend-to-disk").

Scratch that -- operator failure. ;)
The patch makes no difference over hibernates in the SMART logs.

It's still logging extra Power-Off_Retract_Count pegs, which it DID NOT USED TO DO not so long ago.

Quoted 8 lines
Quoted 2 lines

Just to add to the fun, my problems are happening with the "old" IDE drivers...

The issue you are experiencing results in the same problem (disk doing power off retract) but it has a totally different root cause - your notebook loses power on reboot. It is actually a hardware problem and as you have reported the same problem is present when using "the other" OS.

My "power off retract count" increases whether I do a halt/poweroff or a reboot. The only difference is the volume of the noise.

And I just noticed my "seek error rate" is increasing.

/me plans purchase of another drive, definitely not Seagate...

Quoted 3 lines

I think that the issue needs to be fixed (by detecting affected notebook(s) using DMI?) in Linux PM handling and not in IDE subsystem because:

Quoted 7 lines
Quoted 4 lines

* there may be some other hardware devices affected by the power loss (== they require shutdown sequence)

* the same problem will bite if somebody decides to use libata (FC7?)

Yeah, this needs fixing too. I've been playing with another notebook and the power does stay on during reboot, so I wonder how widespread the problem is?

/me too

Thinkpad T23, with a ST980815A

Ticks ever few seconds, but seems to mostly go away with
hdparm -B255 /dev/sda1

but I have an increasing seek error rate as well. I got the ST disk because thinkwiki suggested it.

I suspect this problem killed the previous disk in this laptop.

#39 lore raw
Quoted 4 lines · Peter Zijlstra

but I have an increasing seek error rate as well. I got the ST disk because thinkwiki suggested it.

Apparently Seagate has their own definition of seek error rate. Large numbers are normal, or at least very common.

Now I wonder if they have their own way of doing retract count...

#40 lore raw
In reply to Mark Lord
Quoted 75 lines · Mark Lord
Quoted 8 lines · Alan Cox

Review

Quoted 5 lines
(quoted diff) +1 -0
+		if (dev->needs_flush && ata_try_flush_cache(dev)) {
			return ata_scsi_flush_xlat;
(quoted diff) +1 -0
+			dev->needs_flush = 0;

Works better if you swap the dev-> and return lines

Heh, yeah, I noticed that!

Here it is, *tested* now, with another fix.

It would be nice if somebody who can hear the "pop" would also test this, as it will confirm that this is a complete fix for the problem. My "pop" drives are busy elsewhere right now.

Tejun might use something like this, or do something better in libata-core, but it's still helpful to have confirmation that we're on the right track.

This patch eliminates the redundant "SYNCHRONIZE_CACHE" request at shutdown which is causing undue wear/tear/alarm to various systems.

---

include/linux/libata.h +1 -0
@@ -499,6 +499,7 @@
 	struct ata_ering	ering;
 	int			spdn_cnt;
 	unsigned int		horkage;	/* List of broken features */
+	int			needs_sync_cache; /* 0==sync-cache not needed */
 #ifdef CONFIG_SATA_ACPI
 	/* ACPI objects info */
 	acpi_handle obj_handle;
drivers/ata/libata-scsi.c +8 -6
@@ -2749,18 +2749,20 @@
 			return atapi_xlat;
 
 	switch (cmd) {
-	case READ_6:
-	case READ_10:
-	case READ_16:
-
 	case WRITE_6:
 	case WRITE_10:
 	case WRITE_16:
+		dev->needs_sync_cache = 1;
+	case READ_6:
+	case READ_10:
+	case READ_16:
 		return ata_scsi_rw_xlat;
 
 	case SYNCHRONIZE_CACHE:
-		if (ata_try_flush_cache(dev))
+		if (dev->needs_sync_cache && ata_try_flush_cache(dev)) {
+			dev->needs_sync_cache = 0;
 			return ata_scsi_flush_xlat;
+		}
 		break;
 
 	case VERIFY:
@@ -2769,6 +2771,7 @@
 
 	case ATA_12:
 	case ATA_16:
+		dev->needs_sync_cache = 1;
 		return ata_scsi_pass_thru;
 
 	case START_STOP:
-
Quoted 6 lines

To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

I tried this on 2.6.20.2 it applied to libata with some fuzz and I had to manually edit libata.h When I did a shutdown I still got the click/pop.

I also noticed the last thing displayed on the lcd before it goes blank is Synchronizing SCSI Disks - then the click/pop.

HTH,
Steve

Signature · 3 lines
"They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety."  (Ben Franklin)

"The course of history shows that as a government grows, liberty decreases."  (Thomas Jefferson)