Patchwork [Bug,#13663] suspend to ram regression (IDE related)

login
register
mail settings
Submitter Bartlomiej Zolnierkiewicz
Date July 1, 2009, 4:29 p.m.
Message ID <200907011829.16850.bzolnier@gmail.com>
Download mbox | patch
Permalink /patch/29356/
State RFC
Delegated to: David Miller
Headers show

Comments

Bartlomiej Zolnierkiewicz - July 1, 2009, 4:29 p.m.
On Wednesday 01 July 2009 18:21:25 Bartlomiej Zolnierkiewicz wrote:
> On Wednesday 01 July 2009 16:47:41 Wu Zhangjin wrote:
> > On Wed, 2009-07-01 at 22:31 +0800, Jeff Chua wrote:
> > > On Tue, Jun 30, 2009 at 12:21 AM, Jeff Chua<jeff.chua.linux@gmail.com> wrote:
> > > 
> > > > I just tried, and it "seems" to work. Will try a few more cycles.
> > > 
> > > STD/STR survived quite a few cycles now. Patch seems to be doing the
> > > right thing.
> > > 
> > > On Mon, Jun 29, 2009 at 11:51 PM, Etienne
> > > Basset<etienne.basset@numericable.fr> wrote:
> > > 
> > > > To have STR/resume work with current git, I have to :
> > > 
> > > > 1) apply Bart's patch
> > > 
> > > This is not yet in Linus's tree. And much needed to really fix the problem.
> > > 
> > > > 2) revert this commit : a1317f714af7aed60ddc182d0122477cbe36ee9b
> > > 
> > 
> > Yes, This commit must be reverted, otherwise, STD/Hibernation will not
> > work either. I have tested it on two different loongson-based machines:
> > fuloong2e box and yeeloong2f netbook.(loongson is mips compatiable)
> 
> Since it seems like Dave is taking his sweet time with doing the revert
> I stared at the code a bit more and I think that I finally found the bug
> (thanks to your debugging work for giving me the right hint!).
> 
> The patch needs to take into the account a new code introduced by the recent
> block layer changes (commit 8f6205cd572fece673da0255d74843680f67f879):
> 
> @@ -555,8 +560,11 @@ repeat:
>                 startstop = start_request(drive, rq);
>                 spin_lock_irq(&hwif->lock);
>  
> -               if (startstop == ide_stopped)
> +               if (startstop == ide_stopped) {
> +                       rq = hwif->rq;
> +                       hwif->rq = NULL;
>                         goto repeat;
> +               }
>         } else
>                 goto plug_device;
>  out:
> 
> and not zero hwif->rq if the device is blocked. 
> 
> Could you try the attached patch and see if it fixes the issue?

Here is the more complete version, also taking into the account changes
in ide_intr() and ide_timer_expiry():

---
 drivers/ide/ide-io.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Chua - July 1, 2009, 5:28 p.m.
On Thu, Jul 2, 2009 at 12:29 AM, Bartlomiej
Zolnierkiewicz<bzolnier@gmail.com> wrote:
> Here is the more complete version, also taking into the account changes
> in ide_intr() and ide_timer_expiry():

This works great for. Survived STR, STD. I just applied on top vanilla
latest Linus's git pull. Nothing else to revert.

Thanks,
Jeff.


> ---
>  drivers/ide/ide-io.c |   15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> Index: b/drivers/ide/ide-io.c
> ===================================================================
> --- a/drivers/ide/ide-io.c
> +++ b/drivers/ide/ide-io.c
> @@ -532,7 +532,8 @@ repeat:
>
>                if (startstop == ide_stopped) {
>                        rq = hwif->rq;
> -                       hwif->rq = NULL;
> +                       if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0)
> +                               hwif->rq = NULL;
>                        goto repeat;
>                }
>        } else
> @@ -679,8 +680,10 @@ void ide_timer_expiry (unsigned long dat
>                spin_lock_irq(&hwif->lock);
>                enable_irq(hwif->irq);
>                if (startstop == ide_stopped && hwif->polling == 0) {
> -                       rq_in_flight = hwif->rq;
> -                       hwif->rq = NULL;
> +                       if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
> +                               rq_in_flight = hwif->rq;
> +                               hwif->rq = NULL;
> +                       }
>                        ide_unlock_port(hwif);
>                        plug_device = 1;
>                }
> @@ -856,8 +859,10 @@ irqreturn_t ide_intr (int irq, void *dev
>         */
>        if (startstop == ide_stopped && hwif->polling == 0) {
>                BUG_ON(hwif->handler);
> -               rq_in_flight = hwif->rq;
> -               hwif->rq = NULL;
> +               if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
> +                       rq_in_flight = hwif->rq;
> +                       hwif->rq = NULL;
> +               }
>                ide_unlock_port(hwif);
>                plug_device = 1;
>        }
>
etienne - July 1, 2009, 9:30 p.m.
Jeff Chua wrote:
> On Thu, Jul 2, 2009 at 12:29 AM, Bartlomiej
> Zolnierkiewicz<bzolnier@gmail.com> wrote:
>> Here is the more complete version, also taking into the account changes
>> in ide_intr() and ide_timer_expiry():
> 
> This works great for. Survived STR, STD. I just applied on top vanilla
> latest Linus's git pull. Nothing else to revert.
> 
> Thanks,
> Jeff.
> 
> 
i confirm, this  works for me too :)
thanks,
Etienne


