Linux USB
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Jookia <contact@jookia.org>, linux-usb@vger.kernel.org
Subject: Re: acm_port_shutdown hangs for 30 seconds
Date: Wed, 29 Jun 2022 14:01:18 +0200	[thread overview]
Message-ID: <78bf969a-2936-1eee-9d07-9c1694b25761@suse.com> (raw)
In-Reply-To: <YiynBKeGJCMEkgyO@novena-choice-citizen>



On 12.03.22 14:58, Jookia wrote:
> Hello there,
> 
> I've been banging my head against this issue over the years but sat down
> and started to debug it today.
> 
> When I try to quit GNU screen, minicom or another serial program it
> sometimes hangs for around 30 seconds.
> 
> To reproduce I do this:
> 
> 1. Connect an Arduino Micro with stock LED blink firmware
> 2. Run 'screen /dev/ttyACM1 9600'
> 3. Type some letters (no response from the board is given)
> 4. Quit in some way
> 
> If I skip step 3 (typing letters), the hang does not happen.

You have something in the buffer, which the tty layer will try to send.

> In userspace the hang happens at a call to close() on the TTY, and using

The tty layer is supposed to wait a defined amount of time
if a tty needs to drain.
This amount (among many other things) is traditionally
set with the TIOCSSERIAL ioctl()

> perf and ftrace it looks to be spending a lot of time poisoning urbs in
> acm_port_shutdown.

That is a bit odd.

> - Is this a bug?

Maybe, but unlikely. If and only it takes much more time than the
termios say.

> - Can I reduce the timeout somehow?

ioctl() TIOCSSERIAL. If that does not work,
it's a bug.

	HTH
		Oliver


  parent reply	other threads:[~2022-06-29 12:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12 13:58 acm_port_shutdown hangs for 30 seconds Jookia
2022-06-27 12:57 ` Greg KH
2022-06-28  9:21   ` Jookia
2022-06-29  8:37     ` Greg KH
2022-06-29 10:20       ` Jookia
2022-06-29 12:01 ` Oliver Neukum [this message]
2022-06-30 12:31   ` Jookia

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=78bf969a-2936-1eee-9d07-9c1694b25761@suse.com \
    --to=oneukum@suse.com \
    --cc=contact@jookia.org \
    --cc=linux-usb@vger.kernel.org \
    /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