From: Peter Zijlstra <peterz@infradead.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Dmitry Safonov <dima@arista.com>, Jiri Slaby <jslaby@suse.cz>,
kernel test robot <rong.a.chen@intel.com>,
lkp@01.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mikulas Patocka <mpatocka@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-serial@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Waiman Long <longman@redhat.com>
Subject: Re: [LKP] [tty] c96cf923a9: WARNING:possible_circular_locking_dependency_detected
Date: Wed, 12 Dec 2018 10:07:51 +0100 [thread overview]
Message-ID: <20181212090751.GU5289@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20181212034252.GD431@jagdpanzerIV>
On Wed, Dec 12, 2018 at 12:42:52PM +0900, Sergey Senozhatsky wrote:
> Something like this (not tested):
>
> ---
>
> drivers/tty/serial/serial_core.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index c439a5a1e6c0..64050f506348 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -268,6 +268,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
> struct uart_port *uport = uart_port_check(state);
> struct tty_port *port = &state->port;
> unsigned long flags = 0;
> + char *xmit_buf = NULL;
>
> /*
> * Set the TTY IO error marker
> @@ -297,15 +298,16 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
> */
> tty_port_set_suspended(port, 0);
>
> + 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.
next prev parent reply other threads:[~2018-12-12 9:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-11 9:11 [LKP] [tty] c96cf923a9: WARNING:possible_circular_locking_dependency_detected kernel test robot
2018-12-11 13:49 ` Jiri Slaby
2018-12-11 20:59 ` Dmitry Safonov
2018-12-12 3:42 ` Sergey Senozhatsky
2018-12-12 5:04 ` Sergey Senozhatsky
2018-12-12 15:12 ` Waiman Long
2018-12-12 9:07 ` Peter Zijlstra [this message]
2018-12-13 5:38 ` Sergey Senozhatsky
2018-12-12 14:54 ` Dmitry Safonov
2018-12-13 2:19 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181212090751.GU5289@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dima@arista.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=lkp@01.org \
--cc=longman@redhat.com \
--cc=mpatocka@redhat.com \
--cc=pmladek@suse.com \
--cc=rong.a.chen@intel.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox