Re: [LKP] [tty] c96cf923a9: WARNING:possible_circular_locking_dependency_detected

From: Sergey Senozhatsky
Date: Thu Dec 13 2018 - 00:38:43 EST


On (12/12/18 10:07), Peter Zijlstra wrote:
> > + uart_port_lock(state, flags);
> > + xmit_buf = state->xmit.buf;
> > + state->xmit.buf = NULL;
> > + uart_port_unlock(uport, flags);
> > +
> > /*
> > * Free the transmit buffer page.
> > */
> > - uart_port_lock(state, flags);
> > - if (state->xmit.buf) {
> > - free_page((unsigned long)state->xmit.buf);
> > - state->xmit.buf = NULL;
> > - }
> > - uart_port_unlock(uport, flags);
> > + if (xmit_buf)
> > + free_page((unsigned long)xmit_buf);
> > }
>
> That looks sensible anyhow. One should strive to not do alloc or free
> under locks as much as possible anyway.

Right, good point.

-ss