From owner-freebsd-scsi@FreeBSD.ORG Wed Feb 27 13:11:09 2008 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9E81065670; Wed, 27 Feb 2008 13:11:09 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from smtp2.enst.fr (revol2.enst.fr [137.194.2.14]) by mx1.freebsd.org (Postfix) with ESMTP id 895AF8FC25; Wed, 27 Feb 2008 13:11:09 +0000 (UTC) (envelope-from beyssac@bofh.enst.fr) Received: from localhost (localhost.enst.fr [127.0.0.1]) by smtp2.enst.fr (Postfix) with ESMTP id 3B999B8253; Wed, 27 Feb 2008 13:50:34 +0100 (CET) X-Virus-Scanned: amavisd-new at enst.fr Received: from bofh.enst.fr (bofh.enst.fr [137.194.32.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by smtp2.enst.fr (Postfix) with ESMTP id E030FB81B0; Wed, 27 Feb 2008 13:50:33 +0100 (CET) Received: from bofh.enst.fr (localhost [127.0.0.1]) by bofh.enst.fr (8.14.2/8.14.2) with ESMTP id m1RCoXb2035981; Wed, 27 Feb 2008 13:50:33 +0100 (CET) (envelope-from beyssac@bofh.enst.fr) Received: (from beyssac@localhost) by bofh.enst.fr (8.14.2/8.14.2/Submit) id m1RCoX5I035980; Wed, 27 Feb 2008 13:50:33 +0100 (CET) (envelope-from beyssac) Date: Wed, 27 Feb 2008 13:50:33 +0100 From: Pierre Beyssac To: Ivan Voras Message-ID: <20080227125033.GA35933@bofh.enst.fr> References: <4A66E92B3FBF8541A78CD11D1C0E3CFC491D952009@wp-ex02.hq.webpartner.dk> <20080226155813.GD75747@bofh.enst.fr> <20080226160527.GE75747@bofh.enst.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-message-flag: Warning! Use of Microsoft Outlook makes your system susceptible to worms and viruses Cc: freebsd-scsi@freebsd.org Subject: Re: iscsi initiator speed very low in FreeBSD 7 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 13:11:09 -0000 On Wed, Feb 27, 2008 at 01:45:35PM +0100, Ivan Voras wrote: > > Better with the patch... :-) > I think you need to send a file with a .txt extension for it to pass the > spam / list filters. Here it is inline... --- isc_sm.c 2007-07-24 17:35:02.000000000 +0200 +++ /tmp/isc_sm.c 2008-02-26 16:53:54.000000000 +0100 @@ -325,7 +325,9 @@ mtx_unlock(&sp->io_mtx); // XXX } #else + mtx_lock(&sp->io_mtx); // XXX wakeup(&sp->flags); + mtx_unlock(&sp->io_mtx); // XXX #endif return error; } @@ -454,6 +456,11 @@ } } +/* + * Should be called with sp->io_mtx held to avoid race condition + * on queue empty. + * Returns with sp->io_mtx held. + */ static int proc_out(isc_session_t *sp) { @@ -481,6 +488,8 @@ if((pq = i_dqueue_snd(sp, which)) == NULL) break; + mtx_unlock(&sp->io_mtx); + pp = &pq->pdu; bhs = &pp->ipdu.bhs; switch(bhs->opcode) { @@ -523,6 +532,8 @@ xdebug("error=%d ndone=%d opcode=0x%x ccb=%p itt=%x", error, ndone, bhs->opcode, pq->ccb, ntohl(bhs->itt)); if(error == EPIPE) { + pdu_free(sp->isc, pq); + mtx_lock(&sp->io_mtx); // XXX: better do some error recovery ... break; } @@ -540,6 +551,7 @@ } if(pq->ccb == NULL || error) pdu_free(sp->isc, pq); + mtx_lock(&sp->io_mtx); } return ndone; } @@ -558,13 +570,13 @@ sp->flags |= ISC_SM_RUNNING; do { + mtx_lock(&sp->io_mtx); if(sp->flags & ISC_SM_HOLD) odone = 0; else odone = proc_out(sp); sdebug(7, "odone=%d", odone); if(odone == 0) { - mtx_lock(&sp->io_mtx); #ifdef ISC_OWAITING sp->flags |= ISC_OWAITING; #endif @@ -574,8 +586,8 @@ #ifdef ISC_OWAITING sp->flags &= ~ISC_OWAITING; #endif - mtx_unlock(&sp->io_mtx); } + mtx_unlock(&sp->io_mtx); } while(sp->flags & ISC_SM_RUN); sp->flags &= ~ISC_SM_RUNNING; -- A: Yes. Pierre Beyssac pb@enst.fr >Q: Are you sure? >>A: Because it reverses the logical flow of conversation. >>>Q: Why is top posting annoying in email?