public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
@ 2014-10-14 20:15 David Cohen
  2014-10-15  5:00 ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: David Cohen @ 2014-10-14 20:15 UTC (permalink / raw)
  To: balbi, gregkh; +Cc: linux-usb, linux-kernel, David Cohen

ERRATIC_ERROR interrupt is an event that needs more attention from
developers than currently implemented, since this indicates a serious
stability issue. The only way to get warned about it is by selecting the
maximum driver's verbosity.

This patch increases a bit the error's verbosity.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 3818b26bfc05..132e761d62e4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
 		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
 		break;
 	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
-		dev_vdbg(dwc->dev, "Erratic Error\n");
+		WARN_ON_ONCE(1);
+		dev_dbg(dwc->dev, "Erratic Error\n");
 		break;
 	case DWC3_DEVICE_EVENT_CMD_CMPL:
 		dev_vdbg(dwc->dev, "Command Complete\n");
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-14 20:15 [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt David Cohen
@ 2014-10-15  5:00 ` Felipe Balbi
  2014-10-15 16:57   ` David Cohen
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2014-10-15  5:00 UTC (permalink / raw)
  To: David Cohen; +Cc: balbi, gregkh, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hi,

On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> ERRATIC_ERROR interrupt is an event that needs more attention from
> developers than currently implemented, since this indicates a serious
> stability issue. The only way to get warned about it is by selecting the
> maximum driver's verbosity.
> 
> This patch increases a bit the error's verbosity.
> 
> Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> ---
>  drivers/usb/dwc3/gadget.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 3818b26bfc05..132e761d62e4 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
>  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
>  		break;
>  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> -		dev_vdbg(dwc->dev, "Erratic Error\n");
> +		WARN_ON_ONCE(1);
> +		dev_dbg(dwc->dev, "Erratic Error\n");

how about:
		WARN_ONCE(true, "Erratic Error\n");

instead ?

>  		break;
>  	case DWC3_DEVICE_EVENT_CMD_CMPL:
>  		dev_vdbg(dwc->dev, "Command Complete\n");
> -- 
> 2.1.0
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-15  5:00 ` Felipe Balbi
@ 2014-10-15 16:57   ` David Cohen
  2014-10-15 17:01     ` David Cohen
  0 siblings, 1 reply; 7+ messages in thread
From: David Cohen @ 2014-10-15 16:57 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: gregkh, linux-usb, linux-kernel

On Wed, Oct 15, 2014 at 12:00:22AM -0500, Felipe Balbi wrote:
> Hi,
> 
> On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> > ERRATIC_ERROR interrupt is an event that needs more attention from
> > developers than currently implemented, since this indicates a serious
> > stability issue. The only way to get warned about it is by selecting the
> > maximum driver's verbosity.
> > 
> > This patch increases a bit the error's verbosity.
> > 
> > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > ---
> >  drivers/usb/dwc3/gadget.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index 3818b26bfc05..132e761d62e4 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
> >  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
> >  		break;
> >  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> > -		dev_vdbg(dwc->dev, "Erratic Error\n");
> > +		WARN_ON_ONCE(1);
> > +		dev_dbg(dwc->dev, "Erratic Error\n");
> 
> how about:
> 		WARN_ONCE(true, "Erratic Error\n");
> 
> instead ?

When erratic error event happens, in my experience it is usually
followed but many of them in a row. It may end up too verbose.

Br, David

> 
> >  		break;
> >  	case DWC3_DEVICE_EVENT_CMD_CMPL:
> >  		dev_vdbg(dwc->dev, "Command Complete\n");
> > -- 
> > 2.1.0
> > 
> 
> -- 
> balbi



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-15 16:57   ` David Cohen
@ 2014-10-15 17:01     ` David Cohen
  2014-10-15 17:06       ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: David Cohen @ 2014-10-15 17:01 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: gregkh, linux-usb, linux-kernel

On Wed, Oct 15, 2014 at 09:57:18AM -0700, David Cohen wrote:
> On Wed, Oct 15, 2014 at 12:00:22AM -0500, Felipe Balbi wrote:
> > Hi,
> > 
> > On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> > > ERRATIC_ERROR interrupt is an event that needs more attention from
> > > developers than currently implemented, since this indicates a serious
> > > stability issue. The only way to get warned about it is by selecting the
> > > maximum driver's verbosity.
> > > 
> > > This patch increases a bit the error's verbosity.
> > > 
> > > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > > ---
> > >  drivers/usb/dwc3/gadget.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > index 3818b26bfc05..132e761d62e4 100644
> > > --- a/drivers/usb/dwc3/gadget.c
> > > +++ b/drivers/usb/dwc3/gadget.c
> > > @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
> > >  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
> > >  		break;
> > >  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> > > -		dev_vdbg(dwc->dev, "Erratic Error\n");
> > > +		WARN_ON_ONCE(1);
> > > +		dev_dbg(dwc->dev, "Erratic Error\n");
> > 
> > how about:
> > 		WARN_ONCE(true, "Erratic Error\n");
> > 
> > instead ?
> 
> When erratic error event happens, in my experience it is usually
> followed but many of them in a row. It may end up too verbose.

Oops, sorry for my confusion. I read WARN(), not WARN_ONCE() when I read
for the first time :)

I let the dev_dbg() because it may be useful to get all the occurrences
in case debug is enabled. But WARN_ONCE() is fine too if you prefer.

Br, David

> 
> Br, David
> 
> > 
> > >  		break;
> > >  	case DWC3_DEVICE_EVENT_CMD_CMPL:
> > >  		dev_vdbg(dwc->dev, "Command Complete\n");
> > > -- 
> > > 2.1.0
> > > 
> > 
> > -- 
> > balbi
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-15 17:01     ` David Cohen
@ 2014-10-15 17:06       ` Felipe Balbi
  2014-10-15 18:36         ` David Cohen
  0 siblings, 1 reply; 7+ messages in thread
From: Felipe Balbi @ 2014-10-15 17:06 UTC (permalink / raw)
  To: David Cohen; +Cc: Felipe Balbi, gregkh, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]

On Wed, Oct 15, 2014 at 10:01:45AM -0700, David Cohen wrote:
> On Wed, Oct 15, 2014 at 09:57:18AM -0700, David Cohen wrote:
> > On Wed, Oct 15, 2014 at 12:00:22AM -0500, Felipe Balbi wrote:
> > > Hi,
> > > 
> > > On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> > > > ERRATIC_ERROR interrupt is an event that needs more attention from
> > > > developers than currently implemented, since this indicates a serious
> > > > stability issue. The only way to get warned about it is by selecting the
> > > > maximum driver's verbosity.
> > > > 
> > > > This patch increases a bit the error's verbosity.
> > > > 
> > > > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > > > ---
> > > >  drivers/usb/dwc3/gadget.c | 3 ++-
> > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > > index 3818b26bfc05..132e761d62e4 100644
> > > > --- a/drivers/usb/dwc3/gadget.c
> > > > +++ b/drivers/usb/dwc3/gadget.c
> > > > @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
> > > >  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
> > > >  		break;
> > > >  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> > > > -		dev_vdbg(dwc->dev, "Erratic Error\n");
> > > > +		WARN_ON_ONCE(1);
> > > > +		dev_dbg(dwc->dev, "Erratic Error\n");
> > > 
> > > how about:
> > > 		WARN_ONCE(true, "Erratic Error\n");
> > > 
> > > instead ?
> > 
> > When erratic error event happens, in my experience it is usually
> > followed but many of them in a row. It may end up too verbose.
> 
> Oops, sorry for my confusion. I read WARN(), not WARN_ONCE() when I read
> for the first time :)
> 
> I let the dev_dbg() because it may be useful to get all the occurrences
> in case debug is enabled. But WARN_ONCE() is fine too if you prefer.

