Skip to contentSkip to conversation

usb: dwc3: be more verbose on ERRATIC_ERROR interrupt

PATCH In review David Cohen 2 participants 7 messages Oct 14, 2014 – Oct 15, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc3: be more verbose on ERRATIC_ERROR interrupt

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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +2 -1
index 3818b26bfc05..132e761d62e4 100644
@@ -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");
Signature · 1 line
2.1.0
#1 lore raw

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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 ?

Quoted 6 lines
drivers/usb/dwc3/gadget.c +0 -0
 		break;
 	case DWC3_DEVICE_EVENT_CMD_CMPL:
 		dev_vdbg(dwc->dev, "Command Complete\n");
Signature · 1 line
2.1.0
Signature · 1 line
balbi
#2 lore raw
Quoted 28 lines · Felipe Balbi

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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:

Quoted 3 lines
		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

Quoted 10 lines
Quoted 7 lines
drivers/usb/dwc3/gadget.c +0 -0
 		break;
 	case DWC3_DEVICE_EVENT_CMD_CMPL:
 		dev_vdbg(dwc->dev, "Command Complete\n");
Signature · 1 line
2.1.0
Signature · 1 line
balbi
#3 lore raw
Quoted 31 lines · David Cohen
Quoted 30 lines · Felipe Balbi

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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");
Quoted 4 lines
Quoted 1 line

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

Quoted 15 lines

Br, David

Quoted 10 lines
Quoted 7 lines
drivers/usb/dwc3/gadget.c +0 -0
 		break;
 	case DWC3_DEVICE_EVENT_CMD_CMPL:
 		dev_vdbg(dwc->dev, "Command Complete\n");
Signature · 1 line
2.1.0
Signature · 1 line
balbi
#4 lore raw
Quoted 34 lines · David Cohen
Quoted 33 lines · David Cohen
Quoted 31 lines · Felipe Balbi

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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 ?

Quoted 8 lines
Quoted 2 lines

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

Signature · 1 line
balbi
#5 lore raw
Quoted 41 lines · Felipe Balbi
Quoted 40 lines · David Cohen
Quoted 31 lines · David Cohen
Quoted 30 lines · Felipe Balbi

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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");
Quoted 4 lines
Quoted 1 line

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 :)

Quoted 7 lines
Quoted 2 lines

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.

Quoted 6 lines

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

Quoted 5 lines

cheers

Signature · 1 line
balbi
#6 lore raw
Quoted 56 lines · David Cohen
Quoted 41 lines · Felipe Balbi
Quoted 40 lines · David Cohen
Quoted 31 lines · David Cohen
Quoted 30 lines · Felipe Balbi

Hi,

Quoted 17 lines · 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.

---
 drivers/usb/dwc3/gadget.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +0 -0
index 3818b26bfc05..132e761d62e4 100644

drivers/usb/dwc3/gadget.c static void dwc3_gadget_interrupt(struct dwc3 *dwc, · line 2488

Quoted 6 lines
drivers/usb/dwc3/gadget.c +2 -1
@@ -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");
Quoted 4 lines
Quoted 1 line

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 :)

Quoted 7 lines
Quoted 2 lines

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.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

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

Signature · 1 line
balbi