From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johan Hovold Subject: Re: [PATCH 2/4] usb: musb: Fix sleeping function called from invalid context for hdrc glue Date: Fri, 11 Nov 2016 17:40:37 +0100 Message-ID: <20161111164037.GN14744@localhost> References: <20161108190331.GA14744@localhost> <20161109012606.GR2428@atomide.com> <20161109153953.GG14744@localhost> <20161109175437.GZ2428@atomide.com> <20161110160423.GJ14744@localhost> <20161110174150.GC27724@atomide.com> <20161110184255.GL14744@localhost> <20161110194003.GI27724@atomide.com> <20161111120327.GM14744@localhost> <20161111154250.GB7138@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20161111154250.GB7138-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> Sender: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Tony Lindgren Cc: Johan Hovold , Bin Liu , Boris Brezillon , Greg Kroah-Hartman , Andreas Kemnade , Felipe Balbi , George Cherian , Kishon Vijay Abraham I , Ivaylo Dimitrov , Ladislav Michl , Laurent Pinchart , Sergei Shtylyov , linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-omap@vger.kernel.org On Fri, Nov 11, 2016 at 07:42:50AM -0800, Tony Lindgren wrote: > * Johan Hovold [161111 04:03]: > > On Thu, Nov 10, 2016 at 12:40:03PM -0700, Tony Lindgren wrote: > From tony Mon Sep 17 00:00:00 2001 > From: Tony Lindgren > Date: Wed, 2 Nov 2016 19:59:05 -0700 > Subject: [PATCH] usb: musb: Fix sleeping function called from invalid > context for hdrc glue > > Commit 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS > glue layer") wrongly added a call for pm_runtime_get_sync to otg_timer > that runs in softirq context. That causes a "BUG: sleeping function called > from invalid context" every time when polling the cable status: > > [] (__might_sleep) from [] (__pm_runtime_resume+0x9c/0xa0) > [] (__pm_runtime_resume) from [] (otg_timer+0x3c/0x254) > [] (otg_timer) from [] (call_timer_fn+0xfc/0x41c) > [] (call_timer_fn) from [] (expire_timers+0x120/0x210) > [] (expire_timers) from [] (run_timer_softirq+0xa4/0xdc) > [] (run_timer_softirq) from [] (__do_softirq+0x12c/0x594) > > I did not notice that as I did not have CONFIG_DEBUG_ATOMIC_SLEEP enabled. > And looks like also musb_gadget_queue() suffers from the same problem. > > Let's fix the issue by using a list of delayed work then call it on > resume. Note that we want to do this only when musb core and it's > parent devices are awake, and we need to make sure the DSPS glue > timer is stopped as noted by Johan Hovold . > Note that we already are re-enabling the timer with mod_timer() in > dsps_musb_enable(). > > Later on we may be able to remove other delayed work in the musb driver > and just do it from pending_resume_work. But this should be done only > for delayed work that does not have other timing requirements beyond > just being run on resume. > > Fixes: 65b3f50ed6fa ("usb: musb: Add PM runtime support for MUSB DSPS > glue layer") > Reported-by: Johan Hovold > Signed-off-by: Tony Lindgren Looks good to me now. Feel free to add Reviewed-by: Johan Hovold Thanks, Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html