We might WARN_ONCE() and forcibly disconnect from host as the platform
worn't work anymore after Erratic Error happens. Then just make that
clear with "Erratic Error: disconnecting from host\n" or something like
that.

The only way to fix erratic error (by fixing code - probably PHY driver)
will require rebooting the platform anyway. At a minimum, you'd have to
unload and reload dwc3.ko, just make sure (if you can reproduce erratic
error easily) modprobe -r dwc3 && modprobe dwc3 still causes dwc3 to
reconnect to host.

cheers

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-15 17:06       ` Felipe Balbi
@ 2014-10-15 18:36         ` David Cohen
  2014-10-15 18:55           ` Felipe Balbi
  0 siblings, 1 reply; 7+ messages in thread
From: David Cohen @ 2014-10-15 18:36 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: gregkh, linux-usb, linux-kernel

On Wed, Oct 15, 2014 at 12:06:10PM -0500, Felipe Balbi wrote:
> On Wed, Oct 15, 2014 at 10:01:45AM -0700, David Cohen wrote:
> > On Wed, Oct 15, 2014 at 09:57:18AM -0700, David Cohen wrote:
> > > On Wed, Oct 15, 2014 at 12:00:22AM -0500, Felipe Balbi wrote:
> > > > Hi,
> > > > 
> > > > On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> > > > > ERRATIC_ERROR interrupt is an event that needs more attention from
> > > > > developers than currently implemented, since this indicates a serious
> > > > > stability issue. The only way to get warned about it is by selecting the
> > > > > maximum driver's verbosity.
> > > > > 
> > > > > This patch increases a bit the error's verbosity.
> > > > > 
> > > > > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > > > > ---
> > > > >  drivers/usb/dwc3/gadget.c | 3 ++-
> > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > > > index 3818b26bfc05..132e761d62e4 100644
> > > > > --- a/drivers/usb/dwc3/gadget.c
> > > > > +++ b/drivers/usb/dwc3/gadget.c
> > > > > @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
> > > > >  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
> > > > >  		break;
> > > > >  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> > > > > -		dev_vdbg(dwc->dev, "Erratic Error\n");
> > > > > +		WARN_ON_ONCE(1);
> > > > > +		dev_dbg(dwc->dev, "Erratic Error\n");
> > > > 
> > > > how about:
> > > > 		WARN_ONCE(true, "Erratic Error\n");
> > > > 
> > > > instead ?
> > > 
> > > When erratic error event happens, in my experience it is usually
> > > followed but many of them in a row. It may end up too verbose.
> > 
> > Oops, sorry for my confusion. I read WARN(), not WARN_ONCE() when I read
> > for the first time :)
> > 
> > I let the dev_dbg() because it may be useful to get all the occurrences
> > in case debug is enabled. But WARN_ONCE() is fine too if you prefer.
> 
> We might WARN_ONCE() and forcibly disconnect from host as the platform
> worn't work anymore after Erratic Error happens. Then just make that
> clear with "Erratic Error: disconnecting from host\n" or something like
> that.

That works.
I assume calling dwc3_gadget_disconnect_interrupt() from
DWC3_DEVICE_EVENT_ERRATIC_ERROR should be enough to disconnect the
gadget and propagate the status to userspace.

> 
> The only way to fix erratic error (by fixing code - probably PHY driver)
> will require rebooting the platform anyway. At a minimum, you'd have to
> unload and reload dwc3.ko, just make sure (if you can reproduce erratic
> error easily) modprobe -r dwc3 && modprobe dwc3 still causes dwc3 to
> reconnect to host.

It does. Forcing soft reset on whole IP is how databook describes to
solve it.

Br, David

> 
> cheers
> 
> -- 
> balbi



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt
  2014-10-15 18:36         ` David Cohen
@ 2014-10-15 18:55           ` Felipe Balbi
  0 siblings, 0 replies; 7+ messages in thread
From: Felipe Balbi @ 2014-10-15 18:55 UTC (permalink / raw)
  To: David Cohen; +Cc: Felipe Balbi, gregkh, linux-usb, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3115 bytes --]

On Wed, Oct 15, 2014 at 11:36:33AM -0700, David Cohen wrote:
> On Wed, Oct 15, 2014 at 12:06:10PM -0500, Felipe Balbi wrote:
> > On Wed, Oct 15, 2014 at 10:01:45AM -0700, David Cohen wrote:
> > > On Wed, Oct 15, 2014 at 09:57:18AM -0700, David Cohen wrote:
> > > > On Wed, Oct 15, 2014 at 12:00:22AM -0500, Felipe Balbi wrote:
> > > > > Hi,
> > > > > 
> > > > > On Tue, Oct 14, 2014 at 01:15:05PM -0700, David Cohen wrote:
> > > > > > ERRATIC_ERROR interrupt is an event that needs more attention from
> > > > > > developers than currently implemented, since this indicates a serious
> > > > > > stability issue. The only way to get warned about it is by selecting the
> > > > > > maximum driver's verbosity.
> > > > > > 
> > > > > > This patch increases a bit the error's verbosity.
> > > > > > 
> > > > > > Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> > > > > > ---
> > > > > >  drivers/usb/dwc3/gadget.c | 3 ++-
> > > > > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > > > > > index 3818b26bfc05..132e761d62e4 100644
> > > > > > --- a/drivers/usb/dwc3/gadget.c
> > > > > > +++ b/drivers/usb/dwc3/gadget.c
> > > > > > @@ -2484,7 +2484,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
> > > > > >  		dev_vdbg(dwc->dev, "Start of Periodic Frame\n");
> > > > > >  		break;
> > > > > >  	case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
> > > > > > -		dev_vdbg(dwc->dev, "Erratic Error\n");
> > > > > > +		WARN_ON_ONCE(1);
> > > > > > +		dev_dbg(dwc->dev, "Erratic Error\n");
> > > > > 
> > > > > how about:
> > > > > 		WARN_ONCE(true, "Erratic Error\n");
> > > > > 
> > > > > instead ?
> > > > 
> > > > When erratic error event happens, in my experience it is usually
> > > > followed but many of them in a row. It may end up too verbose.
> > > 
> > > Oops, sorry for my confusion. I read WARN(), not WARN_ONCE() when I read
> > > for the first time :)
> > > 
> > > I let the dev_dbg() because it may be useful to get all the occurrences
> > > in case debug is enabled. But WARN_ONCE() is fine too if you prefer.
> > 
> > We might WARN_ONCE() and forcibly disconnect from host as the platform
> > worn't work anymore after Erratic Error happens. Then just make that
> > clear with "Erratic Error: disconnecting from host\n" or something like
> > that.
> 
> That works.
> I assume calling dwc3_gadget_disconnect_interrupt() from
> DWC3_DEVICE_EVENT_ERRATIC_ERROR should be enough to disconnect the
> gadget and propagate the status to userspace.
> 
> > 
> > The only way to fix erratic error (by fixing code - probably PHY driver)
> > will require rebooting the platform anyway. At a minimum, you'd have to
> > unload and reload dwc3.ko, just make sure (if you can reproduce erratic
> > error easily) modprobe -r dwc3 && modprobe dwc3 still causes dwc3 to
> > reconnect to host.
> 
> It does. Forcing soft reset on whole IP is how databook describes to
> solve it.

alright, then please send a patch and I'll take for v3.19

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-15 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-14 20:15 [PATCH] usb: dwc3: be more verbose on ERRATIC_ERROR interrupt David Cohen
2014-10-15  5:00 ` Felipe Balbi
2014-10-15 16:57   ` David Cohen
2014-10-15 17:01     ` David Cohen
2014-10-15 17:06       ` Felipe Balbi
2014-10-15 18:36         ` David Cohen
2014-10-15 18:55           ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox