linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata: skip reset on bus not a device
@ 2006-09-30  5:06 Joe Jin
  2006-09-30 14:14 ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Jin @ 2006-09-30  5:06 UTC (permalink / raw)
  To: linux-ide, lkml

[-- Attachment #1: Type: text/plain, Size: 10378 bytes --]

Hi,

On my pc(Dell OptiPlex GX620), while boot up it by 2.6.18, the next
info always report:
===========================================
ata2: port is slow to respond, please be patient
ata2: port failed to respond (30 secs)
ata2: SRST failed (status 0xFF)
ata2: SRST failed (err_mask=0x100)
ata2: softreset failed, retrying in 5 secs
ata2: SRST failed (status 0xFF)
ata2: SRST failed (err_mask=0x100)
ata2: softreset failed, retrying in 5 secs
ata2: SRST failed (status 0xFF)
ata2: SRST failed (err_mask=0x100)
ata2: reset failed, giving up
===========================================

and follow is lspci output:
===========================================
00:00.0 Host bridge: Intel Corporation 945G/GZ/P/PL Express Memory
Controller Hub (rev 02)
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, fast devsel, latency 0
        Capabilities: <available only to root>
00: 86 80 70 27 06 01 90 20 02 00 00 06 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00

00:01.0 PCI bridge: Intel Corporation 945G/GZ/P/PL Express PCI Express
Root Port (rev 02) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        Memory behind bridge: fe900000-fe9fffff
        Capabilities: <available only to root>
00: 86 80 71 27 07 05 10 00 02 00 04 06 10 00 01 00
10: 00 00 00 00 00 00 00 00 00 01 01 00 f0 00 00 00
 20: 90 fe 90 fe f1 ff 01 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 88 00 00 00 00 00 00 00 0b 01 02 00

00:02.0 VGA compatible controller: Intel Corporation 945G/GZ Express
Integrated Graphics Controller (rev 02) (prog-if 00 [VGA])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, fast devsel, latency 0, IRQ 169
        Memory at feb00000 (32-bit, non-prefetchable) [size=512K]
        I/O ports at e898 [size=8]
         Memory at e0000000 (32-bit, prefetchable) [size=256M]
        Memory at feac0000 (32-bit, non-prefetchable) [size=256K]
        Capabilities: <available only to root>
00: 86 80 72 27 07 00 90 00 02 00 00 03 00 00 80 00
10: 00 00 b0 fe 99 e8 00 00 08 00 00 e0 00 00 ac fe
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 90 00 00 00 00 00 00 00 0b 01 00 00

00:02.1 Display controller: Intel Corporation 945G/GZ Express
Integrated Graphics Controller (rev 02)
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, fast devsel, latency 0
        Memory at feb80000 (32-bit, non-prefetchable) [size=512K]
        Capabilities: <available only to root>
00: 86 80 76 27 07 00 90 00 02 00 80 03 00 00 80 00
10: 00 00 b8 fe 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 d0 00 00 00 00 00 00 00 00 00 00 00

00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express
Port 1 (rev 01) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        Memory behind bridge: fe800000-fe8fffff
        Capabilities: <available only to root>
00: 86 80 d0 27 07 05 10 00 01 00 04 06 10 00 81 00
10: 00 00 00 00 00 00 00 00 00 02 02 00 f0 00 00 20
 20: 80 fe 80 fe f1 ff 01 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 0b 01 02 00

00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express
Port 2 (rev 01) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
        Memory behind bridge: fe700000-fe7fffff
        Capabilities: <available only to root>
00: 86 80 d2 27 07 05 10 00 01 00 04 06 10 00 81 00
10: 00 00 00 00 00 00 00 00 00 03 03 00 f0 00 00 20
20: 70 fe 70 fe f1 ff 01 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 0a 02 02 00

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB
UHCI #1 (rev 01) (prog-if 00 [UHCI])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 233
         I/O ports at ff80 [size=32]
00: 86 80 c8 27 05 00 80 02 01 00 03 0c 00 00 80 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 81 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 09 01 00 00

00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB
UHCI #2 (rev 01) (prog-if 00 [UHCI])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 50
        I/O ports at ff60 [size=32]
00: 86 80 c9 27 05 00 80 02 01 00 03 0c 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 61 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 05 02 00 00

00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB
UHCI #3 (rev 01) (prog-if 00 [UHCI])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 58
        I/O ports at ff40 [size=32]
00: 86 80 ca 27 05 00 80 02 01 00 03 0c 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 41 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 03 03 00 00

00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB
UHCI #4 (rev 01) (prog-if 00 [UHCI])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 225
        I/O ports at ff20 [size=32]
00: 86 80 cb 27 05 00 80 02 01 00 03 0c 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 21 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 0a 04 00 00

00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2
EHCI Controller (rev 01) (prog-if 20 [EHCI])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 233
        Memory at ffa80800 (32-bit, non-prefetchable) [size=1K]
        Capabilities: <available only to root>
00: 86 80 cc 27 06 01 90 02 01 20 03 0c 00 00 00 00
10: 00 08 a8 ff 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 50 00 00 00 00 00 00 00 09 01 00 00

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
(prog-if 01 [Subtractive decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=04, subordinate=04, sec-latency=32
        Capabilities: <available only to root>
00: 86 80 4e 24 07 01 10 00 e1 01 04 06 00 00 81 00
10: 00 00 00 00 00 00 00 00 00 04 04 20 f0 00 80 22
20: f0 ff 00 00 f1 ff 01 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 50 00 00 00 00 00 00 00 00 00 02 00

00:1e.2 Multimedia audio controller: Intel Corporation 82801G (ICH7
Family) AC'97 Audio Controller (rev 01)
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 225
        I/O ports at ec00 [size=256]
        I/O ports at e8c0 [size=64]
        Memory at feabfa00 (32-bit, non-prefetchable) [size=512]
        Memory at feabf900 (32-bit, non-prefetchable) [size=256]
        Capabilities: <available only to root>
00: 86 80 de 27 07 00 90 02 01 00 01 04 00 00 00 00
10: 01 ec 00 00 c1 e8 00 00 00 fa ab fe 00 f9 ab fe
20: 00 00 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 50 00 00 00 00 00 00 00 0a 01 00 00

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC
Interface Bridge (rev 01)
        Flags: bus master, medium devsel, latency 0
        Capabilities: <available only to root>
00: 86 80 b8 27 07 01 10 02 01 00 01 06 00 00 80 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE
Controller (rev 01) (prog-if 8a [Master SecP PriP])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, medium devsel, latency 0, IRQ 169
        I/O ports at <ignored>
        I/O ports at <ignored>
        I/O ports at <ignored>
        I/O ports at <ignored>
        I/O ports at ffa0 [size=16]
00: 86 80 df 27 05 00 88 02 01 8a 01 01 00 00 00 00
10: f1 01 00 00 f5 03 00 00 71 01 00 00 75 03 00 00
20: a1 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00

00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family)
Serial ATA Storage Controller IDE (rev 01) (prog-if 8f [Master SecP
SecO PriP PriO])
        Subsystem: Dell: Unknown device 01ad
        Flags: bus master, 66Mhz, medium devsel, latency 0, IRQ 217
        I/O ports at fe00 [size=8]
        I/O ports at fe10 [size=4]
        I/O ports at fe20 [size=8]
        I/O ports at fe30 [size=4]
        I/O ports at fea0 [size=16]
        Capabilities: <available only to root>
00: 86 80 c0 27 07 00 b0 02 01 8f 01 01 00 00 00 00
10: 01 fe 00 00 11 fe 00 00 21 fe 00 00 31 fe 00 00
20: a1 fe 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 70 00 00 00 00 00 00 00 05 03 00 00

00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
        Subsystem: Dell: Unknown device 01ad
        Flags: medium devsel, IRQ 177
        I/O ports at e8a0 [size=32]
00: 86 80 da 27 01 01 80 02 01 00 05 0c 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: a1 e8 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 0a 02 00 00

02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751
Gigabit Ethernet PCI Express (rev 01)
        Subsystem: Dell Optiplex GX620
        Flags: bus master, fast devsel, latency 0, IRQ 169
        Memory at fe8f0000 (64-bit, non-prefetchable) [size=64K]
        Capabilities: <available only to root>
00: e4 14 77 16 06 00 10 00 01 00 00 02 10 00 00 00
10: 04 00 8f fe 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 07 00 00 00 28 10 ad 01
30: 00 00 00 00 48 00 00 00 00 00 00 00 0b 01 00 00
 ===========================================

through traced the code, and found which caused it:
at scsi_eh_[port_no] kernel thread, it should reset the bus, before reset it,
it never check it if have a device. if it should skip it?
thanks

attachment is the patch

-- 
Regards,
Joe Jin

[-- Attachment #2: libata-core.patch --]
[-- Type: text/x-patch, Size: 1508 bytes --]

--- linux-2.6.18.orig/drivers/scsi/libata-core.c	2006-09-29 16:58:38.000000000 +0800
+++ linux-2.6.18/drivers/scsi/libata-core.c	2006-09-30 12:44:32.000000000 +0800
@@ -2631,8 +2631,19 @@ int ata_std_prereset(struct ata_port *ap
 {
 	struct ata_eh_context *ehc = &ap->eh_context;
 	const unsigned long *timing = sata_ehc_deb_timing(ehc);
+	unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
+	unsigned int devmask = 0;
 	int rc;
 
+	if (ata_port_offline(ap)) 
+		return 0;
+
+	/* determine if device 0/1 are present */
+	if (ata_devchk(ap, 0))
+		devmask |= (1 << 0);
+	if (slave_possible && ata_devchk(ap, 1))
+		devmask |= (1 << 1);
+
 	/* handle link resume & hotplug spinup */
 	if ((ehc->i.flags & ATA_EHI_RESUME_LINK) &&
 	    (ap->flags & ATA_FLAG_HRST_TO_RESUME))
@@ -2660,7 +2671,8 @@ int ata_std_prereset(struct ata_port *ap
 	/* Wait for !BSY if the controller can wait for the first D2H
 	 * Reg FIS and we don't know that no device is attached.
 	 */
-	if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap))
+	if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && 
+            !ata_port_offline(ap) && devmask)
 		ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
 
 	return 0;
@@ -2697,6 +2709,10 @@ int ata_std_softreset(struct ata_port *a
 		devmask |= (1 << 0);
 	if (slave_possible && ata_devchk(ap, 1))
 		devmask |= (1 << 1);
+	
+	/* have not a invalid device been found */
+	if (!devmask)
+		return 0;
 
 	/* select device 0 again */
 	ap->ops->dev_select(ap, 0);

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-09-30  5:06 [PATCH] libata: skip reset on bus not a device Joe Jin
@ 2006-09-30 14:14 ` Tejun Heo
  2006-10-01  1:49   ` Joe Jin
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2006-09-30 14:14 UTC (permalink / raw)
  To: Joe Jin; +Cc: linux-ide, lkml, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]

Hello, Joe Jin.

Joe Jin wrote:
> On my pc(Dell OptiPlex GX620), while boot up it by 2.6.18, the next
> info always report:
> ===========================================
> ata2: port is slow to respond, please be patient
> ata2: port failed to respond (30 secs)
> ata2: SRST failed (status 0xFF)
> ata2: SRST failed (err_mask=0x100)
> ata2: softreset failed, retrying in 5 secs
> ata2: SRST failed (status 0xFF)
> ata2: SRST failed (err_mask=0x100)
> ata2: softreset failed, retrying in 5 secs
> ata2: SRST failed (status 0xFF)
> ata2: SRST failed (err_mask=0x100)
> ata2: reset failed, giving up
> ===========================================

I see.

> 00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE
> Controller (rev 01) (prog-if 8a [Master SecP PriP])
>        Subsystem: Dell: Unknown device 01ad
>        Flags: bus master, medium devsel, latency 0, IRQ 169
>        I/O ports at <ignored>
>        I/O ports at <ignored>
>        I/O ports at <ignored>
>        I/O ports at <ignored>
>        I/O ports at ffa0 [size=16]
> 00: 86 80 df 27 05 00 88 02 01 8a 01 01 00 00 00 00
> 10: f1 01 00 00 f5 03 00 00 71 01 00 00 75 03 00 00
> 20: a1 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
> 30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00
> 
> 00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family)
> Serial ATA Storage Controller IDE (rev 01) (prog-if 8f [Master SecP
> SecO PriP PriO])
>        Subsystem: Dell: Unknown device 01ad
>        Flags: bus master, 66Mhz, medium devsel, latency 0, IRQ 217
>        I/O ports at fe00 [size=8]
>        I/O ports at fe10 [size=4]
>        I/O ports at fe20 [size=8]
>        I/O ports at fe30 [size=4]
>        I/O ports at fea0 [size=16]
>        Capabilities: <available only to root>
> 00: 86 80 c0 27 07 00 b0 02 01 8f 01 01 00 00 00 00
> 10: 01 fe 00 00 11 fe 00 00 21 fe 00 00 31 fe 00 00
> 20: a1 fe 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
> 30: 00 00 00 00 70 00 00 00 00 00 00 00 05 03 00 00

Can you post the result of the following command.

# lspci -nvvvxxx -s 00:1f.

> through traced the code, and found which caused it:
> at scsi_eh_[port_no] kernel thread, it should reset the bus, before 
> reset it,
> it never check it if have a device. if it should skip it?
> thanks

Hmmm... Not really.  The controller shouldn't report BSY for empty 
channel.  There's a notable exception where PATA pins aren't properly 
pulled resulting in 0xff status on empty channels.  IDE handles the case 
specially but libata doesn't yet.  Can you try the attached patch?

-- 
tejun


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3062 bytes --]

diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 427b73a..c8a1bc6 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2271,11 +2271,14 @@ static inline void ata_tf_to_host(struct
  *	Sleep until ATA Status register bit BSY clears,
  *	or a timeout occurs.
  *
- *	LOCKING: None.
+ *	LOCKING:
+ *	Kernel thread context (may sleep).
+ *
+ *	RETURNS:
+ *	0 on success, -errno otherwise.
  */
-
-unsigned int ata_busy_sleep (struct ata_port *ap,
-			     unsigned long tmout_pat, unsigned long tmout)
+int ata_busy_sleep(struct ata_port *ap,
+		   unsigned long tmout_pat, unsigned long tmout)
 {
 	unsigned long timer_start, timeout;
 	u8 status;
@@ -2283,25 +2286,30 @@ unsigned int ata_busy_sleep (struct ata_
 	status = ata_busy_wait(ap, ATA_BUSY, 300);
 	timer_start = jiffies;
 	timeout = timer_start + tmout_pat;
-	while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
+	while (status != 0xff && (status & ATA_BUSY) &&
+	       time_before(jiffies, timeout)) {
 		msleep(50);
 		status = ata_busy_wait(ap, ATA_BUSY, 3);
 	}
 
-	if (status & ATA_BUSY)
+	if (status != 0xff && (status & ATA_BUSY))
 		ata_port_printk(ap, KERN_WARNING,
 				"port is slow to respond, please be patient\n");
 
 	timeout = timer_start + tmout;
-	while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
+	while (status != 0xff && (status & ATA_BUSY) &&
+	       time_before(jiffies, timeout)) {
 		msleep(50);
 		status = ata_chk_status(ap);
 	}
 
+	if (status == 0xff)
+		return -ENODEV;
+
 	if (status & ATA_BUSY) {
 		ata_port_printk(ap, KERN_ERR, "port failed to respond "
 				"(%lu secs)\n", tmout / HZ);
-		return 1;
+		return -EBUSY;
 	}
 
 	return 0;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 66c3100..eb7d90f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -702,9 +702,8 @@ extern int ata_host_set_suspend(struct a
 				pm_message_t mesg);
 extern void ata_host_set_resume(struct ata_host_set *host_set);
 extern int ata_ratelimit(void);
-extern unsigned int ata_busy_sleep(struct ata_port *ap,
-				   unsigned long timeout_pat,
-				   unsigned long timeout);
+extern int ata_busy_sleep(struct ata_port *ap,
+			  unsigned long timeout_pat, unsigned long timeout);
 extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
 				void *data, unsigned long delay);
 extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
@@ -1019,7 +1018,7 @@ static inline u8 ata_busy_wait(struct at
 		udelay(10);
 		status = ata_chk_status(ap);
 		max--;
-	} while ((status & bits) && (max > 0));
+	} while (status != 0xff && (status & bits) && (max > 0));
 
 	return status;
 }
@@ -1040,7 +1039,7 @@ static inline u8 ata_wait_idle(struct at
 {
 	u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
 
-	if (status & (ATA_BUSY | ATA_DRQ)) {
+	if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
 		unsigned long l = ap->ioaddr.status_addr;
 		if (ata_msg_warn(ap))
 			printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-09-30 14:14 ` Tejun Heo
@ 2006-10-01  1:49   ` Joe Jin
  2006-10-09  3:06     ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Jin @ 2006-10-01  1:49 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, lkml, Jeff Garzik

> # lspci -nvvvxxx -s 00:1f.

00:1f.0 Class 0601: 8086:27b8 (rev 01)
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR+ FastB2B-
        Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0
        Capabilities: <available only to root>
00: 86 80 b8 27 07 01 10 02 01 00 01 06 00 00 80 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00

00:1f.1 Class 0101: 8086:27df (rev 01) (prog-if 8a [Master SecP PriP])
        Subsystem: 1028:01ad
        Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
        Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0
        Interrupt: pin A routed to IRQ 169
        Region 0: I/O ports at <ignored>
        Region 1: I/O ports at <ignored>
        Region 2: I/O ports at <ignored>
        Region 3: I/O ports at <ignored>
        Region 4: I/O ports at ffa0 [size=16]
00: 86 80 df 27 05 00 88 02 01 8a 01 01 00 00 00 00
10: f1 01 00 00 f5 03 00 00 71 01 00 00 75 03 00 00
20: a1 ff 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 0b 01 00 00

00:1f.2 Class 0101: 8086:27c0 (rev 01) (prog-if 8f [Master SecP SecO PriP PriO])
        Subsystem: 1028:01ad
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66Mhz+ UDF- FastB2B+ ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 0
        Interrupt: pin C routed to IRQ 217
        Region 0: I/O ports at fe00 [size=8]
        Region 1: I/O ports at fe10 [size=4]
        Region 2: I/O ports at fe20 [size=8]
        Region 3: I/O ports at fe30 [size=4]
        Region 4: I/O ports at fea0 [size=16]
        Capabilities: <available only to root>
00: 86 80 c0 27 07 00 b0 02 01 8f 01 01 00 00 00 00
10: 01 fe 00 00 11 fe 00 00 21 fe 00 00 31 fe 00 00
20: a1 fe 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 70 00 00 00 00 00 00 00 05 03 00 00

00:1f.3 Class 0c05: 8086:27da (rev 01)
        Subsystem: 1028:01ad
        Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR+ FastB2B-
        Status: Cap- 66Mhz- UDF- FastB2B+ ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Interrupt: pin B routed to IRQ 177
        Region 4: I/O ports at e8a0 [size=32]
00: 86 80 da 27 01 01 80 02 01 00 05 0c 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: a1 e8 00 00 00 00 00 00 00 00 00 00 28 10 ad 01
30: 00 00 00 00 00 00 00 00 00 00 00 00 0a 02 00 00

>
> Hmmm... Not really.  The controller shouldn't report BSY for empty
> channel.  There's a notable exception where PATA pins aren't properly
> pulled resulting in 0xff status on empty channels.  IDE handles the case
> specially but libata doesn't yet.  Can you try the attached patch?
>

it still  occured after apply the patch :(

-Joe

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-01  1:49   ` Joe Jin
@ 2006-10-09  3:06     ` Tejun Heo
  2006-10-09  6:54       ` Joe Jin
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2006-10-09  3:06 UTC (permalink / raw)
  To: Joe Jin; +Cc: linux-ide, lkml, Jeff Garzik

Joe Jin wrote:
> it still  occured after apply the patch :(

SRST failure would have still occurred but 30sec timeout should have 
gone.  Can you post full dmesg?

Also, please test the patch in the following mail.  You can use either 
git or download the full kernel tarball to get the modified kernel.

http://article.gmane.org/gmane.linux.ide/13284

Thanks.

-- 
tejun

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  3:06     ` Tejun Heo
@ 2006-10-09  6:54       ` Joe Jin
  2006-10-09  7:00         ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Jin @ 2006-10-09  6:54 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, lkml, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

> SRST failure would have still occurred but 30sec timeout should have
> gone.  Can you post full dmesg?

Yes it is.
attachment is the output of dmesg

>
> Also, please test the patch in the following mail.  You can use either
> git or download the full kernel tarball to get the modified kernel.
>

Did the pathc against 2.6.19-rc1?
I have test it, but it have not any change and timeout also appeared :(

-Joe

[-- Attachment #2: dmesg.tar.gz --]
[-- Type: application/x-gzip, Size: 7907 bytes --]

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  6:54       ` Joe Jin
@ 2006-10-09  7:00         ` Tejun Heo
  2006-10-09  7:06           ` Tejun Heo
  0 siblings, 1 reply; 11+ messages in thread
From: Tejun Heo @ 2006-10-09  7:00 UTC (permalink / raw)
  To: Joe Jin; +Cc: linux-ide, lkml, Jeff Garzik

Joe Jin wrote:
>> SRST failure would have still occurred but 30sec timeout should have
>> gone.  Can you post full dmesg?
> 
> Yes it is.
> attachment is the output of dmesg

Great.

>> Also, please test the patch in the following mail.  You can use either
>> git or download the full kernel tarball to get the modified kernel.
>>
> 
> Did the pathc against 2.6.19-rc1?
> I have test it, but it have not any change and timeout also appeared :(

It's against libata development tree.  So, you downloaded the tar.gz and 
tested it?

Thanks.

-- 
tejun

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  7:00         ` Tejun Heo
@ 2006-10-09  7:06           ` Tejun Heo
  2006-10-09  7:44             ` Joe Jin
  2006-10-17 23:13             ` Jesse Brandeburg
  0 siblings, 2 replies; 11+ messages in thread
From: Tejun Heo @ 2006-10-09  7:06 UTC (permalink / raw)
  To: Joe Jin; +Cc: linux-ide, lkml, Jeff Garzik

On Mon, Oct 09, 2006 at 04:00:33PM +0900, Tejun Heo wrote:
> Joe Jin wrote:
> >>SRST failure would have still occurred but 30sec timeout should have
> >>gone.  Can you post full dmesg?
> >
> >Yes it is.
> >attachment is the output of dmesg
> 
> Great.
> 
> >>Also, please test the patch in the following mail.  You can use either
> >>git or download the full kernel tarball to get the modified kernel.
> >>
> >
> >Did the pathc against 2.6.19-rc1?
> >I have test it, but it have not any change and timeout also appeared :(
> 
> It's against libata development tree.  So, you downloaded the tar.gz and 
> tested it?

And, one more thing to try.  The following patch should fix your
problem.  It's against v2.6.18.

diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 427b73a..3bc7f57 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2271,11 +2271,14 @@ static inline void ata_tf_to_host(struct
  *	Sleep until ATA Status register bit BSY clears,
  *	or a timeout occurs.
  *
- *	LOCKING: None.
+ *	LOCKING:
+ *	Kernel thread context (may sleep).
+ *
+ *	RETURNS:
+ *	0 on success, -errno otherwise.
  */
-
-unsigned int ata_busy_sleep (struct ata_port *ap,
-			     unsigned long tmout_pat, unsigned long tmout)
+int ata_busy_sleep(struct ata_port *ap,
+		   unsigned long tmout_pat, unsigned long tmout)
 {
 	unsigned long timer_start, timeout;
 	u8 status;
@@ -2283,25 +2286,30 @@ unsigned int ata_busy_sleep (struct ata_
 	status = ata_busy_wait(ap, ATA_BUSY, 300);
 	timer_start = jiffies;
 	timeout = timer_start + tmout_pat;
-	while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
+	while (status != 0xff && (status & ATA_BUSY) &&
+	       time_before(jiffies, timeout)) {
 		msleep(50);
 		status = ata_busy_wait(ap, ATA_BUSY, 3);
 	}
 
-	if (status & ATA_BUSY)
+	if (status != 0xff && (status & ATA_BUSY))
 		ata_port_printk(ap, KERN_WARNING,
 				"port is slow to respond, please be patient\n");
 
 	timeout = timer_start + tmout;
-	while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
+	while (status != 0xff && (status & ATA_BUSY) &&
+	       time_before(jiffies, timeout)) {
 		msleep(50);
 		status = ata_chk_status(ap);
 	}
 
+	if (status == 0xff)
+		return -ENODEV;
+
 	if (status & ATA_BUSY) {
 		ata_port_printk(ap, KERN_ERR, "port failed to respond "
 				"(%lu secs)\n", tmout / HZ);
-		return 1;
+		return -EBUSY;
 	}
 
 	return 0;
@@ -2392,10 +2400,8 @@ static unsigned int ata_bus_softreset(st
 	 * the bus shows 0xFF because the odd clown forgets the D7
 	 * pulldown resistor.
 	 */
-	if (ata_check_status(ap) == 0xFF) {
-		ata_port_printk(ap, KERN_ERR, "SRST failed (status 0xFF)\n");
-		return AC_ERR_OTHER;
-	}
+	if (ata_check_status(ap) == 0xFF)
+		return 0;
 
 	ata_bus_post_reset(ap, devmask);
 
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 66c3100..eb7d90f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -702,9 +702,8 @@ extern int ata_host_set_suspend(struct a
 				pm_message_t mesg);
 extern void ata_host_set_resume(struct ata_host_set *host_set);
 extern int ata_ratelimit(void);
-extern unsigned int ata_busy_sleep(struct ata_port *ap,
-				   unsigned long timeout_pat,
-				   unsigned long timeout);
+extern int ata_busy_sleep(struct ata_port *ap,
+			  unsigned long timeout_pat, unsigned long timeout);
 extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
 				void *data, unsigned long delay);
 extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
@@ -1019,7 +1018,7 @@ static inline u8 ata_busy_wait(struct at
 		udelay(10);
 		status = ata_chk_status(ap);
 		max--;
-	} while ((status & bits) && (max > 0));
+	} while (status != 0xff && (status & bits) && (max > 0));
 
 	return status;
 }
@@ -1040,7 +1039,7 @@ static inline u8 ata_wait_idle(struct at
 {
 	u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
 
-	if (status & (ATA_BUSY | ATA_DRQ)) {
+	if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
 		unsigned long l = ap->ioaddr.status_addr;
 		if (ata_msg_warn(ap))
 			printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",


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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  7:06           ` Tejun Heo
@ 2006-10-09  7:44             ` Joe Jin
  2006-10-09  7:57               ` Tejun Heo
  2006-10-17 23:13             ` Jesse Brandeburg
  1 sibling, 1 reply; 11+ messages in thread
From: Joe Jin @ 2006-10-09  7:44 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-ide, lkml, Jeff Garzik

> > It's against libata development tree.  So, you downloaded the tar.gz and
> > tested it?

no, but at latest kernel 2.6.19-rc1 use the same tree as you said, and
it also can worked


>
> And, one more thing to try.  The following patch should fix your
> problem.  It's against v2.6.18.
>

while applied the patch, error info gone :)

A question: if the status register return 0xFF means the device not exist?
why not use ata_devchk()?

thanks

-Joe

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  7:44             ` Joe Jin
@ 2006-10-09  7:57               ` Tejun Heo
  0 siblings, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2006-10-09  7:57 UTC (permalink / raw)
  To: Joe Jin; +Cc: linux-ide, lkml, Jeff Garzik

Joe Jin wrote:
>> > It's against libata development tree.  So, you downloaded the tar.gz 
>> and
>> > tested it?
> 
> no, but at latest kernel 2.6.19-rc1 use the same tree as you said, and
> it also can worked

I see.  It's irrelevant anyway.

>> And, one more thing to try.  The following patch should fix your
>> problem.  It's against v2.6.18.
>>
> 
> while applied the patch, error info gone :)
> 
> A question: if the status register return 0xFF means the device not exist?
> why not use ata_devchk()?

Many SATA controllers emulate TF registers and pass devchk even when no 
device is attached.  I don't know whether the two conditions can happen 
together - 0xFF status is usually seen on PATA.  Anyways, it's more 
reliable to test 0xFF.  Also, that's what driver/ide has been doing for 
a long long time and we don't want to deviate from it if possible.

-- 
tejun

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-09  7:06           ` Tejun Heo
  2006-10-09  7:44             ` Joe Jin
@ 2006-10-17 23:13             ` Jesse Brandeburg
  2006-10-18 16:24               ` Tejun Heo
  1 sibling, 1 reply; 11+ messages in thread
From: Jesse Brandeburg @ 2006-10-17 23:13 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Joe Jin, linux-ide, lkml, Jeff Garzik

On 10/9/06, Tejun Heo <htejun@gmail.com> wrote:
> On Mon, Oct 09, 2006 at 04:00:33PM +0900, Tejun Heo wrote:
> > Joe Jin wrote:
> > >>SRST failure would have still occurred but 30sec timeout should have
> > >>gone.  Can you post full dmesg?
> > >
> > >Yes it is.
> > >attachment is the output of dmesg
> >
> > Great.
> >
> > >>Also, please test the patch in the following mail.  You can use either
> > >>git or download the full kernel tarball to get the modified kernel.
> > >>
> > >
> > >Did the pathc against 2.6.19-rc1?
> > >I have test it, but it have not any change and timeout also appeared :(
> >
> > It's against libata development tree.  So, you downloaded the tar.gz and
> > tested it?
>
> And, one more thing to try.  The following patch should fix your
> problem.  It's against v2.6.18.
>
> diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
> index 427b73a..3bc7f57 100644
> --- a/drivers/scsi/libata-core.c
> +++ b/drivers/scsi/libata-core.c
> @@ -2271,11 +2271,14 @@ static inline void ata_tf_to_host(struct
>   *     Sleep until ATA Status register bit BSY clears,
>   *     or a timeout occurs.
>   *
> - *     LOCKING: None.
> + *     LOCKING:
> + *     Kernel thread context (may sleep).
> + *
> + *     RETURNS:
> + *     0 on success, -errno otherwise.
>   */
> -
> -unsigned int ata_busy_sleep (struct ata_port *ap,
> -                            unsigned long tmout_pat, unsigned long tmout)
> +int ata_busy_sleep(struct ata_port *ap,
> +                  unsigned long tmout_pat, unsigned long tmout)
>  {
>         unsigned long timer_start, timeout;
>         u8 status;
> @@ -2283,25 +2286,30 @@ unsigned int ata_busy_sleep (struct ata_
>         status = ata_busy_wait(ap, ATA_BUSY, 300);
>         timer_start = jiffies;
>         timeout = timer_start + tmout_pat;
> -       while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
> +       while (status != 0xff && (status & ATA_BUSY) &&
> +              time_before(jiffies, timeout)) {
>                 msleep(50);
>                 status = ata_busy_wait(ap, ATA_BUSY, 3);
>         }
>
> -       if (status & ATA_BUSY)
> +       if (status != 0xff && (status & ATA_BUSY))
>                 ata_port_printk(ap, KERN_WARNING,
>                                 "port is slow to respond, please be patient\n");
>
>         timeout = timer_start + tmout;
> -       while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
> +       while (status != 0xff && (status & ATA_BUSY) &&
> +              time_before(jiffies, timeout)) {
>                 msleep(50);
>                 status = ata_chk_status(ap);
>         }
>
> +       if (status == 0xff)
> +               return -ENODEV;
> +
>         if (status & ATA_BUSY) {
>                 ata_port_printk(ap, KERN_ERR, "port failed to respond "
>                                 "(%lu secs)\n", tmout / HZ);
> -               return 1;
> +               return -EBUSY;
>         }
>
>         return 0;
> @@ -2392,10 +2400,8 @@ static unsigned int ata_bus_softreset(st
>          * the bus shows 0xFF because the odd clown forgets the D7
>          * pulldown resistor.
>          */
> -       if (ata_check_status(ap) == 0xFF) {
> -               ata_port_printk(ap, KERN_ERR, "SRST failed (status 0xFF)\n");
> -               return AC_ERR_OTHER;
> -       }
> +       if (ata_check_status(ap) == 0xFF)
> +               return 0;
>
>         ata_bus_post_reset(ap, devmask);
>
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 66c3100..eb7d90f 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -702,9 +702,8 @@ extern int ata_host_set_suspend(struct a
>                                 pm_message_t mesg);
>  extern void ata_host_set_resume(struct ata_host_set *host_set);
>  extern int ata_ratelimit(void);
> -extern unsigned int ata_busy_sleep(struct ata_port *ap,
> -                                  unsigned long timeout_pat,
> -                                  unsigned long timeout);
> +extern int ata_busy_sleep(struct ata_port *ap,
> +                         unsigned long timeout_pat, unsigned long timeout);
>  extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
>                                 void *data, unsigned long delay);
>  extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
> @@ -1019,7 +1018,7 @@ static inline u8 ata_busy_wait(struct at
>                 udelay(10);
>                 status = ata_chk_status(ap);
>                 max--;
> -       } while ((status & bits) && (max > 0));
> +       } while (status != 0xff && (status & bits) && (max > 0));
>
>         return status;
>  }
> @@ -1040,7 +1039,7 @@ static inline u8 ata_wait_idle(struct at
>  {
>         u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
>
> -       if (status & (ATA_BUSY | ATA_DRQ)) {
> +       if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
>                 unsigned long l = ap->ioaddr.status_addr;
>                 if (ata_msg_warn(ap))
>                         printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
>
> -

Is this patch going to go upstream?  I've been testing 2.6.18 on a
couple different systems and seen the same issue.  I haven't tested
the patch yet.

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

* Re: [PATCH] libata: skip reset on bus not a device
  2006-10-17 23:13             ` Jesse Brandeburg
@ 2006-10-18 16:24               ` Tejun Heo
  0 siblings, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2006-10-18 16:24 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: Joe Jin, linux-ide, lkml, Jeff Garzik

Jesse Brandeburg wrote:
> Is this patch going to go upstream?  I've been testing 2.6.18 on a
> couple different systems and seen the same issue.  I haven't tested
> the patch yet.

The patch is pending review.

http://thread.gmane.org/gmane.linux.ide/13408/focus=13439

-- 
tejun

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

end of thread, other threads:[~2006-10-18 16:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-30  5:06 [PATCH] libata: skip reset on bus not a device Joe Jin
2006-09-30 14:14 ` Tejun Heo
2006-10-01  1:49   ` Joe Jin
2006-10-09  3:06     ` Tejun Heo
2006-10-09  6:54       ` Joe Jin
2006-10-09  7:00         ` Tejun Heo
2006-10-09  7:06           ` Tejun Heo
2006-10-09  7:44             ` Joe Jin
2006-10-09  7:57               ` Tejun Heo
2006-10-17 23:13             ` Jesse Brandeburg
2006-10-18 16:24               ` Tejun Heo

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).