Skip to contentSkip to conversation

ata_piix resume from S3 on T43P failed

DISCUSSION zhao, forrest 4 participants 17 messages May 11, 2006 – May 22, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi, Tejun

We just tested your git tree on thinkpad T43P laptop, and found that after ata_piix resumed from S3, SATA disk can't be read/write anymore. But according to the test result of kernel 2.6.16-rc6 on T43P, ata_piix can resume from S3 successfully.

We know that this problem may be not related to your patches, but I think you know the libata development status very well, maybe you can give us some clue about what happened to ata_piix between 2.6.16-rc6 and your git tree.

Thanks,
Forrest

#1 lore raw
Quoted 7 lines · forrest

Hi, Tejun

We just tested your git tree on thinkpad T43P laptop, and found that after ata_piix resumed from S3, SATA disk can't be read/write anymore. But according to the test result of kernel 2.6.16-rc6 on T43P, ata_piix can resume from S3 successfully.

Quoted 5 lines

We know that this problem may be not related to your patches, but I think you know the libata development status very well, maybe you can give us some clue about what happened to ata_piix between 2.6.16-rc6 and your git tree.

Hello, Zhao.

I haven't really followed AHCI suspend/resume stuff but AFAICT it never made to #upstream. I don't know whether it was included in -rc# or not.
But it sounds like it did.

One thing to note about suspend/resume is they should be handled from EH. IIRC, they weren't synchronized properly with the rest of libata. Maybe it can be another ATA_EH action or maybe it needs separate handling but at any rate it should be handled as part of EH to be synchronized properly. I'm planning to work on suspend/resume once the currently pending changes settle down. I thought about including them in this round but the changes were HUGE as they were, so decided to defer it.

Signature · 1 line
tejun
#2 lore raw
Quoted 20 lines · Tejun Heo
Quoted 7 lines · forrest

Hi, Tejun

We just tested your git tree on thinkpad T43P laptop, and found that after ata_piix resumed from S3, SATA disk can't be read/write anymore. But according to the test result of kernel 2.6.16-rc6 on T43P, ata_piix can resume from S3 successfully.

Quoted 5 lines

We know that this problem may be not related to your patches, but I think you know the libata development status very well, maybe you can give us some clue about what happened to ata_piix between 2.6.16-rc6 and your git tree.

Hello, Zhao.

I haven't really followed AHCI suspend/resume stuff but AFAICT it never made to #upstream. I don't know whether it was included in -rc# or not.
But it sounds like it did.

Quoted 9 lines

One thing to note about suspend/resume is they should be handled from EH. IIRC, they weren't synchronized properly with the rest of libata. Maybe it can be another ATA_EH action or maybe it needs separate handling but at any rate it should be handled as part of EH to be synchronized properly. I'm planning to work on suspend/resume once the currently pending changes settle down. I thought about including them in this round but the changes were HUGE as they were, so decided to defer it.

Oops, you were talking about ata_piix and I answered about ahci. Sorry about that. :(

Can you please post dmesg w/ ATA_DEBUG turne on? I might have screwed up while updating suspend/resume functions.

Signature · 1 line
tejun
#3 lore raw
Quoted 7 lines · Tejun Heo

Tejun Heo wrote:
Oops, you were talking about ata_piix and I answered about ahci. Sorry about that. :(

Can you please post dmesg w/ ATA_DEBUG turne on? I might have screwed up while updating suspend/resume functions.

Tejun,

The case is very tricky. When ata_piix resumed from S3, dmesg can't be outputted, when I type "dmesg" in console, it prompts:
-bash: /bin/dmesg: Input/output error

Is there any other way to collect the log?

Thanks,
Forrest

#4 lore raw
Quoted 9 lines · forrest
Quoted 7 lines · Tejun Heo

Tejun Heo wrote:
Oops, you were talking about ata_piix and I answered about ahci. Sorry about that. :(

Can you please post dmesg w/ ATA_DEBUG turne on? I might have screwed up while updating suspend/resume functions.

Quoted 8 lines

Tejun,

The case is very tricky. When ata_piix resumed from S3, dmesg can't be outputted, when I type "dmesg" in console, it prompts:
-bash: /bin/dmesg: Input/output error

Is there any other way to collect the log?

Ahh.... right. Unfortunately, I don't have much experience with suspending/resuming and don't really know what to do. Can you try the current #upstream and see how that works? So that we can see whether the EH changes caused the problem?

Signature · 1 line
tejun
#5 lore raw
Quoted 3 lines · Tejun Heo

Can you try the
current #upstream and see how that works? So that we can see whether the EH changes caused the problem?

I tried the #upstream, the ata_piix of which can't resume from S3 on T43P either. So the code changes between 2.6.16-rc6 and #upstream caused the problem. I'll post the dmesg in the following mails.

Thanks,
Forrest

#6 lore raw
In reply to zhao, forrest
Quoted 9 lines · forrest
Quoted 7 lines · Tejun Heo

Tejun Heo wrote:
Oops, you were talking about ata_piix and I answered about ahci. Sorry about that. :(

Can you please post dmesg w/ ATA_DEBUG turne on? I might have screwed up while updating suspend/resume functions.

Quoted 7 lines

Tejun,

The case is very tricky. When ata_piix resumed from S3, dmesg can't be outputted, when I type "dmesg" in console, it prompts:
-bash: /bin/dmesg: Input/output error

Is there any other way to collect the log?

run dmesg prior to suspending, then it'll be cached and can be run after resume even if the disk doesn't want to talk to you.

Signature · 1 line
Jens Axboe
#8 lore raw
Quoted 8 lines · forrest
Quoted 3 lines · Jens Axboe

run dmesg prior to suspending, then it'll be cached and can be run after resume even if the disk doesn't want to talk to you.

Don't know why the mails with attached files were not sent to mailing list, so I put them at
http://www.infradead.org/~forrest/suspend-resume-dmesg/

The key is the 0xef timeout, then the device is offlined and you see a lot of io errors due to that.

Try this:

drivers/scsi/libata-core.c +1 -0
index bd14720..f120839 100644
@@ -4288,6 +4288,7 @@ int ata_device_resume(struct ata_port *a
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
+		mdelay(2000);
 		ata_set_mode(ap);
 	}
 	if (!ata_dev_present(dev))
Signature · 1 line
Jens Axboe
#9 lore raw

Hello, Zhao, Jens.

Quoted 20 lines · Jens Axboe
Quoted 7 lines · forrest
Quoted 3 lines · Jens Axboe

run dmesg prior to suspending, then it'll be cached and can be run after resume even if the disk doesn't want to talk to you.

Don't know why the mails with attached files were not sent to mailing list, so I put them at
http://www.infradead.org/~forrest/suspend-resume-dmesg/

The key is the 0xef timeout, then the device is offlined and you see a lot of io errors due to that.

Try this:

drivers/scsi/libata-core.c +0 -0
index bd14720..f120839 100644

drivers/scsi/libata-core.c int ata_device_resume(struct ata_port *a · line 4294

Quoted 7 lines
drivers/scsi/libata-core.c +1 -0
@@ -4288,6 +4288,7 @@ int ata_device_resume(struct ata_port *a
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
+		mdelay(2000);
 		ata_set_mode(ap);
 	}
 	if (!ata_dev_present(dev))

If Jens' suggestion doesn't work, can you post the same log with the working kernel? In #upstream, that part of code hasn't changed much, so I'm curious what makes the other kernel work.

Signature · 1 line
tejun
#10 lore raw
In reply to Jens Axboe
Quoted 11 lines · Jens Axboe

The key is the 0xef timeout, then the device is offlined and you see a lot of io errors due to that.

Try this:

drivers/scsi/libata-core.c +0 -0
index bd14720..f120839 100644

drivers/scsi/libata-core.c int ata_device_resume(struct ata_port *a · line 4294

Quoted 7 lines
drivers/scsi/libata-core.c +1 -0
@@ -4288,6 +4288,7 @@ int ata_device_resume(struct ata_port *a
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
+		mdelay(2000);
 		ata_set_mode(ap);
 	}
 	if (!ata_dev_present(dev))

Jens,

Yes! The patch works. But I'm wondering why ata_piix driver in kernel 2.6.16-rc6 works without mdelay(2000); in ata_device_resume()?

Thanks,
Forrest

#11 lore raw
Quoted 22 lines · forrest
Quoted 11 lines · Jens Axboe

The key is the 0xef timeout, then the device is offlined and you see a lot of io errors due to that.

Try this:

drivers/scsi/libata-core.c +0 -0
index bd14720..f120839 100644

drivers/scsi/libata-core.c int ata_device_resume(struct ata_port *a · line 4294

Quoted 7 lines
drivers/scsi/libata-core.c +1 -0
@@ -4288,6 +4288,7 @@ int ata_device_resume(struct ata_port *a
 {
 	if (ap->flags & ATA_FLAG_SUSPENDED) {
 		ap->flags &= ~ATA_FLAG_SUSPENDED;
+		mdelay(2000);
 		ata_set_mode(ap);
 	}
 	if (!ata_dev_present(dev))

Jens,

Quoted 2 lines

Yes! The patch works. But I'm wondering why ata_piix driver in kernel 2.6.16-rc6 works without mdelay(2000); in ata_device_resume()?

I think Hugh traced it down to a unrelated timer change. The above really wants to wait for BUSY clear, perhaps the best solution would be to have piix device its own ata_piix_device_resume() that first waits for BUSY clear, then calls ata_device_resume().

Signature · 1 line
Jens Axboe
#12 lore raw
Quoted 4 lines · Jens Axboe

I think Hugh traced it down to a unrelated timer change. The above really wants to wait for BUSY clear, perhaps the best solution would be to have piix device its own ata_piix_device_resume() that first waits for BUSY clear, then calls ata_device_resume().

Close... all devices should wait for libata to signal that the bus is ready to be talked to. For some that's waiting for BSY to clear, for others that's checking the SATA bus.

Jeff

#13 lore raw
Quoted 9 lines · Jeff Garzik
Quoted 4 lines · Jens Axboe

I think Hugh traced it down to a unrelated timer change. The above really wants to wait for BUSY clear, perhaps the best solution would be to have piix device its own ata_piix_device_resume() that first waits for BUSY clear, then calls ata_device_resume().

Close... all devices should wait for libata to signal that the bus is ready to be talked to. For some that's waiting for BSY to clear, for others that's checking the SATA bus.

Ok, I meant for the ata_piix case. Same should apply to others, right? Do whatever you need to do to make sure the hardware is ready, then call the generic ata_device_resume() helper to handle the libata side of things.

Signature · 1 line
Jens Axboe
#14 lore raw
Quoted 6 lines · Jens Axboe
Quoted 5 lines · Jeff Garzik
Quoted 4 lines · Jens Axboe

I think Hugh traced it down to a unrelated timer change. The above really wants to wait for BUSY clear, perhaps the best solution would be to have piix device its own ata_piix_device_resume() that first waits for BUSY clear, then calls ata_device_resume().

Quoted 6 lines
Quoted 1 line

Close... all devices should wait for libata to signal that the bus is ready to be talked to. For some that's waiting for BSY to clear, for others that's checking the SATA bus.

Ok, I meant for the ata_piix case. Same should apply to others, right? Do whatever you need to do to make sure the hardware is ready, then call the generic ata_device_resume() helper to handle the libata side of things.

Correct.

Jeff

#15 lore raw
In reply to Tejun Heo
Quoted 14 lines · Tejun Heo
Quoted 7 lines · forrest

Hi, Tejun

We just tested your git tree on thinkpad T43P laptop, and found that after ata_piix resumed from S3, SATA disk can't be read/write anymore. But according to the test result of kernel 2.6.16-rc6 on T43P, ata_piix can resume from S3 successfully.

Quoted 5 lines

We know that this problem may be not related to your patches, but I think you know the libata development status very well, maybe you can give us some clue about what happened to ata_piix between 2.6.16-rc6 and your git tree.

Quoted 5 lines

Hello, Zhao.

I haven't really followed AHCI suspend/resume stuff but AFAICT it never made to #upstream. I don't know whether it was included in -rc# or not.
But it sounds like it did.

Hannes @ SuSE posted an AHCI suspend/resume patch that needs to go in. Unfortunately AHCI is a high rate of churn, so it's still in my 'Pending' folder :/

Jeff

#16 lore raw
Quoted 5 lines · Jeff Garzik

Hannes @ SuSE posted an AHCI suspend/resume patch that needs to go in. Unfortunately AHCI is a high rate of churn, so it's still in my 'Pending' folder :/

Jeff

Jeff,

According to our test, Hannes's patch can't work on our NAPA sdv, I have reported the problem on 27th, April. The mail archive is at:
http://marc.theaimsgroup.com/?l=linux-ide&m=114612987014369&w=2

And I ported a patch from OpenSUSE to #upstream and posted patch on 30th,April, the mail archive is at:
http://marc.theaimsgroup.com/?l=linux-ide&m=114637600401411&w=2

Will this ported patch be in your pending list?

Thanks,
Forrest