Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756671AbbGGI7Z (ORCPT ); Tue, 7 Jul 2015 04:59:25 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:48876 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756521AbbGGI7I convert rfc822-to-8bit (ORCPT ); Tue, 7 Jul 2015 04:59:08 -0400 X-IronPort-AV: E=Sophos;i="5.15,421,1432566000"; d="scan'208";a="191040468" From: Phil Edworthy To: Yoshihiro Shimoda CC: Kuninori Morimoto , Greg Kroah-Hartman , Felipe Balbi , Ulrich Hecht , Kishon Vijay Abraham I , "Sergei Shtylyov" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-sh@vger.kernel.org" , Laurent Pinchart Subject: RE: [PATCH v3] usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS Thread-Topic: [PATCH v3] usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS Thread-Index: AQHQt709t0fxPg3S/kucP8bohKfBep3Pti9g Date: Tue, 7 Jul 2015 08:59:01 +0000 Message-ID: References: <2896957.Pcl0CbmdvL@avalon> <1435832793-9999-1-git-send-email-phil.edworthy@renesas.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: renesas.com; dkim=none (message not signed) header.d=none; x-originating-ip: [193.141.220.21] x-microsoft-exchange-diagnostics: 1;SIXPR06MB0607;5:8j2BGNUnL38zvIG/T/IeOVOgNjmmj2P42qnDs5va+1SlX7S69zCHPjM48fdsFJ57x8N6SzTxsHw8axcszSmJYcpVXL48dCKdN5q9nbseB+h6kBy5UWm97hYtV1oY4YjhRzr5ECsWRuxm1180T3FlOg==;24:w8HLOlZVSoXjTveFJ+We2yMmSY3QJ3w8zor7Un4jqylrpyCsEO65gcovdDIGh1z1lBpQLmw5jC4sLbJewvKMRyEX4ibr1CtRux7VuOU1hb0=;20:jXwRDzlz9JjEl7sbZkUvGm4p+bDY6XB7MRFCyT6NYPN8HO1grZPq8jamREHMTWkqU6yijsg9gQo4h6xOcLe40f6/XrAJkuVQ5j8ybpNrgULgmVjstkBuyEr8H6IxZcqLAjEcXbxJ7twsWUCipYlFHqiU0IH9frXgq0q0XgbHpSo= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB0607; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:SIXPR06MB0607;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB0607; x-forefront-prvs: 0630013541 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(377454003)(24454002)(51704005)(86362001)(46102003)(2900100001)(102836002)(87936001)(50986999)(76176999)(575784001)(189998001)(33656002)(2656002)(76576001)(74316001)(40100003)(2950100001)(5003600100002)(77156002)(110136002)(122556002)(92566002)(19580405001)(19580395003)(54356999)(106116001)(77096005)(5001960100002)(66066001)(62966003)(5002640100001)(217873001)(4001450100001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:SIXPR06MB0607;H:SIXPR06MB0639.apcprd06.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2015 08:59:01.4325 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB0607 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4976 Lines: 120 Hi Shimoda-san, On 06 July 2015 08:28, Shimoda-san wrote: > Hi Phil-san, > > > Sent: Thursday, July 02, 2015 7:27 PM > > > > These changes allow a PHY driver to trigger a VBUS interrupt and > > to provide the value of VBUS. > > > > Signed-off-by: Phil Edworthy > > Thank you for the patch! > > However, if I tested this patch, a kernel panic happened when > I did "rmmod g_mass_storage" on koelsch: > > root@192:~/usb# rmmod g_mass_storage > Unable to handle kernel NULL pointer dereference at virtual address 00000004 > pgd = eebd4bc0 > [00000004] *pgd=00000000 > Internal error: Oops: 205 [#1] SMP ARM > Modules linked in: g_mass_storage(-) usb_f_mass_storage libcomposite > CPU: 0 PID: 2496 Comm: rmmod Not tainted 4.1.0-dirty #32 > Hardware name: Generic R8A7791 (Flattened Device Tree) > task: eeb64ac0 ti: ee022000 task.ti: ee022000 > PC is at usbhs_pkt_pop+0x1c/0x100 > LR is at usbhsg_ep_dequeue+0x28/0x40 > pc : [] lr : [] psr: 20000013 > sp : ee023e70 ip : ee023e98 fp : ee023e94 > r10: 00000000 r9 : ee022000 r8 : c00101e4 > r7 : 00200200 r6 : 00100100 r5 : 00000000 r4 : eeb917f8 > r3 : c036e33c r2 : 00000041 r1 : eeb917f8 r0 : 00000000 > Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user > Control: 30c5307d Table: 6ebd4bc0 DAC: fffffffd > Process rmmod (pid: 2496, stack limit = 0xee022210) > Stack: (0xee023e70 to 0xee024000) > 3e60: ee1b1400 eeb917c0 00100100 00200200 > 3e80: c00101e4 ee022000 ee023eac ee023e98 c036e364 c036d924 eeb34180 > eeb341c0 > 3ea0: ee023ecc ee023eb0 bf002f20 c036e348 eeb34180 00000001 ee1b1800 > eeb341b8 > 3ec0: ee023eec ee023ed0 bf002fec bf002e5c ee181600 bf01d624 bed3ff0d > 00000081 > 3ee0: ee023efc ee023ef0 bf003028 bf002f78 ee023f14 ee023f00 c036fb88 > bf003018 > 3f00: ee181600 bf01d624 ee023f2c ee023f18 c036fc10 c036fb34 bf01d694 7f64cd30 > 3f20: ee023f3c ee023f30 bf0013d0 c036fbbc ee023f4c ee023f40 bf01d26c bf0013c0 > 3f40: ee023fa4 ee023f50 c0090bd8 bf01d248 ee023f6c 616d5f67 735f7373 > 61726f74 > 3f60: 00006567 ee023f70 c00460f4 c052a8c0 c00101e4 ee022010 ee023fb0 > ee022000 > 3f80: ee023fac ee023f90 c00136c4 00046038 00000001 7f64cd00 00000000 > ee023fa8 > 3fa0: c0010040 c0090adc 00000001 7f64cd00 7f64cd30 00000800 ccd5c100 ccd5c100 > 3fc0: 00000001 7f64cd00 bed3ff0d 00000081 7f64c008 00000000 00000002 00000800 > 3fe0: bed3fe0c bed3fb98 b6eeb068 b6e4f05c 60000010 7f64cd30 00000000 > 00000000 > Backtrace: > [] (usbhs_pkt_pop) from [] > (usbhsg_ep_dequeue+0x28/0x40) > r9:ee022000 r8:c00101e4 r7:00200200 r6:00100100 r5:eeb917c0 r4:ee1b1400 > [] (usbhsg_ep_dequeue) from [] > (composite_dev_cleanup+0xd0/0x11c [libcomposite]) > r5:eeb341c0 r4:eeb34180 > [] (composite_dev_cleanup [libcomposite]) from [] > (__composite_unbind+0x80/0xa0 [libcomposite]) > r7:eeb341b8 r6:ee1b1800 r5:00000001 r4:eeb34180 > [] (__composite_unbind [libcomposite]) from [] > (composite_unbind+0x1c/0x20 [libcomposite]) > r7:00000081 r6:bed3ff0d r5:bf01d624 r4:ee181600 > [] (composite_unbind [libcomposite]) from [] > (usb_gadget_remove_driver+0x60/0x88) > [] (usb_gadget_remove_driver) from [] > (usb_gadget_unregister_driver+0x60/0xa0) > r5:bf01d624 r4:ee181600 > [] (usb_gadget_unregister_driver) from [] > (usb_composite_unregister+0x1c/0x20 [libcomposite]) > r5:7f64cd30 r4:bf01d694 > [] (usb_composite_unregister [libcomposite]) from [] > (msg_cleanup+0x30/0x3c [g_mass_storage]) > [] (msg_cleanup [g_mass_storage]) from [] > (SyS_delete_module+0x108/0x1c4) > [] (SyS_delete_module) from [] > (ret_fast_syscall+0x0/0x3c) > r5:7f64cd00 r4:00000001 > Code: e52de004 e8bd4000 e1a05000 e1a04001 (e5907004) > ---[ end trace 8152e492b3f02f66 ]--- > > > I don't know why this kernel panic happened after I applied this patch. > But, if I added the following code in the mod_gadget.c, this issue disappeared: > > @@ -682,7 +684,8 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct > usb_r > struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); > struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); > > - usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); > + if (pipe) > + usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); > usbhsg_queue_pop(uep, ureq, -ECONNRESET); > > return 0; That's odd, I can't see how my patch causes this problem. Do you think that there has always been a race problem here and my changes make this happen? > Best regards, > Yoshihiro Shimoda > Best regards Phil -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/