Re: via82cxxx_audio locking problems

From: Thomas Sailer (sailer@scs.ch)
Date: Fri Sep 21 2001 - 04:27:38 EST


Jeff Garzik schrieb:

> Is there a possibility of do_read being re-entered during that window?
> I agree its a problem but the solution sounds racy?

do_read may be reentered. In that case some of the samples land in one read,
the other part in the other read.

This is not a problem, however. UNIX never made any guarantees about
read from or writes to the same fd. Take pipes for example, they don't
guarantee read or write atomicity either. Well, they do guarantee it
if they are all less than PIPEBUF in size. But so do we, the limit
is not called PIPEBUF, but fragment.

> I disagree; I think the idea at aleast is correct: if contention
> exists, it implies that I/O needs to be completed.

Well, it depends what the semaphore is supposed to do. If you (ab)use
it as a waitqueue, then yes, the idea is correct. If you only use it
to guard short critical sections, then the cost of reissuing the syscall
is greater than just waiting for the semaphore to be released.

This is the patch I've tested yesterday. It worked so far.

There is however an unrelated problem that happens both with and without
patch. Sometimes playback sound is very distorted, until I either press
stop, then the remaining second or so continues undistortedly, or I try
to debug the problem. Debugging is anyway difficult without reasonable
docs. It may be a PCI bridge latency issue, as the VIA northbridge my
board uses is fairly crappy.

Tom


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 23 2001 - 21:00:42 EST