From: Johan Hovold <jhovold@gmail.com>
To: Oliver Neukum <oneukum@suse.de>
Cc: Johan Hovold <jhovold@gmail.com>, Xiao Jin <jin.xiao@intel.com>,
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 11:45:16 +0200 [thread overview]
Message-ID: <20140411094516.GB17522@localhost> (raw)
In-Reply-To: <1396952542.25633.13.camel@linux-fkkt.site>
On Tue, Apr 08, 2014 at 12:22:22PM +0200, Oliver Neukum wrote:
> On Tue, 2014-04-08 at 09:33 +0200, Johan Hovold wrote:
> > On Tue, Apr 08, 2014 at 11:05:20AM +0800, Xiao Jin wrote:
> > > We find two problems on acm tty write delayed mechanism.
> >
> > Then you should split this into two patches.
> >
> > > (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.
> >
> > Why not simply return 0 in write and use the tty buffering rather than
> > implement another buffer in cdc_acm?
>
> Yes. We need a single buffer because the tty layer is not happy
> when you accept no data. But we should be able to refuse subsequent
> writes. Could you test this patch?
>
> Regards
> Oliver
>
> From 1d44c1f2a10b5617824a37c8ec51f5547e482259 Mon Sep 17 00:00:00 2001
> From: Oliver Neukum <oneukum@suse.de>
> Date: Tue, 8 Apr 2014 12:17:39 +0200
> Subject: [PATCH] cdc-acm: fix consecutive writes while device is suspended
>
> CDC-ACM needs to handle one attempt to write to a suspended
> device because we told the tty layer that there is room.
> A second attempt may and must fail or we drop data.
>
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
> CC: stable@vger.kernel.org
> ---
> drivers/usb/class/cdc-acm.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 900f7ff..7ad3105 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -646,10 +646,12 @@ static int acm_tty_write(struct tty_struct *tty,
>
> usb_autopm_get_interface_async(acm->control);
> if (acm->susp_count) {
> - if (!acm->delayed_wb)
> + if (!acm->delayed_wb) {
> acm->delayed_wb = wb;
> - else
> + } else {
> usb_autopm_put_interface_async(acm->control);
> + count = 0;
You would still leak write urbs here, unless you set wb.use = 0.
> + }
> spin_unlock_irqrestore(&acm->write_lock, flags);
> return count; /* A white lie */
> }
next prev parent reply other threads:[~2014-04-11 9:45 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 [this message]
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
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=20140411094516.GB17522@localhost \
--to=jhovold@gmail.com \
--cc=david.a.cohen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jin.xiao@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.