From owner-freebsd-stable@FreeBSD.ORG Sun Jul 3 00:37:58 2005 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 02BDE16A4F0; Sun, 3 Jul 2005 00:37:42 +0000 (GMT) (envelope-from ps@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 72AAC444B6; Sun, 3 Jul 2005 00:21:31 +0000 (GMT) (envelope-from ps@mu.org) Received: by elvis.mu.org (Postfix, from userid 1000) id 95D3D624E7; Sat, 2 Jul 2005 17:20:08 -0700 (PDT) X-Original-To: ps@mu.org Delivered-To: ps@mu.org Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by elvis.mu.org (Postfix) with ESMTP id 9A6D75C900; Sun, 27 Feb 2005 15:12:42 -0800 (PST) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 2FF5257F90; Sun, 27 Feb 2005 23:12:41 +0000 (GMT) (envelope-from owner-freebsd-current@freebsd.org) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 4019C16A500; Sun, 27 Feb 2005 23:12:37 +0000 (GMT) Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 173C816A4CE; Sun, 27 Feb 2005 23:12:32 +0000 (GMT) Received: from ylpvm29.prodigy.net (ylpvm29-ext.prodigy.net [207.115.57.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9637543D41; Sun, 27 Feb 2005 23:12:31 +0000 (GMT) (envelope-from nate@root.org) Received: from [10.0.0.115] (adsl-64-171-186-189.dsl.snfc21.pacbell.net [64.171.186.189])j1RNC3cE002157; Sun, 27 Feb 2005 18:12:03 -0500 Message-ID: <422253D7.7000504@root.org> From: Nate Lawson User-Agent: Mozilla Thunderbird 1.0RC1 (X11/20041205) X-Accept-Language: en-us, en MIME-Version: 1.0 To: current@freebsd.org References: <42224897.7050006@root.org> In-Reply-To: <42224897.7050006@root.org> Content-Type: multipart/mixed; boundary="------------080500050504090500060207" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Sender: owner-freebsd-current@freebsd.org Errors-To: owner-freebsd-current@freebsd.org X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on elvis.mu.org X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Level: Cc: stable@freebsd.org Subject: Re: patch: fix 30 second hang while resuming X-BeenThere: freebsd-stable@freebsd.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Sun, 03 Jul 2005 00:37:59 -0000 X-Original-Date: Sun, 27 Feb 2005 15:12:23 -0800 X-List-Received-Date: Sun, 03 Jul 2005 00:37:59 -0000 This is a multi-part message in MIME format. --------------080500050504090500060207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Nate Lawson wrote: > My system hangs a long time in ata_generic_reset() while resuming. I > did some hunting and found that the loop was running for the full 310 * > 100 ms (31 seconds). The bug is that the loop never exits when mask > goes to 0 even though this is a termination condition (see end of the > loop where the code masks off 1 and 2). > > The attached patch fixes this by exiting when the mask is set to 0 > instead of looping the full 31 seconds. This is correct since setting > the mask to 0 is how the loop marks master/slave "done". It also has a > minor whitespace fix. Apologies, the last patch was not quite right. You need to check that both status values are not "busy" as well as the mask. This check could be merged in elsewhere as well. This was just a convenient place to put it. Please use the attached patch instead. -- Nate --------------080500050504090500060207 Content-Type: text/plain; name="ata_resume.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ata_resume.diff" Index: sys/dev/ata/ata-lowlevel.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-lowlevel.c,v retrieving revision 1.51 diff -u -r1.51 ata-lowlevel.c --- sys/dev/ata/ata-lowlevel.c 24 Dec 2004 13:38:25 -0000 1.51 +++ sys/dev/ata/ata-lowlevel.c 27 Feb 2005 23:09:17 -0000 @@ -619,8 +619,11 @@ (stat1 == err && lsb == err && msb == err && timeout > 5)) mask &= ~0x02; } + if (mask == 0 && !(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) + break; + ata_udelay(100000); - } + } if (bootverbose) ata_printf(ch, -1, --------------080500050504090500060207 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" --------------080500050504090500060207--