>> ---
>>  drivers/ide/ide-io.c |   15 ++++++++++-----
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> Index: b/drivers/ide/ide-io.c
>> ===================================================================
>> --- a/drivers/ide/ide-io.c
>> +++ b/drivers/ide/ide-io.c
>> @@ -532,7 +532,8 @@ repeat:
>>
>>                if (startstop == ide_stopped) {
>>                        rq = hwif->rq;
>> -                       hwif->rq = NULL;
>> +                       if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0)
>> +                               hwif->rq = NULL;
>>                        goto repeat;
>>                }
>>        } else
>> @@ -679,8 +680,10 @@ void ide_timer_expiry (unsigned long dat
>>                spin_lock_irq(&hwif->lock);
>>                enable_irq(hwif->irq);
>>                if (startstop == ide_stopped && hwif->polling == 0) {
>> -                       rq_in_flight = hwif->rq;
>> -                       hwif->rq = NULL;
>> +                       if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
>> +                               rq_in_flight = hwif->rq;
>> +                               hwif->rq = NULL;
>> +                       }
>>                        ide_unlock_port(hwif);
>>                        plug_device = 1;
>>                }
>> @@ -856,8 +859,10 @@ irqreturn_t ide_intr (int irq, void *dev
>>         */
>>        if (startstop == ide_stopped && hwif->polling == 0) {
>>                BUG_ON(hwif->handler);
>> -               rq_in_flight = hwif->rq;
>> -               hwif->rq = NULL;
>> +               if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
>> +                       rq_in_flight = hwif->rq;
>> +                       hwif->rq = NULL;
>> +               }
>>                ide_unlock_port(hwif);
>>                plug_device = 1;
>>        }
>>

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zhangjin Wu - July 2, 2009, 1:46 a.m.
On Wed, 2009-07-01 at 18:29 +0200, Bartlomiej Zolnierkiewicz wrote:
> On Wednesday 01 July 2009 18:21:25 Bartlomiej Zolnierkiewicz wrote:
> > On Wednesday 01 July 2009 16:47:41 Wu Zhangjin wrote:
> > > On Wed, 2009-07-01 at 22:31 +0800, Jeff Chua wrote:
> > > > On Tue, Jun 30, 2009 at 12:21 AM, Jeff Chua<jeff.chua.linux@gmail.com> wrote:
> > > > 
> > > > > I just tried, and it "seems" to work. Will try a few more cycles.
> > > > 
> > > > STD/STR survived quite a few cycles now. Patch seems to be doing the
> > > > right thing.
> > > > 
> > > > On Mon, Jun 29, 2009 at 11:51 PM, Etienne
> > > > Basset<etienne.basset@numericable.fr> wrote:
> > > > 
> > > > > To have STR/resume work with current git, I have to :
> > > > 
> > > > > 1) apply Bart's patch
> > > > 
> > > > This is not yet in Linus's tree. And much needed to really fix the problem.
> > > > 
> > > > > 2) revert this commit : a1317f714af7aed60ddc182d0122477cbe36ee9b
> > > > 
> > > 
> > > Yes, This commit must be reverted, otherwise, STD/Hibernation will not
> > > work either. I have tested it on two different loongson-based machines:
> > > fuloong2e box and yeeloong2f netbook.(loongson is mips compatiable)
> > 
> > Since it seems like Dave is taking his sweet time with doing the revert
> > I stared at the code a bit more and I think that I finally found the bug
> > (thanks to your debugging work for giving me the right hint!).
> > 
> > The patch needs to take into the account a new code introduced by the recent
> > block layer changes (commit 8f6205cd572fece673da0255d74843680f67f879):
> > 
> > @@ -555,8 +560,11 @@ repeat:
> >                 startstop = start_request(drive, rq);
> >                 spin_lock_irq(&hwif->lock);
> >  
> > -               if (startstop == ide_stopped)
> > +               if (startstop == ide_stopped) {
> > +                       rq = hwif->rq;
> > +                       hwif->rq = NULL;
> >                         goto repeat;
> > +               }
> >         } else
> >                 goto plug_device;
> >  out:
> > 
> > and not zero hwif->rq if the device is blocked. 
> > 
> > Could you try the attached patch and see if it fixes the issue?
> 
> Here is the more complete version, also taking into the account changes
> in ide_intr() and ide_timer_expiry():
> 

Sorry, I can not apply this patch directly, which original version did
you use? I used the one in the master branch of linux-mips development
git repository.

