Re: [Fwd: Re: [patch] Real-Time Preemption, -RT-2.6.9-mm1-V0.4]

Ingo Molnar
2004-10-30T11:27:52Z

* Lee Revell <rlrevell@joe-job.com> wrote:

> Ingo, here are some of my traces with the same settings. These do
> seem to correspond to the xruns. Many of them look tty related -
> could the recent changes to the tty layer be responsible? Possibly
> this has nothing to do with RT preempt, but is an unrelated bug in
> -mm? The xruns do seem to correspond to display activity such as
> switching tabs in gnome-terminal.
>
> jackd:1507 userspace BUG: scheduling in user-atomic context!
> [<c01069fc>] dump_stack+0x1c/0x20 (20)
> [<c02834d0>] schedule+0x70/0x100 (24)
> [<c010639b>] work_resched+0x6/0x17 (-8124)

ok, this shows jackd getting preempted by a higher-prio task. This could
be the watchdog thread - could you chrt the watchdog thread to make sure
jackd itself never gets (legitimately) preempted by any other thread?

also, in my tree i fixed this codepath to not trigger an atomicity
warning, since this is an involuntary rescheduling event.

> jackd:1507 userspace BUG: scheduling in user-atomic context!
> [<c01069fc>] dump_stack+0x1c/0x20 (20)
> [<c02834d0>] schedule+0x70/0x100 (24)
> [<c028465d>] down_write_mutex+0xbd/0x180 (36)
> [<c012cbf6>] __mutex_lock+0x36/0x40 (16)
> [<c012cc75>] _mutex_lock_irqsave+0x15/0x20 (16)
> [<c01f1237>] tty_ldisc_try+0x17/0x50 (20)
> [<c01f1287>] tty_ldisc_ref_wait+0x17/0xc0 (88)
> [<c01f21fd>] tty_write+0x7d/0x230 (68)
> [<c01546ac>] vfs_write+0xbc/0x110 (36)
> [<c01547b1>] sys_write+0x41/0x70 (44)
> [<c0106367>] syscall_call+0x7/0xb (-8124)

this too i'd consider a false positive, because this particular printout
happened due to a mutex, and a mutex blockage we can consider
involuntary blockage. But ... tty writes can cause BKL locking.

> We know that jackd prints from the realtime thread, and that in theory
> this could be a problem, in practice it works OK. Maybe some recent
> changes to the tty layer made this problematic.

i'd suggest to do an atomic_off() whenever jackd prints an xrun warning
from the highprio thread.

> I think there was a patch posted to the JACK mailing list to print
> from a separate thread, I will look into this.

that would be the better longterm solution.

Ingo