linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: A Sun <as1033x@comcast.net>
To: Sean Young <sean@mess.org>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: Re: [PATCH 1/3] [media] mceusb: RX -EPIPE (urb status = -32) lockup failure fix
Date: Mon, 27 Mar 2017 04:18:33 -0400	[thread overview]
Message-ID: <58D8CAD9.80304@comcast.net> (raw)
In-Reply-To: <20170326203130.GA6070@gofer.mess.org>

On 3/26/2017 4:31 PM, Sean Young wrote:
> On Sun, Mar 26, 2017 at 02:28:08PM -0400, A Sun wrote:
>> commit https://github.com/asunxx/linux/commit/17fe3b51f4ad5202a876ea4c92b5d99d4e166823
>> Author: A Sun <as1033x@comcast.net>
>> Date:   Sun, 26 Mar 2017 13:24:18 -0400 
> 
> Please don't include this.
> 
>>
...
>> mceusb 1-1.2:1.0: 2 tx ports (0x1 cabled) and 2 rx sensors (0x1 active)
> 
> It would be nice to have this tested against a mainline kernel. I thought
> that was entirely possible on raspberry pis nowadays.
...
>> +	/* kevent support */
>> +	struct work_struct kevent;
> 
> kevent is not a descriptive name. How about something like clear_halt?
> 
>> +	unsigned long kevent_flags;
>> +#		define EVENT_TX_HALT	0
>> +#		define EVENT_RX_HALT	1
> 
> EVENT_TX_HALT is never used, so kevent_flags is only ever set to 1. The
> entire field can be dropped.
> 
...
>> +	if (!schedule_work(&ir->kevent)) {
>> +		dev_err(ir->dev, "kevent %d may have been dropped", kevent);
>> +	} else {
>> +		dev_dbg(ir->dev, "kevent %d scheduled", kevent);
>> +	}
>> +}
> 
> Again name is not very descriptive.
> 
...
>> +		dev_err(ir->dev, "Error: urb status = %d (RX HALT)",
>> +			urb->status);
>> +		mceusb_defer_kevent(ir, EVENT_RX_HALT);
> 
> Here you could simply call schedule_work(). Note that EPIPE might also
> be returned for device disconnect for some host controllers.
> 
>> +		return;
...
>> +	int status;
>> +
>> +	if (test_bit(EVENT_RX_HALT, &ir->kevent_flags)) {
> 
> If condition can go.
> 
>> +		usb_unlink_urb(ir->urb_in);
>> +		status = usb_clear_halt(ir->usbdev, ir->pipe_in);

Hi Sean,

Thanks again for looking at this. This patch is based on similar error and recovery, with the USB ethernet driver usbnet (usbnet.c, usbnet.h).

In usbnet, they call "kevent" (kernel device event?) any kind of hardware state change or event in interrupt context that requires invoking non-interrupt code to handle. I'm not sure what else I should name it. Possible kevent-s are not limited to situations needing usb_clear_halt(). From usbnet:
 69 #               define EVENT_TX_HALT    0
 70 #               define EVENT_RX_HALT    1
 71 #               define EVENT_RX_MEMORY  2
 72 #               define EVENT_STS_SPLIT  3
 73 #               define EVENT_LINK_RESET 4
 74 #               define EVENT_RX_PAUSED  5
 75 #               define EVENT_DEV_ASLEEP 6
 76 #               define EVENT_DEV_OPEN   7
 77 #               define EVENT_DEVICE_REPORT_IDLE 8
 78 #               define EVENT_NO_RUNTIME_PM      9
 79 #               define EVENT_RX_KILL    10
 80 #               define EVENT_LINK_CHANGE        11
 81 #               define EVENT_SET_RX_MODE        12
So far, the first two are appearing applicable for mceusb.

The unused EVENT_TX_HALT and the apparently extra _kevent functions and kevent_flags are necessary for a later:
    [PATCH] [media] mceusb: TX -EPIPE lockup fix
...not yet written, transmit side equivalent bug. I respectfully recommend keeping these hooks in place.

For now, I think the transmit side EPIPE bug fix is less critical, since the TX bug avoids hanging the host/kernel, but would still cause lockup of the device.

In case of RX EPIPE on disconnect, the fix is still safe. Recovery attempt should fail (in usb_clear_halt() or usb_submit_urb()) and abort without further retry, and the recovery handler itself gets shutdown in mceusb_dev_disconnect().

Please let me know how to proceed. Thanks. ..A Sun

  reply	other threads:[~2017-03-27  8:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-25 16:59 [PATCH] mceusb: RX -EPIPE lockup fault and more A Sun
2017-03-26 10:27 ` Sean Young
2017-03-26 16:36   ` [PATCH 0/3] [media] " A Sun
2017-03-26 18:28   ` [PATCH 1/3] [media] mceusb: RX -EPIPE (urb status = -32) lockup failure fix A Sun
2017-03-26 20:31     ` Sean Young
2017-03-27  8:18       ` A Sun [this message]
2017-03-28 20:25         ` Sean Young
2017-03-29  1:40           ` A Sun
2017-03-29 21:06             ` Sean Young
2017-03-29 22:04               ` A Sun
2017-03-30  7:12                 ` Sean Young
2017-03-30 16:35                   ` A Sun
2017-03-26 18:33   ` [PATCH 2/3] [media] mceusb: sporadic RX truncation corruption fix A Sun
2017-03-26 19:04   ` [PATCH 3/3] [media] mceusb: fix inaccurate debug buffer dumps,and misleading debug messages A Sun

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=58D8CAD9.80304@comcast.net \
    --to=as1033x@comcast.net \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=sean@mess.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;
as well as URLs for NNTP newsgroup(s).