Re: [linux-audio-dev] user lowlatency kernel experience

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] user lowlatency kernel experience
From: John Lazzaro (lazzaro_AT_CS.Berkeley.EDU)
Date: Thu Jun 14 2001 - 04:16:37 EEST


> Joakim Verona writes:

> my experience was that it became very easy to hang the system.if csound
> got to many notes, it would render forever end never return, thus
> effectively hanging my machine.

Sfront compares the total number of bytes written to the D/A before and
after each write() to the soundcard (via the SNDCTL_DSP_GETOPTR ioctl),
and uses this as a heuristic to detect if the write() blocked or not.
One would think a simple select() would be a better way to determine
this, but I can't recall if I didn't use select() purposely, or if
there was a bug in a driver or some secondary issue.

At any rate, if it notices that too long of a time period has passed
without a write() block, it lets go of SCHED_FIFO, under the assumption
that it is computing just fast enough so that a block doesn't happen for
an extended period of time, thereby locking up the screen to the user.

In addition, a watchdog timer is set up to catch SAOL infinite loops
(the write() check above would not suffice in this case), and the
priority level (sched_get_priority_max(SCHED_FIFO) - 1) is chosen so
that an emergency application can use sched_get_priority_max(SCHED_FIFO)
[although I agree with Benno that even sched_get_priority_max(SCHED_FIFO)
- 1 is too high].

However, its unclear to me that, even with all of these precautions,
running sfront (and by sfront in this email, I always mean "the sa.c
file sfront creates) with another SCHED_FIFO application is a safe
thing to do -- I never tested it in this way, since there has never
been a second application people have asked me to test. I would
strongly recommend not using a production machine if you try to use
sfront with another SCHED_FIFO application, back up your disks, etc --
the worst could happen, I almost lost my disk contents a few times
when I was developing the linux driver for sfront, although since we
keep all important files on our NetApp boxes here, there's little
long-term risk from losing a local disk (just the hassle of a reinstall).

-------------------------------------------------------------------------
John Lazzaro -- Research Specialist -- CS Division -- EECS -- UC Berkeley
lazzaro [at] cs [dot] berkeley [dot] edu www.cs.berkeley.edu/~lazzaro
-------------------------------------------------------------------------


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Jun 14 2001 - 06:14:18 EEST