commit 5a4f13fad1ab5bd08dea78fc55321e429d83cddf
Merge: ec9c45d e18ed14
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Mon Jun 29 20:07:43 2009 -0700

    Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
    
    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
      ide: memory overrun in ide_get_identity_ioctl() on big endian
machines using ioctl HDIO_OBSOLETE_IDENTITY
      ide: fix resume for CONFIG_BLK_DEV_IDEACPI=y
      ide-cd: handle fragmented packet commands gracefully
      ide: always kill the whole request on error
      ide: fix ide_kill_rq() for special ide-{floppy,tape} driver
requests

it this too old? should i merge another git repository?

I have tried to apply it manually, but unfortunately, also not work. any
other patch needed?

Thanks!
Wu Zhangjin
> ---
>  drivers/ide/ide-io.c |   15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> Index: b/drivers/ide/ide-io.c
> ===================================================================
> --- a/drivers/ide/ide-io.c
> +++ b/drivers/ide/ide-io.c
> @@ -532,7 +532,8 @@ repeat:
>  
>  		if (startstop == ide_stopped) {
>  			rq = hwif->rq;
> -			hwif->rq = NULL;
> +			if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0)
> +				hwif->rq = NULL;
>  			goto repeat;
>  		}
>  	} else
> @@ -679,8 +680,10 @@ void ide_timer_expiry (unsigned long dat
>  		spin_lock_irq(&hwif->lock);
>  		enable_irq(hwif->irq);
>  		if (startstop == ide_stopped && hwif->polling == 0) {
> -			rq_in_flight = hwif->rq;
> -			hwif->rq = NULL;
> +			if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
> +				rq_in_flight = hwif->rq;
> +				hwif->rq = NULL;
> +			}
>  			ide_unlock_port(hwif);
>  			plug_device = 1;
>  		}
> @@ -856,8 +859,10 @@ irqreturn_t ide_intr (int irq, void *dev
>  	 */
>  	if (startstop == ide_stopped && hwif->polling == 0) {
>  		BUG_ON(hwif->handler);
> -		rq_in_flight = hwif->rq;
> -		hwif->rq = NULL;
> +		if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
> +			rq_in_flight = hwif->rq;
> +			hwif->rq = NULL;
> +		}
>  		ide_unlock_port(hwif);
>  		plug_device = 1;
>  	}

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Chua - July 2, 2009, 2:09 a.m.
On Thu, Jul 2, 2009 at 9:46 AM, Wu Zhangjin<wuzhangjin@gmail.com> wrote:
> it this too old? should i merge another git repository?
> I have tried to apply it manually, but unfortunately, also not work. any
> other patch needed?

You need to be undo those two patches below ...

> On Mon, Jun 29, 2009 at 11:51 PM, Etienne Basset<etienne.basset@numericable.fr>
> To have STR/resume work with current git, I have to :
> 1) apply Bart's patch
> 2) revert this commit : a1317f714af7aed60ddc182d0122477cbe36ee9b

or try to pull from Linus's tree and try again. Latest is now ...

commit d960eea974f5e500c0dcb95a934239cc1f481cfd
Author: Randy Dunlap <randy.dunlap@oracle.com>
Date:   Mon Jun 29 14:54:11 2009 -0700

    kernel-doc: move ignoring kmemcheck



Jeff.
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ralf Baechle - July 2, 2009, 10:46 a.m.
On Thu, Jul 02, 2009 at 09:46:43AM +0800, Wu Zhangjin wrote:

> Sorry, I can not apply this patch directly, which original version did
> you use? I used the one in the master branch of linux-mips development
> git repository.

The master branch of linux-mips.org has no IDE changes over Linus' tree.

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

Patch

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -532,7 +532,8 @@  repeat:
 
 		if (startstop == ide_stopped) {
 			rq = hwif->rq;
-			hwif->rq = NULL;
+			if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0)
+				hwif->rq = NULL;
 			goto repeat;
 		}
 	} else
@@ -679,8 +680,10 @@  void ide_timer_expiry (unsigned long dat
 		spin_lock_irq(&hwif->lock);
 		enable_irq(hwif->irq);
 		if (startstop == ide_stopped && hwif->polling == 0) {
-			rq_in_flight = hwif->rq;
-			hwif->rq = NULL;
+			if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
+				rq_in_flight = hwif->rq;
+				hwif->rq = NULL;
+			}
 			ide_unlock_port(hwif);
 			plug_device = 1;
 		}
@@ -856,8 +859,10 @@  irqreturn_t ide_intr (int irq, void *dev
 	 */
 	if (startstop == ide_stopped && hwif->polling == 0) {
 		BUG_ON(hwif->handler);
-		rq_in_flight = hwif->rq;
-		hwif->rq = NULL;
+		if ((drive->dev_flags & IDE_DFLAG_BLOCKED) == 0) {
+			rq_in_flight = hwif->rq;
+			hwif->rq = NULL;
+		}
 		ide_unlock_port(hwif);
 		plug_device = 1;
 	}