public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty/serial: Cancel work queue before closing uart
@ 2023-08-18  3:15 Wenhua Lin
  2023-08-22  4:37 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenhua Lin @ 2023-08-18  3:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Orson Zhai, Baolin Wang, Chunyan Zhang, linux-serial,
	linux-kernel, wenhua lin, Wenhua Lin, Xiongpeng Wu, Zhirong Qiu,
	Zhaochen Su

When the system constantly sleeps and wankes up, plugging and unplugging
the USB will probalility trigger a kernel crash problem. The reason is
that at this time, the system entered deep and turned off uart, and the
abnormal behavior of plugging and upplugging the USB triggered the read
data process of uart, causing access to uart to hang. The final solution
we came up with is to cancel the work queue before shutting down uart
, while ensuring that there is no uart business.

Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
---
 drivers/tty/serial/sprd_serial.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index b58f51296ace..eddff4360155 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -20,6 +20,7 @@
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
+#include "../tty.h"
 
 /* device name */
 #define UART_NR_MAX		8
@@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
 static int sprd_suspend(struct device *dev)
 {
 	struct sprd_uart_port *sup = dev_get_drvdata(dev);
+	struct uart_port *uport = &sup->port;
+	struct tty_port *tty = &uport->state->port;
 
+	tty_buffer_cancel_work(tty);
 	uart_suspend_port(&sprd_uart_driver, &sup->port);
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] tty/serial: Cancel work queue before closing uart
  2023-08-18  3:15 [PATCH] tty/serial: Cancel work queue before closing uart Wenhua Lin
@ 2023-08-22  4:37 ` kernel test robot
  2023-08-22  8:23 ` Ilpo Järvinen
  2023-08-22 13:27 ` Greg Kroah-Hartman
  2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-08-22  4:37 UTC (permalink / raw)
  To: Wenhua Lin, Greg Kroah-Hartman
  Cc: oe-kbuild-all, Orson Zhai, Baolin Wang, Chunyan Zhang,
	linux-serial, linux-kernel, wenhua lin, Wenhua Lin, Xiongpeng Wu,
	Zhirong Qiu, Zhaochen Su

Hi Wenhua,

kernel test robot noticed the following build errors:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.5-rc7 next-20230821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Wenhua-Lin/tty-serial-Cancel-work-queue-before-closing-uart/20230818-111905
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link:    https://lore.kernel.org/r/20230818031532.15591-1-Wenhua.Lin%40unisoc.com
patch subject: [PATCH] tty/serial: Cancel work queue before closing uart
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20230822/202308221254.RnJddA0P-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230822/202308221254.RnJddA0P-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308221254.RnJddA0P-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_lc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_wlc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_fo.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_ovf.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_lblc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_lblcr.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_dh.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_sh.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_sed.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_nq.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_twos.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_ftp.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/netfilter/ipvs/ip_vs_pe_sip.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/netfilter/nf_defrag_ipv4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/netfilter/nf_reject_ipv4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/netfilter/iptable_nat.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/netfilter/iptable_raw.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/ip_tunnel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/ipip.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/ip_gre.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/udp_tunnel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/ip_vti.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/ah4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/esp4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/xfrm4_tunnel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/tunnel4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/inet_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/tcp_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/udp_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv4/raw_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/xfrm/xfrm_algo.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/xfrm/xfrm_user.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/unix/unix_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/netfilter/ip6table_raw.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/netfilter/ip6table_nat.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/netfilter/nf_defrag_ipv6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/netfilter/nf_reject_ipv6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/ah6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/esp6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/xfrm6_tunnel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/tunnel6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/mip6.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/sit.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ipv6/ip6_udp_tunnel.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bpfilter/bpfilter.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_ar9331.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_brcm.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_dsa.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_gswip.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_hellcreek.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_ksz.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_lan9303.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_mtk.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_none.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_ocelot.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_ocelot_8021q.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_qca.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_rtl4_a.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_rtl8_4.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_rzn1_a5psw.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_sja1105.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_trailer.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/dsa/tag_xrs700x.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/8021q/8021q.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/xdp/xsk_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/mptcp/mptcp_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/mptcp/mptcp_crypto_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/mptcp/mptcp_token_test.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/packet/af_packet.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/packet/af_packet_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/key/af_key.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/netfilter/nf_conntrack_bridge.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/netfilter/ebtables.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/netfilter/ebtable_broute.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/netfilter/ebtable_filter.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/netfilter/ebtable_nat.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/bridge/bridge.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/sunrpc/sunrpc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/sunrpc/auth_gss/auth_rpcgss.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/sunrpc/auth_gss/rpcsec_gss_krb5.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/kcm/kcm.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/atm/atm.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/atm/lec.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/atm/mpoa.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/sctp/sctp_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/tipc/diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/smc/smc_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/caif/caif.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/caif/chnl_net.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/caif/caif_socket.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/caif/caif_usb.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/6lowpan/6lowpan.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ieee802154/6lowpan/ieee802154_6lowpan.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/ieee802154/ieee802154_socket.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/nfc/nci/nci.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/nfc/nci/nci_spi.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/nfc/nfc_digital.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/vmw_vsock/vsock_diag.o
WARNING: modpost: missing MODULE_DESCRIPTION() in net/hsr/hsr.o
WARNING: modpost: missing MODULE_DESCRIPTION() in arch/x86/video/fbdev.o
>> ERROR: modpost: "tty_buffer_cancel_work" [drivers/tty/serial/sprd_serial.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tty/serial: Cancel work queue before closing uart
  2023-08-18  3:15 [PATCH] tty/serial: Cancel work queue before closing uart Wenhua Lin
  2023-08-22  4:37 ` kernel test robot
