Skip to contentSkip to conversation

libata: clear eh_info on reset completion

PATCH Applied Tejun Heo 3 participants 3 messages Jul 17, 2009 – Jul 29, 2009 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 libata: clear eh_info on reset completion

Resets are done with port frozen but some controllers still issue interrupts during reset and they may end up recording error conditions in ehi leading to unnecessary EH retrials.

This patch makes ata_eh_reset() clear ehi on reset completion. As reset is the most severe recovery action, there's nothing to lose by clearing ehi on its completion.

---
Zdenek, I moved the clearing above a bit. It should work the same but can you please test this one too?

Jeff, after Zdenek's verification, please commit this to #upstream.

Thanks.

 drivers/ata/libata-eh.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +9 -3
index a3df9fe..924a8de 100644
@@ -2572,11 +2572,17 @@ int ata_eh_reset(struct ata_link *link, int classify,
 			postreset(slave, classes);
 	}
 
-	/* clear cached SError */
+	/*
+	 * Some controllers can't be frozen very well and may set
+	 * spuruious error conditions during reset.  Clear accumulated
+	 * error information.  As reset is the final recovery action,
+	 * nothing is lost by doing this.
+	 */
 	spin_lock_irqsave(link->ap->lock, flags);
-	link->eh_info.serror = 0;
+	memset(&link->eh_info, 0, sizeof(link->eh_info));
 	if (slave)
-		slave->eh_info.serror = 0;
+		memset(&slave->eh_info, 0, sizeof(link->eh_info));
+	ap->pflags &= ~ATA_PFLAG_EH_PENDING;
 	spin_unlock_irqrestore(link->ap->lock, flags);
 
 	/* Make sure onlineness and classification result correspond.
#1 lore raw

Tejun Heo napsal(a):

Quoted 36 lines

Resets are done with port frozen but some controllers still issue interrupts during reset and they may end up recording error conditions in ehi leading to unnecessary EH retrials.

This patch makes ata_eh_reset() clear ehi on reset completion. As reset is the most severe recovery action, there's nothing to lose by clearing ehi on its completion.

---
Zdenek, I moved the clearing above a bit. It should work the same but can you please test this one too?

Jeff, after Zdenek's verification, please commit this to #upstream.

Thanks.

 drivers/ata/libata-eh.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +6 -1
index a3df9fe..924a8de 100644
@@ -2572,11 +2572,17 @@ int ata_eh_reset(struct ata_link *link, int classify,
 			postreset(slave, classes);
 	}
 
-	/* clear cached SError */
+	/*
+	 * Some controllers can't be frozen very well and may set
+	 * spuruious error conditions during reset.  Clear accumulated
+	 * error information.  As reset is the final recovery action,
+	 * nothing is lost by doing this.
+	 */

drivers/ata/libata-eh.c int ata_eh_reset(struct ata_link *link, int classify, · line 2588

Quoted 10 lines
drivers/ata/libata-eh.c +3 -2
 	spin_lock_irqsave(link->ap->lock, flags);
-	link->eh_info.serror = 0;
+	memset(&link->eh_info, 0, sizeof(link->eh_info));
 	if (slave)
-		slave->eh_info.serror = 0;
+		memset(&slave->eh_info, 0, sizeof(link->eh_info));
+	ap->pflags &= ~ATA_PFLAG_EH_PENDING;
 	spin_unlock_irqrestore(link->ap->lock, flags);
 
 	/* Make sure onlineness and classification result correspond.

Successfully tested with ICH8 and ICH7R controllers on two different machines with 2.6.31-rc3.

Z.

Applied
#2 lore raw
In reply to Tejun Heo
Quoted 14 lines · Tejun Heo

Resets are done with port frozen but some controllers still issue interrupts during reset and they may end up recording error conditions in ehi leading to unnecessary EH retrials.

This patch makes ata_eh_reset() clear ehi on reset completion. As reset is the most severe recovery action, there's nothing to lose by clearing ehi on its completion.

---
Zdenek, I moved the clearing above a bit. It should work the same but can you please test this one too?

Quoted 6 lines

Jeff, after Zdenek's verification, please commit this to #upstream.

Thanks.

 drivers/ata/libata-eh.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

applied