Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 1997 11:56:35 -0400 (EDT)
From:      Alfred Perlstein <perlsta@fang.cs.sunyit.edu>
To:        Hans Zuidam <hans@brandinnovators.com>
Cc:        dwhite@resnet.uoregon.edu, hackers@freebsd.org
Subject:   Re: Apparent bug in /dev/spkr driver (fwd)
Message-ID:  <Pine.BSF.3.95.970417115214.11465A-100000@fang.cs.sunyit.edu>
In-Reply-To: <199704170755.JAA12959@truk.brandinnovators.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 17 Apr 1997, Hans Zuidam wrote:

> > The problem seems to have to do with a race condition and/or with kernel
> > memory allocation. I'm not terribly familiar with BSD kernel programming,
> > and there's no documentation on the full implications of some items in the
> > driver code, so I'm not sure how to pinpoint the problem.
> > 
> > Can someone help to identify the source of the problem and a fix for it?
> Maybe this helps...
> 
> In the speaker driver it does:
> 
> 	n = uio->uio_resid;
> 	cp = spkr_inbuf->b_un.b_addr;
> 	if (!(error = uiomove(cp, n, uio)))
> 		playstring(cp, n);
> 
> According to a discussion I had with Bruce Evans because of a
> similar problem in a home grown driver, it seems that uiomove()
> can sleep and that therefore another uiomove() may mess up the
> driver's buffers.  The speaker driver should lock its buffer before
> doing the uiomove().  Actually, many drivers do not lock their private
> I/O buffers before uiomove()-ing.  Hope this helps a bit.

I'm very new to kernel programming (my first time) but would a patch
baisically to set a flag to see if the deivce is busy and then queuing up
requests until the sleep is done?  i'm worrired though, does the code for
this driver run until completion? no right? so could i have an outer loop
there that loops until the bufferes that i create are eaten up by the
innner loop that you posted?  or should i just leave it to the experts?  i
would really like to help though.

Al
perlsta@cs.sunyit.edu




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970417115214.11465A-100000>