From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com ([134.134.136.20]:32115 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752091AbdCHLdo (ORCPT ); Wed, 8 Mar 2017 06:33:44 -0500 From: Felipe Balbi To: Thinh Nguyen Cc: Linux USB , "stable\@vger.kernel.org" , John Youn Subject: RE: [PATCH] usb: dwc3: gadget: skip Set/Clear Halt when invalid In-Reply-To: <87shmo15bd.fsf@linux.intel.com> References: <20170119114034.15184-1-felipe.balbi@linux.intel.com> <30102591E157244384E984126FC3CB4F2FF567F3@US01WEMBX2.internal.synopsys.com> <87vark15hc.fsf@linux.intel.com> <87shmo15bd.fsf@linux.intel.com> Date: Wed, 08 Mar 2017 13:29:35 +0200 Message-ID: <87mvcw0zxc.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: stable-owner@vger.kernel.org List-ID: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Felipe Balbi writes: >> Thinh Nguyen writes: >>>> drivers/usb/dwc3/gadget.c | 5 +++++ >>>> 1 file changed, 5 insertions(+) >>>>=20 >>>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >>>> index 6faf484e5dfc..0a664d8eba3f 100644 >>>> --- a/drivers/usb/dwc3/gadget.c >>>> +++ b/drivers/usb/dwc3/gadget.c >>>> @@ -1379,6 +1379,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep >>>> *dep, int value, int protocol) >>>> unsigned transfer_in_flight; >>>> unsigned started; >>>>=20 >>>> + if (dep->flags & DWC3_EP_STALL) >>>> + return 0; >>>> + >>>> if (dep->number > 1) >>>> trb =3D dwc3_ep_prev_trb(dep, dep->trb_enqueue); >>>> else >>>> @@ -1400,6 +1403,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep >>>> *dep, int value, int protocol) >>>> else >>>> dep->flags |=3D DWC3_EP_STALL; >>>> } else { >>>> + if (!(dep->flags & DWC3_EP_STALL)) >>>> + return 0; >>>>=20 >>>> ret =3D dwc3_send_clear_stall_ep_cmd(dep); >>>> if (ret) >>>> -- >>>> 2.11.0.295.gd7dffce1ce >>>>=20 >>>> -- >>> >>> I encounter an issue when I test mainline with USB 3 CV MSC test and >>> bisected to this patch. >>> >>> Tester: USB 3 CV test (v2.1.3.0). >>> Function Driver: f_mass_storage >>> Reproducibility: always=20 >>> >>> The failure occurs under MSC Error Recovery Test (TD 1.4). >>> >>> Failure from the test sequence as follow (MSC compliance test spec) : >>> 1. Place the device in the desired starting state. >>> 2. Issue a Case 9 CBW (see Table 2) but with invalid signature of 0xDEA= DBEEF. >>> 3. Issue several In requests to the Bulk-Only Data Interface Bulk In en= dpoint. Verify a >>> STALL handshake is returned. If STALL handshake is not returned, skip t= o step 11. >>> 4. Issue a Get_Status(endpoint) request targeting the Bulk-Only Data In= terface bulk In >>> endpoint. Verify that it completes normally, reports endpoint halt stat= us. >>> >>> ***After this point the device idles for 10 seconds and resets. *** >>> >>> Test fails. >> >> I've been looking at this and based on sniffer and dwc3 tracepoints, it >> seems like dwc3 is behaving properly. The real issue seems to be that >> g_mass_storage isn't queueing a new request to IN endpoint. >> >> I'll continue debugging this and try to find a solution that doesn't >> involve reverting $subject. > > oh no, wait. ep2out misses XferInProgress: > > file-storage-1592 [000] d..1 152.809922: dwc3_ep_queue: ep2out: re= q ffff88003cd6ee40 length 0/512 zsI =3D=3D> -115 > file-storage-1592 [000] d..1 152.809931: dwc3_prepare_trb: ep2out:= 3/8 trb ffff88003a196050 buf 000000002d5e4000 size 512 ctrl 00000819 (HlcS= :sC:normal) > file-storage-1592 [000] d..1 152.809942: dwc3_gadget_ep_cmd: ep2ou= t: cmd 'Update Transfer' [262151] params 00000000 00000000 00000000 --> sta= tus: Successful > file-storage-1592 [000] .... 152.809951: usb_ep_queue: ep2out: len= gth 0/512 sgs 0/0 stream 0 zsI status -115 --> 0 > irq/34-dwc3-1593 [001] d..1 152.810212: dwc3_event: event (0000c0= 40): ep0out: Transfer Complete [Setup Phase] > irq/34-dwc3-1593 [001] d..1 152.810218: dwc3_ctrl_req: bRequestTy= pe 02 bRequest 01 wValue 0000 wIndex 0002 wLength 0 > irq/34-dwc3-1593 [001] d..1 152.810228: __dwc3_gadget_ep_set_halt= : ep2out: NOT stalled > > Sniffer shows me this completing, but I don't see IRQ for this. BTW, I just tested without $subject and it fails the same way. This is caused by something else. Can you rerun your bisect while I look at the problem here? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAli/6x8ACgkQzL64meEa mQa7SxAArtmvSBxHYi9cnhA/YwOJgil3VHj+7K3eBse6Pf76CxQaq5uKVSKsddX6 josNcl9+MRZtyxZF/36qGN/yjGBOh3gRRMP9t906ArjlfdRAFi7vZy85LvbiVYm9 sjIkH/JJ/JaPKwvhpgn03+1phlkYIXO3Ft8kvB7j6z+pfDTUzFRTLnBXQmUIkpBE jE0tJZruq9jVcn/69rYMHU6ZLZS07z4d/Flr6gbH792FIZsQR6QEsFA+WfLcTZ7I 3synAVyZUEHmHwMBNIq/4VcgFjrFRFO4aOuqIbTXxWqXQjoDzLpNoKebQbNhf4Zt NiOaxpR3kl5N7m4uc/uVycPT1V3l82Eg7xMzkjIBc9ThN7B9xBmzFwmQY26BHrGQ qt09DnU1cVxZqTvkA7iCG6WM52ivdB4e2YBQK2atnkScUZ2fIZu2yERXUnyPDQBo gmXc3EdM8I3IcFdsQqN2sSgOfLJctH8rnR3xkVHztXQTO9igJN+gmoS2l84n2AQ7 6YhuUypnp2zMggxfvFe+lLDHBb+KyNgydsWmrRiq7PcML5UXxjoZTF5VTxQcv1wp 8cAiPvaKmP4KlCsLnDbRL7cbIhs7px5/j0NwIY9ROTZ6XbwOl9TtxonyMsTwp2tw 5iX9yvUEnOj8BcIJbP7h/77YaTkKZ+aZZaL87N8FUE8g+0653j0= =YdQP -----END PGP SIGNATURE----- --=-=-=--