Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Resume from suspend causes harddrive error
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 3003
Location: Bay Area, CA

PostPosted: Fri Nov 17, 2006 6:00 pm    Post subject: Reply with quote

This patch causes some slowdowns in my system. Although suspend-to-ram and resume work perfectly, I notice that the performance goes down to about half of what it was before the first suspend (i.e. freshly booted system) measured using bonnie++. I did it after I started getting lagging mouse during intensive I/O operations. And the funny thing is that the affected drives are all sata drives.

Since I have used the system without this patch for a while, I know that there is nothing else that has changed. drives are physically healthy because they are not really old, and smartctl/badblocks don't give me any errors. And moreover, if I freshly boot the system, I get my performance back to normal speeds.

PS: that's probably the reason why it never got into kernel (none of 2.6.18, 2.6.17, or 2.6.19, 2.6.19-mm series has it).
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 3003
Location: Bay Area, CA

PostPosted: Fri Nov 17, 2006 6:22 pm    Post subject: Reply with quote

ok, dug it up a bit and it seems that the patch that you linked to, was rejected and a new patch to ide-io.c was proposed.

http://lkml.org/lkml/2006/7/28/136

which was accepted in mm-series and in 2.6.19 series, but is not present in 2.6.17 or 2.6.18.

edit: here is the same ide-io.c patch. It applies cleanly against 2.6.17.8 and works fine my machine:

Code:

$ diff -u ./drivers/ide/ide-io.c.orig ./drivers/ide/ide-io.c
--- ./drivers/ide/ide-io.c.orig 2006-10-11 19:22:21.000000000 -0700
+++ ./drivers/ide/ide-io.c      2006-11-17 14:35:43.000000000 -0800
@@ -136,7 +136,8 @@
        ide_pm_flush_cache      = ide_pm_state_start_suspend,
        idedisk_pm_standby,

-       idedisk_pm_idle         = ide_pm_state_start_resume,
+       idedisk_pm_restore_pio  = ide_pm_state_start_resume,
+       idedisk_pm_idle,
        ide_pm_restore_dma,
 };

@@ -155,7 +156,10 @@
        case idedisk_pm_standby:        /* Suspend step 2 (standby) complete */
                rq->pm->pm_step = ide_pm_state_completed;
                break;
-       case idedisk_pm_idle:           /* Resume step 1 (idle) complete */
+        case idedisk_pm_restore_pio:    /* Resume step 1 complete */
+                rq->pm->pm_step = idedisk_pm_idle;
+                break;
+       case idedisk_pm_idle:           /* Resume step 2 (idle) complete */
                rq->pm->pm_step = ide_pm_restore_dma;
                break;
        }
@@ -168,8 +172,11 @@
        memset(args, 0, sizeof(*args));

        if (drive->media != ide_disk) {
-               /* skip idedisk_pm_idle for ATAPI devices */
-               if (rq->pm->pm_step == idedisk_pm_idle)
+               /*
+                 * skip idedisk_pm_restore_pio and idedisk_pm_idle for ATAPI
+                 * devices
+                 */
+               if (rq->pm->pm_step == idedisk_pm_restore_pio)
                        rq->pm->pm_step = ide_pm_restore_dma;
        }

@@ -196,13 +203,19 @@
                args->handler      = &task_no_data_intr;
                return do_rw_taskfile(drive, args);

-       case idedisk_pm_idle:           /* Resume step 1 (idle) */
+       case idedisk_pm_restore_pio:    /* Resume step 1 (restore PIO) */
+               if (drive->hwif->tuneproc != NULL)
+                       drive->hwif->tuneproc(drive, 255);
+               ide_complete_power_step(drive, rq, 0, 0);
+               return ide_stopped;
+
+       case idedisk_pm_idle:           /* Resume step 2 (idle) */
                args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE;
                args->command_type = IDE_DRIVE_TASK_NO_DATA;
                args->handler = task_no_data_intr;
                return do_rw_taskfile(drive, args);

