* [PATCH v1] usb: dwc3: Add error logs for unknown endpoint events @ 2023-05-03 0:31 Roy Luo 2023-05-03 23:00 ` Thinh Nguyen 0 siblings, 1 reply; 3+ messages in thread From: Roy Luo @ 2023-05-03 0:31 UTC (permalink / raw) To: Thinh Nguyen, Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, badhri, Roy Luo In cases where the controller somehow fails to write to event buffer memory (e.g. due to incorrect MMU config), the driver would receive all-zero dwc3 events. However, the abnormal event is silently dropped as a regular ep0out event. Add error logs when an unknown endpoint event is received to highlight the anamoly. Signed-off-by: Roy Luo <royluo@google.com> --- drivers/usb/dwc3/ep0.c | 2 ++ drivers/usb/dwc3/gadget.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 953b752a5052..8c9560a9999e 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -1207,5 +1207,7 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc, dep->flags &= ~DWC3_EP_TRANSFER_STARTED; } break; + default: + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); } } diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index c0ca4d12f95d..054f6f297e17 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3803,6 +3803,8 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, break; case DWC3_DEPEVT_RXTXFIFOEVT: break; + default: + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); } } base-commit: c8c655c34e33544aec9d64b660872ab33c29b5f1 -- 2.40.1.495.gc816e09b53d-goog ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] usb: dwc3: Add error logs for unknown endpoint events 2023-05-03 0:31 [PATCH v1] usb: dwc3: Add error logs for unknown endpoint events Roy Luo @ 2023-05-03 23:00 ` Thinh Nguyen 2023-05-03 23:52 ` Roy Luo 0 siblings, 1 reply; 3+ messages in thread From: Thinh Nguyen @ 2023-05-03 23:00 UTC (permalink / raw) To: Roy Luo Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, badhri@google.com On Wed, May 03, 2023, Roy Luo wrote: > In cases where the controller somehow fails to write to event buffer > memory (e.g. due to incorrect MMU config), the driver would receive > all-zero dwc3 events. However, the abnormal event is silently dropped > as a regular ep0out event. When it does happen, will these prints flood the dmesg log? > Add error logs when an unknown endpoint event is received to highlight > the anamoly. anomaly? > > Signed-off-by: Roy Luo <royluo@google.com> > --- > drivers/usb/dwc3/ep0.c | 2 ++ > drivers/usb/dwc3/gadget.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > index 953b752a5052..8c9560a9999e 100644 > --- a/drivers/usb/dwc3/ep0.c > +++ b/drivers/usb/dwc3/ep0.c > @@ -1207,5 +1207,7 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc, > dep->flags &= ~DWC3_EP_TRANSFER_STARTED; > } > break; > + default: > + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); Can we add a break here? > } > } > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index c0ca4d12f95d..054f6f297e17 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -3803,6 +3803,8 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, > break; > case DWC3_DEPEVT_RXTXFIFOEVT: > break; > + default: > + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); and here too. > } > } > > > base-commit: c8c655c34e33544aec9d64b660872ab33c29b5f1 > -- > 2.40.1.495.gc816e09b53d-goog > Thanks, Thinh ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] usb: dwc3: Add error logs for unknown endpoint events 2023-05-03 23:00 ` Thinh Nguyen @ 2023-05-03 23:52 ` Roy Luo 0 siblings, 0 replies; 3+ messages in thread From: Roy Luo @ 2023-05-03 23:52 UTC (permalink / raw) To: Thinh Nguyen Cc: Greg Kroah-Hartman, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, badhri@google.com On Wed, May 3, 2023 at 4:01 PM Thinh Nguyen <Thinh.Nguyen@synopsys.com> wrote: > > On Wed, May 03, 2023, Roy Luo wrote: > > In cases where the controller somehow fails to write to event buffer > > memory (e.g. due to incorrect MMU config), the driver would receive > > all-zero dwc3 events. However, the abnormal event is silently dropped > > as a regular ep0out event. > > When it does happen, will these prints flood the dmesg log? When this does happen, the driver cannot do the required actions to move things forward in correspondence to the HW events (e.g. Xfercomplete, reset, connection done, etc.). Therefore, the controller might throw some events in the beginning but it would cease quickly until the host does a new move that triggers the controller to send new events. > > > Add error logs when an unknown endpoint event is received to highlight > > the anamoly. > > anomaly? Thanks for catching this typo, will fix it in the next patchset. > > > > > Signed-off-by: Roy Luo <royluo@google.com> > > --- > > drivers/usb/dwc3/ep0.c | 2 ++ > > drivers/usb/dwc3/gadget.c | 2 ++ > > 2 files changed, 4 insertions(+) > > > > diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c > > index 953b752a5052..8c9560a9999e 100644 > > --- a/drivers/usb/dwc3/ep0.c > > +++ b/drivers/usb/dwc3/ep0.c > > @@ -1207,5 +1207,7 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc, > > dep->flags &= ~DWC3_EP_TRANSFER_STARTED; > > } > > break; > > + default: > > + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); > > Can we add a break here? Sure ,will do it in the next patchset. > > > } > > } > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index c0ca4d12f95d..054f6f297e17 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -3803,6 +3803,8 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, > > break; > > case DWC3_DEPEVT_RXTXFIFOEVT: > > break; > > + default: > > + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event); > > and here too. Sure ,will do. > > > } > > } > > > > > > base-commit: c8c655c34e33544aec9d64b660872ab33c29b5f1 > > -- > > 2.40.1.495.gc816e09b53d-goog > > > > Thanks, > Thinh Regards, Roy Luo ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-03 23:53 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-05-03 0:31 [PATCH v1] usb: dwc3: Add error logs for unknown endpoint events Roy Luo 2023-05-03 23:00 ` Thinh Nguyen 2023-05-03 23:52 ` Roy Luo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).