From owner-freebsd-current@FreeBSD.ORG Wed Nov 26 10:57:14 2003 Return-Path: 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 64C8F16A4CE for ; Wed, 26 Nov 2003 10:57:14 -0800 (PST) Received: from hak.cnd.mcgill.ca (hak.cnd.mcgill.ca [132.216.11.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80CA643FE1 for ; Wed, 26 Nov 2003 10:57:12 -0800 (PST) (envelope-from mat@hak.cnd.mcgill.ca) Received: from hak.cnd.mcgill.ca (localhost [127.0.0.1]) by hak.cnd.mcgill.ca (8.12.9/8.12.8) with ESMTP id hAQIsa15017671 for ; Wed, 26 Nov 2003 13:54:36 -0500 (EST) (envelope-from mat@hak.cnd.mcgill.ca) Received: (from mat@localhost) by hak.cnd.mcgill.ca (8.12.9/8.12.8/Submit) id hAQIsaJq017670 for freebsd-current@freebsd.org; Wed, 26 Nov 2003 13:54:36 -0500 (EST) Date: Wed, 26 Nov 2003 13:54:36 -0500 From: Mathew Kanner To: freebsd-current@freebsd.org Message-ID: <20031126185436.GF10278@cnd.mcgill.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="H1spWtNR+x+ondvy" Content-Disposition: inline User-Agent: Mutt/1.4.1i Organization: I speak for myself, operating in Montreal, CANADA X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on hak.cnd.mcgill.ca Subject: please test pcm patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2003 18:57:14 -0000 --H1spWtNR+x+ondvy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello All, Please test a pcm patch that releases the channel lock around calls to uio move. This is a more complete patch than the previous one as it also does the _read routine. I will ask the RE to commit this if I hear a couple of "it works". Pointed out by: Artur Poplawski Explained by: Don Lewis --Mat -- sig machine broken --H1spWtNR+x+ondvy Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="channel_uiolor.patch" --- channel.c Sun Nov 9 04:17:22 2003 +++ /sys/dev/sound/pcm/channel.c Wed Nov 26 13:50:20 2003 @@ -250,6 +250,8 @@ { int ret, timeout, newsize, count, sz; struct snd_dbuf *bs = c->bufsoft; + void *off; + int t, x,togo,p; CHN_LOCKASSERT(c); /* @@ -291,7 +293,22 @@ sz = MIN(sz, buf->uio_resid); KASSERT(sz > 0, ("confusion in chn_write")); /* printf("sz: %d\n", sz); */ +#if 0 ret = sndbuf_uiomove(bs, buf, sz); +#else + togo = sz; + while (ret == 0 && togo> 0) { + p = sndbuf_getfreeptr(bs); + t = MIN(togo, sndbuf_getsize(bs) - p); + off = sndbuf_getbufofs(bs, p); + CHN_UNLOCK(c); + ret = uiomove(off, t, buf); + CHN_LOCK(c); + togo -= t; + x = sndbuf_acquire(bs, NULL, t); + } + ret = 0; +#endif if (ret == 0 && !(c->flags & CHN_F_TRIGGERED)) chn_start(c, 0); } @@ -395,6 +412,8 @@ { int ret, timeout, sz, count; struct snd_dbuf *bs = c->bufsoft; + void *off; + int t, x,togo,p; CHN_LOCKASSERT(c); if (!(c->flags & CHN_F_TRIGGERED)) @@ -406,7 +425,22 @@ sz = MIN(buf->uio_resid, sndbuf_getready(bs)); if (sz > 0) { +#if 0 ret = sndbuf_uiomove(bs, buf, sz); +#else + togo = sz; + while (ret == 0 && togo> 0) { + p = sndbuf_getreadyptr(bs); + t = MIN(togo, sndbuf_getsize(bs) - p); + off = sndbuf_getbufofs(bs, p); + CHN_UNLOCK(c); + ret = uiomove(off, t, buf); + CHN_LOCK(c); + togo -= t; + x = sndbuf_dispose(bs, NULL, t); + } + ret = 0; +#endif } else { if (c->flags & CHN_F_NBIO) { ret = EWOULDBLOCK; --H1spWtNR+x+ondvy--