-       case ide_pm_restore_dma:        /* Resume step 2 (restore DMA) */
+       case ide_pm_restore_dma:        /* Resume step 3 (restore DMA) */
                /*
                 * Right now, all we do is call hwif->ide_dma_check(drive),
                 * we could be smarter and check for current xfer_speed

Back to top
View user's profile Send private message
pgolik
Tux's lil' helper
Tux's lil' helper


Joined: 24 Nov 2004
Posts: 125
Location: Warsaw, Poland

PostPosted: Thu Jan 04, 2007 9:17 pm    Post subject: Reply with quote

I tried the new patch (against 2.16.18-r6), but it doesn't work as well as the old rejected one. With the new one I have no problems with PATA harddisks, but using the DVD-RW drive still locks up (every time when I try to run k3b after resume), which doesn't happen with the old patch.
I'll wait for 2.6.19 and the new libata PATA stuff before I dig deeper into the problem.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 3003
Location: Bay Area, CA

PostPosted: Thu Jan 04, 2007 11:30 pm    Post subject: Reply with quote

pgolik wrote:
I'll wait for 2.6.19 and the new libata PATA stuff before I dig deeper into the problem.
gentoo-sources-2.6.19-r2 is in portage. What did you mean? I have been using gentoo-sources-2.6.19-r2 with suspend2 and reiser4 patches applied manually, no errors of any kind so far (uptime 15 days). Have been burning dvd's and playing movies all along these 15 days without any errors, suspending and resuming almost twice a day.
Back to top
View user's profile Send private message
pgolik
Tux's lil' helper
Tux's lil' helper


Joined: 24 Nov 2004
Posts: 125
Location: Warsaw, Poland

PostPosted: Fri Jan 05, 2007 12:13 pm    Post subject: Reply with quote

devsk wrote:
gentoo-sources-2.6.19-r2 is in portage. What did you mean?

It's still marked as ~amd64, and I usually stick to stable versions for kernel. I'll try and unmask it though. Did you switch your PATA stuff to the new libata driver? Did it improve things?
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 3003
Location: Bay Area, CA

PostPosted: Fri Jan 05, 2007 5:03 pm    Post subject: Reply with quote

pgolik wrote:
Did you switch your PATA stuff to the new libata driver? Did it improve things?
nope, I left it alone because the patch for power management was in ide-io.c, so my assumption was that it applied to IDE anyway. And since I don't have any problems and I get around 60Mbytes/sec thruput from pata disk with IDE drivers, I don't care much.
Back to top
View user's profile Send private message
pgolik
Tux's lil' helper
Tux's lil' helper


Joined: 24 Nov 2004
Posts: 125
Location: Warsaw, Poland

PostPosted: Fri Jan 05, 2007 6:48 pm    Post subject: Reply with quote

I tried gentoo-sources 2.6.19-r2
First: new libata drivers for pata (PATA_AMD) - disk recognized correctly, but still has the power management bug - accesing the drive after resume freezes system. So, no progress compared to unpatched earlier kernels.
Second: old IDE drivers. HDD resumes correctly (DMA gets turned off, but a re-run of hdparm fixes it), but the DVD-RW doesn't work (doesn't freeze the system, just k3b hangs silently). Dmesg:
Code:

hdc: DMA timeout retry
hdc: timeout waiting for DMA
hdc: DMA timeout retry
hdc: timeout waiting for DMA
hdc: DMA timeout retry
hdc: timeout waiting for DMA
hdc: DMA timeout retry
hdc: timeout waiting for DMA

So - no progress compared to 2.6.18 patched with the ide-io.c patch.
2.6.18 patched with the amd74xx.c works best for me, I haven't noticed any slowdowns, but the IDE hdd is my secondary drive that isn't used heavily. No problems with DVD-RW upon resume with this old rejected patch.
[EDIT]
There is a new patch against the libata driver (PATA_AMD), which solves the problem. The patch, which can be found here is by Alan Cox himself, and from what I gathered will be included even in later revisions of 2.6.19 (r2 still doesn't have it). With this patch my PATA hdd works fine with the new driver, all devices resume correctly and it seems a bit faster. Also, having all disks (PATA and SATA) show up as /dev/sdX is neat and clean.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum