[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHshu7NGmPO+7KjjPBtJT77vTobk0m7iX1FPnMfzh_G4SCKkRw@mail.gmail.com>
Date: Wed, 15 May 2019 17:15:16 +0800
From: hhome liu <liuhhome@...il.com>
To: Johan Hovold <johan@...nel.org>
Cc: Rob Herring <robh@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
baolin.wang@...soc.com, Baolin Wang <baolin.wang@...aro.org>,
jslaby@...e.com,
刘岚清 (Lanqing Liu)
<lanqing.liu@...soc.com>, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org, chunyan.zhang@...soc.com,
orson.zhai@...soc.com, zhang.lyra@...il.com
Subject: Re: [PATCH] tty: serial_core: Fix the incorrect configuration of baud
rate and data length at the console serial port resume
Johan Hovold <johan@...nel.org> 于2019年5月14日周二 下午3:35写道:
>
> On Thu, May 09, 2019 at 01:42:39PM +0800, Lanqing Liu wrote:
> > When userspace opens a serial port for console, uart_port_startup()
> > is called. This function assigns the uport->cons->cflag value to
> > TTY->termios.c_cflag, then it is cleared to 0. When the user space
> > closes this serial port, the TTY structure will be released, and at
> > this time uport->cons->cflag has also been cleared.
> >
> > On the Spreadtrum platform, in some special scenarios, like charging mode,
> > userspace needs to close the console, which means the uport->cons->cflag
> > has also been cleared. But printing logs is still needed in the kernel. So
> > when system enters suspend and resume, the console needs to be configure
> > the baud rate and data length of the serial port according to its own cflag
> > when resuming the console port. At this time, the cflag is 0, which will
> > cause serial port to produce configuration errors that do not meet user
> > expectations.
>
> This is actually yet another regression due to 761ed4a94582 ("tty:
> serial_core: convert uart_close to use tty_port_close") which
> incidentally removed the call to uart_shutdown() where the cflag was
> being saved precisely to avoid the problem you're describing:
>
> ae84db9661ca ("serial: core: Preserve termios c_cflag for console resume")
Yes, agree with you.
>
> Judging from a quick look it seems the xmit buf, which is released in
> that function may now be leaking too.
We haven't found this issue before, but we can try to reproduce it on
our platform.
>
> > To fix this, assigning the TTY->termios.c_cflag value to uport->cons->cflag
> > before the userspace closes this console serial port. It will ensure that
> > the correct cflag value can be gotten when the console serial port was
> > resumed.
>
> Not sure this is the right fix, but I don't have time to look at this
> right now.
OK. Thanks for your comments.
Powered by blists - more mailing lists