From patchwork Thu Apr 19 08:16:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 153680 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5A442B6FA3 for ; Thu, 19 Apr 2012 18:16:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752795Ab2DSIQM (ORCPT ); Thu, 19 Apr 2012 04:16:12 -0400 Received: from mga01.intel.com ([192.55.52.88]:53997 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870Ab2DSIQG (ORCPT ); Thu, 19 Apr 2012 04:16:06 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 19 Apr 2012 01:16:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="155471956" Received: from minggr.sh.intel.com (HELO [10.239.36.45]) ([10.239.36.45]) by fmsmga002.fm.intel.com with ESMTP; 19 Apr 2012 01:16:03 -0700 Subject: Re: Hotplug borked after suspend/resume in Linux-3.3 ? From: Lin Ming To: Martin Mokrejs Cc: Jeff Garzik , cwillu , Mark Lord , Tejun Heo , IDE/ATA development list , Gwendal Grignou , Grant Grundler In-Reply-To: References: <4F8DD4DC.4050503@teksavvy.com> <4F8DD708.8050502@teksavvy.com> <4F8DD834.5070000@teksavvy.com> <4F8DDA53.206@teksavvy.com> <4F8EF57E.4070603@fold.natur.cuni.cz> <4F8EF9F7.5040202@pobox.com> <4F8EFD89.2080603@fold.natur.cuni.cz> <4F8F08D7.6050809@fold.natur.cuni.cz> Date: Thu, 19 Apr 2012 16:16:02 +0800 Message-ID: <1334823362.11188.172.camel@minggr> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On Thu, Apr 19, 2012 at 2:32 AM, Martin Mokrejs 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 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 Reviewed-by: Grant Grundler Signed-off-by: Jeff Garzik 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 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 Signed-off-by: Lin Ming Reviewed-by: Grant Grundler --- 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; }