@ 2023-08-22  8:23 ` Ilpo Järvinen
  2023-08-24  2:30   ` wenhua lin
  2023-08-22 13:27 ` Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2023-08-22  8:23 UTC (permalink / raw)
  To: Wenhua Lin
  Cc: Greg Kroah-Hartman, Orson Zhai, Baolin Wang, Chunyan Zhang,
	linux-serial, LKML, wenhua lin, Xiongpeng Wu, Zhirong Qiu,
	Zhaochen Su

On Fri, 18 Aug 2023, Wenhua Lin wrote:

I've problems following your description below due to grammar errors.

> When the system constantly sleeps and wankes up, plugging and unplugging

wakes

> the USB will probalility trigger a kernel crash problem.

probalility is typoed and I cannot guess which of the words you meant, 
please fix.

If there's a known crash you're fixing here, please quote the crash 
message in the changelog (and you should probably add Fixes: tag too in 
that case).

> The reason is
> that at this time, the system entered deep and turned off uart, and the

"entered deep" lacks probably some word?

> abnormal behavior of plugging and upplugging the USB triggered the read

unplugging.

Why call that abnormal behavior? Isn't USB expected to removed.

> data process of uart, causing access to uart to hang.

Are you saying a read was triggered while the UART was suspended or what?

> The final solution
> we came up with is to cancel the work queue before shutting down uart
> , while ensuring that there is no uart business.

", while ensuring" -> to ensure

"uart business" is too vague, you should replace it with something more 
concrete.

Thanks.

--
 i.

> 
> Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
> ---
>  drivers/tty/serial/sprd_serial.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> index b58f51296ace..eddff4360155 100644
> --- a/drivers/tty/serial/sprd_serial.c
> +++ b/drivers/tty/serial/sprd_serial.c
> @@ -20,6 +20,7 @@
>  #include <linux/slab.h>
>  #include <linux/tty.h>
>  #include <linux/tty_flip.h>
> +#include "../tty.h"
>  
>  /* device name */
>  #define UART_NR_MAX		8
> @@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
>  static int sprd_suspend(struct device *dev)
>  {
>  	struct sprd_uart_port *sup = dev_get_drvdata(dev);
> +	struct uart_port *uport = &sup->port;
> +	struct tty_port *tty = &uport->state->port;
>  
> +	tty_buffer_cancel_work(tty);
>  	uart_suspend_port(&sprd_uart_driver, &sup->port);
>  
>  	return 0;
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tty/serial: Cancel work queue before closing uart
  2023-08-18  3:15 [PATCH] tty/serial: Cancel work queue before closing uart Wenhua Lin
  2023-08-22  4:37 ` kernel test robot
  2023-08-22  8:23 ` Ilpo Järvinen
@ 2023-08-22 13:27 ` Greg Kroah-Hartman
  2023-08-24  2:36   ` wenhua lin
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-22 13:27 UTC (permalink / raw)
  To: Wenhua Lin
  Cc: Orson Zhai, Baolin Wang, Chunyan Zhang, linux-serial,
	linux-kernel, wenhua lin, Xiongpeng Wu, Zhirong Qiu, Zhaochen Su

On Fri, Aug 18, 2023 at 11:15:32AM +0800, Wenhua Lin wrote:
> When the system constantly sleeps and wankes up, plugging and unplugging
> the USB will probalility trigger a kernel crash problem. The reason is
> that at this time, the system entered deep and turned off uart, and the
> abnormal behavior of plugging and upplugging the USB triggered the read
> data process of uart, causing access to uart to hang. The final solution
> we came up with is to cancel the work queue before shutting down uart
> , while ensuring that there is no uart business.
> 
> Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
> ---
>  drivers/tty/serial/sprd_serial.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> index b58f51296ace..eddff4360155 100644
> --- a/drivers/tty/serial/sprd_serial.c
> +++ b/drivers/tty/serial/sprd_serial.c
> @@ -20,6 +20,7 @@
>  #include <linux/slab.h>
>  #include <linux/tty.h>
>  #include <linux/tty_flip.h>
> +#include "../tty.h"
>  
>  /* device name */
>  #define UART_NR_MAX		8
> @@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
>  static int sprd_suspend(struct device *dev)
>  {
>  	struct sprd_uart_port *sup = dev_get_drvdata(dev);
> +	struct uart_port *uport = &sup->port;
> +	struct tty_port *tty = &uport->state->port;
>  
> +	tty_buffer_cancel_work(tty);

What does this serial port have to do with the USB subsystem in your
changelog text?

And as the kernel bot said, this breaks the build, you can't do this
within a serial driver, sorry.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tty/serial: Cancel work queue before closing uart
  2023-08-22  8:23 ` Ilpo Järvinen
@ 2023-08-24  2:30   ` wenhua lin
  0 siblings, 0 replies; 6+ messages in thread
From: wenhua lin @ 2023-08-24  2:30 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Wenhua Lin, Greg Kroah-Hartman, Orson Zhai, Baolin Wang,
	Chunyan Zhang, linux-serial, LKML, Xiongpeng Wu, Zhirong Qiu,
	Zhaochen Su

On Tue, Aug 22, 2023 at 4:23 PM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> On Fri, 18 Aug 2023, Wenhua Lin wrote:
>
> I've problems following your description below due to grammar errors.
>
> > When the system constantly sleeps and wankes up, plugging and unplugging
>
> wakes
>
> > the USB will probalility trigger a kernel crash problem.
>
> probalility is typoed and I cannot guess which of the words you meant,
> please fix.
>
> If there's a known crash you're fixing here, please quote the crash
> message in the changelog (and you should probably add Fixes: tag too in
> that case).
>
> > The reason is
> > that at this time, the system entered deep and turned off uart, and the
>
> "entered deep" lacks probably some word?
>
> > abnormal behavior of plugging and upplugging the USB triggered the read
>
> unplugging.
>
> Why call that abnormal behavior? Isn't USB expected to removed.
>
> > data process of uart, causing access to uart to hang.
>
> Are you saying a read was triggered while the UART was suspended or what?
>
> > The final solution
> > we came up with is to cancel the work queue before shutting down uart
> > , while ensuring that there is no uart business.
>
> ", while ensuring" -> to ensure
>
> "uart business" is too vague, you should replace it with something more
> concrete.

We will fix it in patch v2, thank you  for your review.

>
> Thanks.
>
> --
>  i.
>
> >
> > Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
> > ---
> >  drivers/tty/serial/sprd_serial.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> > index b58f51296ace..eddff4360155 100644
> > --- a/drivers/tty/serial/sprd_serial.c
> > +++ b/drivers/tty/serial/sprd_serial.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/tty.h>
> >  #include <linux/tty_flip.h>
> > +#include "../tty.h"
> >
> >  /* device name */
> >  #define UART_NR_MAX          8
> > @@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
> >  static int sprd_suspend(struct device *dev)
> >  {
> >       struct sprd_uart_port *sup = dev_get_drvdata(dev);
> > +     struct uart_port *uport = &sup->port;
> > +     struct tty_port *tty = &uport->state->port;
> >
> > +     tty_buffer_cancel_work(tty);
> >       uart_suspend_port(&sprd_uart_driver, &sup->port);
> >
> >       return 0;
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tty/serial: Cancel work queue before closing uart
  2023-08-22 13:27 ` Greg Kroah-Hartman
@ 2023-08-24  2:36   ` wenhua lin
  0 siblings, 0 replies; 6+ messages in thread
From: wenhua lin @ 2023-08-24  2:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Wenhua Lin, Orson Zhai, Baolin Wang, Chunyan Zhang, linux-serial,
	linux-kernel, Xiongpeng Wu, Zhirong Qiu, Zhaochen Su

On Tue, Aug 22, 2023 at 9:27 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Fri, Aug 18, 2023 at 11:15:32AM +0800, Wenhua Lin wrote:
> > When the system constantly sleeps and wankes up, plugging and unplugging
> > the USB will probalility trigger a kernel crash problem. The reason is
> > that at this time, the system entered deep and turned off uart, and the
> > abnormal behavior of plugging and upplugging the USB triggered the read
> > data process of uart, causing access to uart to hang. The final solution
> > we came up with is to cancel the work queue before shutting down uart
> > , while ensuring that there is no uart business.
> >
> > Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
> > ---
> >  drivers/tty/serial/sprd_serial.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> > index b58f51296ace..eddff4360155 100644
> > --- a/drivers/tty/serial/sprd_serial.c
> > +++ b/drivers/tty/serial/sprd_serial.c
> > @@ -20,6 +20,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/tty.h>
> >  #include <linux/tty_flip.h>
> > +#include "../tty.h"
> >
> >  /* device name */
> >  #define UART_NR_MAX          8
> > @@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
> >  static int sprd_suspend(struct device *dev)
> >  {
> >       struct sprd_uart_port *sup = dev_get_drvdata(dev);
> > +     struct uart_port *uport = &sup->port;
> > +     struct tty_port *tty = &uport->state->port;
> >
> > +     tty_buffer_cancel_work(tty);
>
> What does this serial port have to do with the USB subsystem in your
> changelog text?
>
> And as the kernel bot said, this breaks the build, you can't do this
> within a serial driver, sorry.

This modification is not directly related to the usb subsystem.
I just described a problem scenario, such as the previous comment.
There may be problems with this solution. I will make changes on patch v2,
thank you for your review

>
> greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-24  2:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18  3:15 [PATCH] tty/serial: Cancel work queue before closing uart Wenhua Lin
2023-08-22  4:37 ` kernel test robot
2023-08-22  8:23 ` Ilpo Järvinen
2023-08-24  2:30   ` wenhua lin
2023-08-22 13:27 ` Greg Kroah-Hartman
2023-08-24  2:36   ` wenhua lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox