linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Martin Mokrejs <mmokrejs@fold.natur.cuni.cz>
Cc: Jeff Garzik <jgarzik@pobox.com>, cwillu <cwillu@cwillu.com>,
	Mark Lord <kernel@teksavvy.com>, Tejun Heo <htejun@gmail.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>,
	Gwendal Grignou <gwendal@google.com>,
	Grant Grundler <grundler@google.com>
Subject: Re: Hotplug borked after suspend/resume in Linux-3.3 ?
Date: Thu, 19 Apr 2012 16:16:02 +0800	[thread overview]
Message-ID: <1334823362.11188.172.camel@minggr> (raw)
In-Reply-To: <CAF1ivSYqzjv10F+sdYkR_jdTZvzKP1=_ZwgNDj2njnmb6uaenA@mail.gmail.com>

On Thu, Apr 19, 2012 at 2:32 AM, Martin Mokrejs <mmokrejs@fold.natur.cuni.cz> wrote:
> Martin Mokrejs wrote:
>>
>>
>> Jeff Garzik wrote:
>>> On 04/18/2012 01:10 PM, Martin Mokrejs wrote:
>>>> Fix: I got my 3TB disk detected by this single command:
>>>>
>>>> # echo on>   /sys/devices/pci0000:00/0000:00:1f.2/ata6/power/control
>>>> #
>>>>
>>>> This is a Dell Vostro 3550 with A09 BIOS. Same happend with 3.4-rc3 kernel.
>>>>
>>>> I can do some more testing if you want me to.
>>>> Best,
>>>> Martin
>>>
>>>
>>> Can you test this one-line patch from Lin Ming?  Hopefully there is zero sysfs twiddling required with this one...
>>>
>>> --- a/drivers/ata/libata-transport.c
>>> +++ b/drivers/ata/libata-transport.c
>>> @@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent,
>>>      device_enable_async_suspend(dev);
>>>      pm_runtime_set_active(dev);
>>>      pm_runtime_enable(dev);
>>> +    pm_runtime_forbid(dev);
>>>
>>>      transport_add_device(dev);
>>>      transport_configure_device(dev);
>
>
> There is one more minor issue. I cannot get my disk re-dectected at 3Gbps. Here is when I plugged it in
> for the very first time after bootup (plain 3.4-rc3 with the above one-line fix):

I did bisect and found that this is a really old regression introduced
in 2.6.37-rc1 with below commit.

commit d9027470b88631d0956ac37cdadfdeb9cdcf2c99
Author: Gwendal Grignou <gwendal@google.com>
Date:   Tue May 25 12:31:38 2010 -0700

    [libata] Add ATA transport class

    This is a scheleton for libata transport class.
    All information is read only, exporting information from libata:
    - ata_port class: one per ATA port
    - ata_link class: one per ATA port or 15 for SATA Port Multiplier
    - ata_device class: up to 2 for PATA link, usually one for SATA.

    Signed-off-by: Gwendal Grignou <gwendal@google.com>
    Reviewed-by: Grant Grundler <grundler@google.com>
    Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


Here is the patch to fix it.

Gwendal and Grant,

Would you help to review it?


>From f696daec7ff63e9b3697e8f7ef8f985152667965 Mon Sep 17 00:00:00 2001
From: Lin Ming <ming.m.lin@intel.com>
Date: Thu, 19 Apr 2012 15:45:51 +0800
Subject: [PATCH] libata: clear error mask of old error history

The old error history was cleared in ata_ering_clear().
It only sets ATA_EFLAG_OLD_ER eflags, but the err_mask was not cleared.
So ata_ering_map() still iterates the old error history.

This causes problem, for example, wrong probe trials count were returned in
ata_eh_schedule_probe(), which in turn causes SATA link speed to be slowed down
to 1.5Gbps.

Reported-by: Martin Mokrejs <mmokrejs@fold.natur.cuni.cz>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---
 drivers/ata/libata-eh.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index c61316e..4c6f49b 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -419,9 +419,10 @@ int ata_ering_map(struct ata_ering *ering,
 	return rc;
 }
 
-int ata_ering_clear_cb(struct ata_ering_entry *ent, void *void_arg)
+static int ata_ering_clear_cb(struct ata_ering_entry *ent, void *void_arg)
 {
 	ent->eflags |= ATA_EFLAG_OLD_ER;
+	ent->err_mask = 0;
 	return 0;
 }
 
-- 
1.7.2.5



>
> [  146.876489] ata6: exception Emask 0x10 SAct 0x0 SErr 0x4050000 action 0xe frozen
> [  146.876499] ata6: irq_stat 0x00400040, connection status changed
> [  146.876508] ata6: SError: { PHYRdyChg CommWake DevExch }
> [  146.876527] ata6: hard resetting link
> [  147.619956] ata6: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
> [  147.869349] ata6.00: ATA-8: ST3000DM001-9YN166, CC4C, max UDMA/133
> [  147.869360] ata6.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> [  147.870126] ata6.00: configured for UDMA/133
> [  147.870131] ata6: EH complete
> [  147.870220] scsi 5:0:0:0: Direct-Access     ATA      ST3000DM001-9YN1 CC4C PQ: 0 ANSI: 5
> [  147.870391] sd 5:0:0:0: [sdc] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
> [  147.870393] sd 5:0:0:0: [sdc] 4096-byte physical blocks
> [  147.870396] sd 5:0:0:0: Attached scsi generic sg3 type 0
> [  147.870434] sd 5:0:0:0: [sdc] Write Protect is off
> [  147.870436] sd 5:0:0:0: [sdc] Mode Sense: 00 3a 00 00
> [  147.870460] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [  147.904848]  sdc: sdc1
> [  147.905196] sd 5:0:0:0: [sdc] Attached SCSI disk
>
>
> Here is what happens on re-plug of the device. It is a 3.5" drive and the line
> [  617.838013] ata6: hard resetting link
> happens too early. I can hear the drive is still spinning up, it can't be ready yet.
> I think the delay should be increased.
>
>
> [  617.837966] ata6: exception Emask 0x10 SAct 0x0 SErr 0x4050002 action 0xe frozen
> [  617.837976] ata6: irq_stat 0x00400040, connection status changed
> [  617.837984] ata6: SError: { RecovComm PHYRdyChg CommWake DevExch }
> [  617.838004] ata6: limiting SATA link speed to 1.5 Gbps
> [  617.838013] ata6: hard resetting link
> [  623.610941] ata6: link is slow to respond, please be patient (ready=0)
> [  627.864604] ata6: COMRESET failed (errno=-16)
> [  627.864615] ata6: hard resetting link
> [  629.931538] ata6: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
> [  629.932355] ata6.00: ATA-8: ST3000DM001-9YN166, CC4C, max UDMA/133
> [  629.932365] ata6.00: 5860533168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
> [  629.933170] ata6.00: configured for UDMA/133
> [  629.951629] ata6: EH complete
> [  629.951700] scsi 5:0:0:0: Direct-Access     ATA      ST3000DM001-9YN1 CC4C PQ: 0 ANSI: 5
> [  629.951816] sd 5:0:0:0: [sdc] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
> [  629.951819] sd 5:0:0:0: [sdc] 4096-byte physical blocks
> [  629.951842] sd 5:0:0:0: Attached scsi generic sg3 type 0
> [  629.951875] sd 5:0:0:0: [sdc] Write Protect is off
> [  629.951877] sd 5:0:0:0: [sdc] Mode Sense: 00 3a 00 00
> [  629.951901] sd 5:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [  629.995970]  sdc: sdc1
> [  629.996359] sd 5:0:0:0: [sdc] Attached SCSI disk
>
>
> Martin



  parent reply	other threads:[~2012-04-19  8:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17 20:38 Hotplug borked after suspend/resume in Linux-3.3 ? Mark Lord
2012-04-17 20:48 ` Mark Lord
2012-04-17 20:51   ` Tejun Heo
2012-04-17 20:53   ` Mark Lord
2012-04-17 21:02     ` Mark Lord
2012-04-17 21:05       ` cwillu
2012-04-18 17:10         ` Martin Mokrejs
2012-04-18 17:29           ` Jeff Garzik
2012-04-18 17:44             ` Martin Mokrejs
2012-04-18 18:23               ` Martin Mokrejs
2012-04-18 18:32               ` Martin Mokrejs
2012-04-19  1:31                 ` Lin Ming
     [not found]                 ` <CAF1ivSYqzjv10F+sdYkR_jdTZvzKP1=_ZwgNDj2njnmb6uaenA@mail.gmail.com>
2012-04-19  8:16                   ` Lin Ming [this message]
2012-04-19 17:28                     ` Martin Mokrejs
2012-04-19 18:22                     ` Martin Mokrejs
2012-04-20  1:46                       ` Lin Ming
2012-04-20  2:37                     ` Grant Grundler
2012-04-26  9:29                       ` Gwendal Grignou
2012-04-26 13:06                         ` Lin Ming
2012-04-26 16:50                           ` Gwendal Grignou
2012-05-03  1:26                         ` Lin Ming
2012-05-19 23:58             ` [PATCH 3.3.y] libata: forbid port runtime pm by default, fixing regression Jonathan Nieder
2012-05-24 17:30               ` Greg KH
2012-04-17 21:04     ` Hotplug borked after suspend/resume in Linux-3.3 ? Jeff Garzik
2012-04-17 20:57   ` Jeff Garzik
2012-04-17 21:05     ` Mark Lord
2012-04-17 21:10       ` Jeff Garzik
2012-04-17 21:16         ` Mark Lord
     [not found]           ` <CAF1ivSbEWJ18vV1ZqTnzWuZ5AXKwj+0pPPzCWUmnT_JKwKKQ2w@mail.gmail.com>
2012-04-18  1:29             ` Lin Ming
2012-04-18  1:37               ` Mark Lord
2012-04-18  1:46                 ` Mark Lord
2012-04-18  6:18                   ` Jeff Garzik
2012-04-18  1:52         ` Lin Ming
2012-04-18  2:28           ` Jeff Garzik
2012-04-17 20:50 ` Jeff Garzik
2012-04-17 21:07   ` Mark Lord
2012-04-17 21:14   ` Mark Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334823362.11188.172.camel@minggr \
    --to=ming.m.lin@intel.com \
    --cc=cwillu@cwillu.com \
    --cc=grundler@google.com \
    --cc=gwendal@google.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=kernel@teksavvy.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=mmokrejs@fold.natur.cuni.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).