Re: [PATCH v2 1/2] usb: dwc3: gadget: Stop processing more requests on IMI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thinh,

On Mon, Oct 24, 2022 at 11:45:48PM -0500, Jeff Vanhoof wrote:
> On Mon, Oct 24, 2022 at 06:27:57PM -0700, Thinh Nguyen wrote:
> > When servicing a transfer completion event, the dwc3 driver will reclaim
> > TRBs of started requests up to the request associated with the interrupt
> > event. Currently we don't check for interrupt due to missed isoc, and
> > the driver may attempt to reclaim TRBs beyond the associated event. This
> > causes invalid memory access when the hardware still owns the TRB. If
> > there's a missed isoc TRB with IMI (interrupt on missed isoc), make sure
> > to stop servicing further.
> > 
> > Note that only the last TRB of chained TRBs has its status updated with
> > missed isoc.
> > 
> > Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
> > Cc: stable@xxxxxxxxxxxxxxx
> > Reported-by: Jeff Vanhoof <jdv1029@xxxxxxxxx>
> > Reported-by: Dan Vacura <w36195@xxxxxxxxxxxx>
> > Signed-off-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx>
> > ---
> >  Changes in v2:
> >  - No need to check for CHN=0 since only the last TRB has its status
> >    updated to missed isoc
> > 
> >  drivers/usb/dwc3/gadget.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> > index dd8ecbe61bec..230b3c660054 100644
> > --- a/drivers/usb/dwc3/gadget.c
> > +++ b/drivers/usb/dwc3/gadget.c
> > @@ -3248,6 +3248,10 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
> >  	if (event->status & DEPEVT_STATUS_SHORT && !chain)
> >  		return 1;
> >  
> > +	if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) &&
> > +	    DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_MISSED_ISOC)
> > +		return 1;
> > +
> >  	if ((trb->ctrl & DWC3_TRB_CTRL_IOC) ||
> >  	    (trb->ctrl & DWC3_TRB_CTRL_LST))
> >  		return 1;
> > -- 
> > 2.28.0
> >
> 
> Testing shows that the changes appear to work to prevent the arm-smmu panic I
> was seeing after missed isoc errors. Also, changes to reclaim trbs only up to
> the associated interrupt event make sense.
> 
> Reviewed-by: Jeff Vanhoof <jdv1029@xxxxxxxxx>
> Tested-by: Jeff Vanhoof <jdv1029@xxxxxxxxx>
> 
> Regards,
> Jeff
> 

I just followed up with Dan and he mentioned that he was still seeing the arm-smmu panic on his baseline. I will work with him this afternoon to better understand what may be going on there. Let's hold off on merging these changes in until we figure out what is going on. He and I are testing off of different baselines (5.10 vs 5.15), different USB speeds (USB 3 vs 2), and are using different hardware, so I don't know yet why we are seeing a difference here.

Regards,
Jeff




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux