linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Jin <jin.xiao@intel.com>
To: Oliver Neukum <oneukum@suse.de>
Cc: jhovold@gmail.com, gnomes@lxorguk.ukuu.org.uk,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, david.a.cohen@linux.intel.com,
	yanmin.zhang@intel.com
Subject: Re: [PATCH] cdc-acm: some enhancement on acm delayed write
Date: Fri, 11 Apr 2014 06:51:26 +0800	[thread overview]
Message-ID: <5347206E.5050701@intel.com> (raw)
In-Reply-To: <1397116923.4802.10.camel@linux-fkkt.site>

Hi, Oliver,

On 04/10/2014 04:02 PM, Oliver Neukum wrote:
> On Wed, 2014-04-09 at 22:57 +0800, Xiao Jin wrote:
>> Thanks all for the review. We meet with the problems when developing
>> product. I would like to explain my understanding.
>>
>> On 04/08/2014 11:05 AM, Xiao Jin wrote:
>>>
>>> We find two problems on acm tty write delayed mechanism.
>>> (1) When acm resume, the delayed wb will be started. But now
>>> only one write can be saved during acm suspend. More acm write
>>> may be abandoned.
>>
>> The scenario usually happened when user space write series AT after acm
>> suspend. If acm accept the first AT, what's the reason for acm to refuse
>> the second AT? If write return 0, user space will try repeatedly until
>> resume. It looks simpler that acm accept all the data and sent out urb
>> when resume.
>
> No. We cannot accept an arbitrary amount of data. It would let any
> user OOM the system. There will have to be an arbitrary limit.
> The simplest limit is 1 urb. And that is because we said that we
> are ready to accept data.
>

We apply cdc-acm for modem AT data. I can find other usb modem driver 
usb_wwan_write use list to accept more data when suspend, maybe usbnet 
is the same. Do you have any more reason for me to understand why 
cdc-acm accept only one?

>>> (2) acm tty port ASYNCB_INITIALIZED flag will be cleared when
>>> close. If acm resume callback run after ASYNCB_INITIALIZED flag
>>> cleared, there will have no chance for delayed write to start.
>>> That lead to acm_wb.use can't be cleared. If user space open
>>> acm tty again and try to setd, tty will be blocked in
>>> tty_wait_until_sent for ever.
>>>
>>
>> We see tty write and close concurrently after acm suspend in this case.
>> It looks no method to avoid it from tty layer. acm_tty_write and
>
> There is a delay user space can set.
>
>> acm_resume call after acm_port_shutdown. It looks any action in
>> acm_port_shutdown can't solve the problem. As acm has accepted the user
>> space data, we can only find a way to send out urb. I feel anyway to
>> discard the data looks like a lie to user space.
>>
>> In my understanding acm should accept data as much as possible, and send
>> out urb as soon as possible. What do you think of?
>
> There's certainly no problem with sending out the data. Yet
> simply resuming the device in shutdown() should do the job.
>

We see tty write and close concurrently, we have debug log to show that 
acm_tty_write and acm_resume is called after acm_port_shutdown, I don't 
understand "resuming the device in shutdown() should do the job".

> 	Regards
> 		Oliver
>
>

My understanding may be superficial, please correct me if anything 
wrong. Thanks.

Br, Jin

  reply	other threads:[~2014-04-10 22:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  3:05 [PATCH] cdc-acm: some enhancement on acm delayed write Xiao Jin
2014-04-08  7:33 ` Johan Hovold
2014-04-08 10:22   ` Oliver Neukum
2014-04-11  9:45     ` Johan Hovold
2014-04-08 10:33   ` Oliver Neukum
2014-04-08 13:17     ` Johan Hovold
2014-04-08 13:38       ` Oliver Neukum
2014-04-08 13:52         ` Johan Hovold
2014-04-08 11:22 ` One Thousand Gnomes
2014-04-08 13:12   ` Johan Hovold
2014-04-09 14:57 ` Xiao Jin
2014-04-09 17:43   ` David Cohen
2014-04-10  8:02   ` Oliver Neukum
2014-04-10 22:51     ` Xiao Jin [this message]
2014-04-11  7:09       ` Oliver Neukum
2014-04-11  9:37     ` Johan Hovold
2014-04-11  9:41       ` [RFC 1/2] n_tty: fix dropped output characters Johan Hovold
2014-04-11  9:41         ` [RFC 2/2] USB: cdc-acm: fix broken runtime suspend Johan Hovold
2014-04-14 12:53         ` [RFC 1/2] n_tty: fix dropped output characters One Thousand Gnomes
2014-04-14 13:05           ` Oliver Neukum
2014-04-14 14:04             ` One Thousand Gnomes
2014-04-14 13:27           ` Johan Hovold
2014-04-14 19:58       ` [PATCH] USB: cdc-acm: fix broken runtime suspend Johan Hovold
2014-04-15  8:24         ` Xiao Jin
2014-04-15  8:54           ` Johan Hovold
2014-04-15  8:35         ` Oliver Neukum
2014-04-15  9:13           ` Johan Hovold
2014-04-15 12:19             ` Johan Hovold
2014-05-24 14:42         ` Johan Hovold
2014-05-24 19:59           ` Greg Kroah-Hartman
2014-05-24 20:42             ` Johan Hovold
2014-05-26 17:22               ` [PATCH 00/63] USB: (mostly runtime PM) patches for v3.16-rc Johan Hovold

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=5347206E.5050701@intel.com \
    --to=jin.xiao@intel.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=yanmin.zhang@intel.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;
as well as URLs for NNTP newsgroup(s).