tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mutexes, IPL, tty locking

David Laight <> wrote:
> >      9  mutex_exit(&alldevs_mtx);
> >     10  /* I expect for IPL to be max(x, IPL_VM) */
> >     11  ttysleep(...);  /* panic: cpu_switchto: switching above IPL_SCHED
> > (8) */ 12  mutex_exit(&tty_lock);
> >     13  /* I expect for IPL to be x */
> Hmmm.... I wonder where the old IPL is saved ?
> (I've not looked to see!)
> But the locking scheme ought to support releasing locks in other
> that strict reverse order of acquisition. Which rather makes
> saving the old IPL anywhere other than in the callers stack frame
> rather difficult.

IPL is only being raised and that works in reference counting principle.
Therefore IPL is lowered (and only to IPL_NONE) after the last release,
see ci_mtx_oldspl and ci_mtx_count.  Which means that order of releases
does not matter.  Gradual IPL lowering would unnecessary complicate the
implementation or interface.

Forcing lower IPL with explicit splx() call should work, but that would
be a hack.  While our tty locking should be revamped, the question here
is probably - why alldevs_mtx needs IPL_HIGH?


Home | Main Index | Thread Index | Old Index