From seva@sevasoft.alex-ua.com Mon Aug 30 05:37:47 1999
Return-Path: <seva@sevasoft.alex-ua.com>
Received: from sevasoft.alex-ua.com (sevasoft.alex-ua.com [195.123.18.144])
	by hub.freebsd.org (Postfix) with ESMTP id 2096814ECE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Aug 1999 05:37:39 -0700 (PDT)
	(envelope-from seva@sevasoft.alex-ua.com)
Received: (from seva@localhost)
	by sevasoft.alex-ua.com (8.9.3/8.9.3) id PAA60807;
	Mon, 30 Aug 1999 15:34:17 +0300 (EEST)
	(envelope-from seva)
Message-Id: <199908301234.PAA60807@sevasoft.alex-ua.com>
Date: Mon, 30 Aug 1999 15:34:17 +0300 (EEST)
From: Vsevolod Lobko <seva@sevasoft.alex-ua.com>
Reply-To: seva@sevasoft.alex-ua.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] Low ATAPI performance with block devices (sys/i386/isa/atapi.c)
X-Send-Pr-Version: 3.2

>Number:         13468
>Category:       i386
>Synopsis:       [PATCH] incorrect wakeup argument in atapi_free()
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    luoqi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 30 05:40:01 PDT 1999
>Closed-Date:    Mon Aug 30 11:38:52 PDT 1999
>Last-Modified:  Mon Aug 30 11:39:42 PDT 1999
>Originator:     Vsevolod Lobko
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
None
>Environment:

	3.2-STABLE

>Description:

When using block devices system places many concurent commands for device

ATAPI driver have static buffer for 16 commands, and after 16 commands, 
atapi_alloc tsleep's on ata structure

atapi_free have wakeup, but with incorrect sleep addr &ata

>How-To-Repeat:

dd if=/dev/zero of=/dev/rwfd0 bs=2k count=100
and 
dd if=/dev/zero of=/dev/wfd0 bs=2k count=100

have very different transfer rates

>Fix:
	
Apply patch:

Index: atapi.c
===================================================================
RCS file: /home/free_rep/src/sys/i386/isa/atapi.c,v
retrieving revision 1.34
diff -u -r1.34 atapi.c
--- atapi.c	1999/04/19 18:44:16	1.34
+++ atapi.c	1999/08/30 12:22:41
@@ -507,11 +507,10 @@
 
 static void atapi_free (struct atapi *ata, struct atapicmd *ac)
 {
-	if (! ata->free)
-		wakeup ((caddr_t)&ata);
 	ac->busy = 0;
 	ac->next = ata->free;
 	ata->free = ac;
+	wakeup ((caddr_t)ata);
 }
 
 /*


>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: seva@sevasoft.alex-ua.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: i386/13468: [PATCH] Low ATAPI performance with block devices (sys/i386/isa/atapi.c) 
Date: Mon, 30 Aug 1999 15:35:18 +0200

 On Mon, 30 Aug 1999 15:34:17 +0300, Vsevolod Lobko wrote:
 
 > When using block devices system places many concurent commands for
 > device
 
 Do you find the same poor performance with the now ata driver?
 
 Ciao,
 Sheldon.
 

From: Vsevolod Lobko <seva@alex-ua.com>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: i386/13468: [PATCH] Low ATAPI performance with block devices
 (sys/i386/isa/atapi.c) 
Date: Mon, 30 Aug 1999 16:40:50 +0300 (EEST)

 On Mon, 30 Aug 1999, Sheldon Hearn wrote:
 
 > 
 > 
 > On Mon, 30 Aug 1999 15:34:17 +0300, Vsevolod Lobko wrote:
 > 
 > > When using block devices system places many concurent commands for
 > > device
 > 
 > Do you find the same poor performance with the now ata driver?
 
 I don't check this.
 I need working atapi support on stable branch :)) (It's an embedded 
 system)
 
 
Responsible-Changed-From-To: freebsd-bugs->luoqi 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 30 07:00:55 PDT 1999 
Responsible-Changed-Why:  
Luoqi, could you take a look at this? The originator's using STABLE, 
despite the Environment: field in the PR. 
State-Changed-From-To: open->closed 
State-Changed-By: luoqi 
State-Changed-When: Mon Aug 30 11:38:52 PDT 1999 
State-Changed-Why:  
Fix committed. 
>Unformatted:
