linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [resend] Resume from hibernation fails with pata_it821x RAID volume
@ 2009-02-03 22:20 Ondrej Zary
  0 siblings, 0 replies; 6+ messages in thread
From: Ondrej Zary @ 2009-02-03 22:20 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, linux-kernel

Hello,
hibernation didn't work for me since I started to use IT8212 controller. Now I 
did some debugging (booting with no_console_suspend init=/bin/sh).

Found that resume fails (2.6.28) with "serial number mismatch 'some 
garbage' != 'some other garbage'" and "revalidation failed" messages. That's 
because the controller firmware fills different serial number in the IDENTIFY 
every boot.

The patch below fixes the resume simply clearing the serial number. The proper 
fix would be probably to fill in the serial number of the RAID volume 
instead. I assume that there must be something like that stored on the drives 
but I don't know where.


Fix resume on pata_it821x RAID volume by clearing the serial number in 
IDENTIFY data, which is otherwise different on each boot.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- linux-2.6.28-orig/drivers/ata/pata_it821x.c	2009-01-02 17:18:36.000000000 
+0100
+++ linux/drivers/ata/pata_it821x.c	2009-02-02 17:47:57.000000000 +0100
@@ -561,6 +561,9 @@
 		id[83] |= 0x4400;	/* Word 83 is valid and LBA48 */
 		id[86] |= 0x0400;	/* LBA48 on */
 		id[ATA_ID_MAJOR_VER] |= 0x1F;
+		/* Clear the serial number because it's different each boot
+		   which breaks validation on resume */
+		memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN);
 	}
 	return err_mask;
 }


-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH] [resend] Resume from hibernation fails with pata_it821x RAID volume
@ 2009-02-06 13:12 Ondrej Zary
  2009-02-06 17:46 ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Ondrej Zary @ 2009-02-06 13:12 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-ide, linux-kernel

Hello,
hibernation didn't work for me since I started to use IT8212 controller. Now I 
did some debugging (booting with no_console_suspend init=/bin/sh).

Found that resume fails (2.6.28) with "serial number mismatch 'some 
garbage' != 'some other garbage'" and "revalidation failed" messages. That's 
because the controller firmware fills different serial number in the IDENTIFY 
every boot.

The patch below fixes the resume simply clearing the serial number. The proper 
fix would be probably to fill in the serial number of the RAID volume 
instead. I assume that there must be something like that stored on the drives 
but I don't know where.


Fix resume on pata_it821x RAID volume by clearing the serial number in 
IDENTIFY data, which is otherwise different on each boot.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- linux-2.6.28-orig/drivers/ata/pata_it821x.c	2009-01-02 17:18:36.000000000 
+0100
+++ linux/drivers/ata/pata_it821x.c	2009-02-02 17:47:57.000000000 +0100
@@ -561,6 +561,9 @@
 		id[83] |= 0x4400;	/* Word 83 is valid and LBA48 */
 		id[86] |= 0x0400;	/* LBA48 on */
 		id[ATA_ID_MAJOR_VER] |= 0x1F;
+		/* Clear the serial number because it's different each boot
+		   which breaks validation on resume */
+		memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN);
 	}
 	return err_mask;
 }


-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH] [resend] Resume from hibernation fails with pata_it821x RAID volume
@ 2009-02-09 17:05 Ondrej Zary
  0 siblings, 0 replies; 6+ messages in thread
From: Ondrej Zary @ 2009-02-09 17:05 UTC (permalink / raw)
  To: Alan Cox; +Cc: Sergei Shtylyov, linux-ide, linux-kernel

On Friday 06 February 2009 18:56:35 Alan Cox wrote:
> >     See CodingStyle chapter 8 for the preferred multiline comment style.
> >
> > > +		memset(&id[ATA_ID_SERNO], 0x20, ATA_ID_SERNO_LEN);
> >
> >     Why not ' '?
> >
> > MBR, Sergei
>
> Digging into the docs the RAID serial number (and what that means isn't
> defined anywhere I can see) is byte offset 54-73 in each of the 4 128
> byte blocks returned by the chip status query we do at boot
> (it821x_probe_firmware).

Yes, found it there. But it seems to be the same number as present in the 
IDENTIFY data. It contains date and time of boot (matches RAID_SERIAL_NUMBER 
structure found in iteraid.h in driver source from ITE) instead of date and 
time of RAID creation.

I don't have any better solution than the patch below. Generating the serial
number from drives containing the array is not an option as it prevents
resume if one of the drives fails.


Fix resume on pata_it821x RAID volume by clearing the serial number in 
IDENTIFY data. The serial number is different on each boot, breaking
validation on resume from hibernation.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- linux-2.6.28-orig/drivers/ata/pata_it821x.c	2009-01-02 17:18:36.000000000 +0100
+++ linux/drivers/ata/pata_it821x.c	2009-02-09 17:52:21.000000000 +0100
@@ -561,6 +561,9 @@
 		id[83] |= 0x4400;	/* Word 83 is valid and LBA48 */
 		id[86] |= 0x0400;	/* LBA48 on */
 		id[ATA_ID_MAJOR_VER] |= 0x1F;
+		/* Clear the serial number because it's different each boot
+		   which breaks validation on resume */
+		memset(&id[ATA_ID_SERNO], ' ', ATA_ID_SERNO_LEN);
 	}
 	return err_mask;
 }



-- 
Ondrej Zary

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-02-09 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-03 22:20 [PATCH] [resend] Resume from hibernation fails with pata_it821x RAID volume Ondrej Zary
  -- strict thread matches above, loose matches on Subject: below --
2009-02-06 13:12 Ondrej Zary
2009-02-06 17:46 ` Sergei Shtylyov
2009-02-06 17:56   ` Alan Cox
2009-02-07 12:29     ` Ondrej Zary
2009-02-09 17:05 Ondrej Zary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).