Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-17 Thread Felipe Balbi
Hi, (I have added you to another thread which is where we'll be collecting discussion about this, however ...) Alan Stern writes: > On Fri, 14 Oct 2016, Felipe Balbi wrote: > >> argh, we have nested spinlocks :-( Well, we shouldn't call >> usb_ep_disable() with locks

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-17 Thread Felipe Balbi
Hi, (I have added you to another thread which is where we'll be collecting discussion about this, however ...) Alan Stern writes: > On Fri, 14 Oct 2016, Felipe Balbi wrote: > >> argh, we have nested spinlocks :-( Well, we shouldn't call >> usb_ep_disable() with locks held AFAICR. So the

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Alan Stern
On Fri, 14 Oct 2016, Felipe Balbi wrote: > argh, we have nested spinlocks :-( Well, we shouldn't call > usb_ep_disable() with locks held AFAICR. So the following should be > enough: > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > index

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Alan Stern
On Fri, 14 Oct 2016, Felipe Balbi wrote: > argh, we have nested spinlocks :-( Well, we shouldn't call > usb_ep_disable() with locks held AFAICR. So the following should be > enough: > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > index

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Felipe Balbi
Hi, Baolin Wang writes: >> Baolin Wang writes: >>> I see what the problem is. Databook tells us we *must* set CMDIOC >>> when >>> issuing EndTransfer command and we should always wait for Command >>> Complete IRQ.

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Felipe Balbi
Hi, Baolin Wang writes: >> Baolin Wang writes: >>> I see what the problem is. Databook tells us we *must* set CMDIOC >>> when >>> issuing EndTransfer command and we should always wait for Command >>> Complete IRQ. However, we took a shortcut and just delayed

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Baolin Wang
Hi Felipe, On 14 October 2016 at 15:46, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> I see what the problem is. Databook tells us we *must* set CMDIOC >> when >> issuing EndTransfer command and we should always wait

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Baolin Wang
Hi Felipe, On 14 October 2016 at 15:46, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> I see what the problem is. Databook tells us we *must* set CMDIOC >> when >> issuing EndTransfer command and we should always wait for Command >> Complete IRQ.

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Felipe Balbi
Hi, Baolin Wang writes: > I see what the problem is. Databook tells us we *must* set CMDIOC when > issuing EndTransfer command and we should always wait for Command > Complete IRQ. However, we took a shortcut and just delayed for 100us >

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Felipe Balbi
Hi, Baolin Wang writes: > I see what the problem is. Databook tells us we *must* set CMDIOC when > issuing EndTransfer command and we should always wait for Command > Complete IRQ. However, we took a shortcut and just delayed for 100us > after issuing End

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Baolin Wang
Hi Felipe, On 13 October 2016 at 21:34, Felipe Balbi wrote: > > > Hi, > > Baolin Wang writes: >>> Baolin Wang writes: >> Baolin Wang writes: >> I'm thinking this is a bug in configfs

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-14 Thread Baolin Wang
Hi Felipe, On 13 October 2016 at 21:34, Felipe Balbi wrote: > > > Hi, > > Baolin Wang writes: >>> Baolin Wang writes: >> Baolin Wang writes: >> I'm thinking this is a bug in configfs interface of Gadget API, not >> dwc3. The only reason for this to happen would be if we

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: >> Baolin Wang writes: > Baolin Wang writes: > I'm thinking this is a bug in configfs interface of Gadget API, not > dwc3. The only reason for this to happen would be if we get

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: >> Baolin Wang writes: > Baolin Wang writes: > I'm thinking this is a bug in configfs interface of Gadget API, not > dwc3. The only reason for this to happen would be if we get to > ->udc_stop() with endpoints still enabled. >

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi Felipe, On 13 October 2016 at 19:23, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: Baolin Wang writes: I'm thinking this is a bug in configfs interface of Gadget API, not dwc3. The only reason for

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi Felipe, On 13 October 2016 at 19:23, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: Baolin Wang writes: I'm thinking this is a bug in configfs interface of Gadget API, not dwc3. The only reason for this to happen would be if we get to ->udc_stop() with

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: >>> Baolin Wang writes: >>> I'm thinking this is a bug in configfs interface of Gadget API, not >>> dwc3. The only reason for this to happen would be if we get to >>> ->udc_stop() with endpoints still enabled.

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: >>> Baolin Wang writes: >>> I'm thinking this is a bug in configfs interface of Gadget API, not >>> dwc3. The only reason for this to happen would be if we get to >>> ->udc_stop() with endpoints still enabled. >>> >>> Can you check if that's the

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
On 13 October 2016 at 18:56, Felipe Balbi wrote: > > Hi, > > Felipe Balbi writes: >> Hi, >> >> Baolin Wang writes: >> I'm thinking this is a bug in configfs interface of Gadget API, not >> dwc3. The only reason for this to

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
On 13 October 2016 at 18:56, Felipe Balbi wrote: > > Hi, > > Felipe Balbi writes: >> Hi, >> >> Baolin Wang writes: >> I'm thinking this is a bug in configfs interface of Gadget API, not >> dwc3. The only reason for this to happen would be if we get to >> ->udc_stop() with endpoints

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Felipe Balbi writes: > Hi, > > Baolin Wang writes: > I'm thinking this is a bug in configfs interface of Gadget API, not > dwc3. The only reason for this to happen would be if we get to > ->udc_stop() with endpoints still enabled. >

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Felipe Balbi writes: > Hi, > > Baolin Wang writes: > I'm thinking this is a bug in configfs interface of Gadget API, not > dwc3. The only reason for this to happen would be if we get to > ->udc_stop() with endpoints still enabled. > > Can you check if that's the case?

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: I'm thinking this is a bug in configfs interface of Gadget API, not dwc3. The only reason for this to happen would be if we get to ->udc_stop() with endpoints still enabled. Can you check if that's the case? i.e. can you

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: I'm thinking this is a bug in configfs interface of Gadget API, not dwc3. The only reason for this to happen would be if we get to ->udc_stop() with endpoints still enabled. Can you check if that's the case? i.e. can you check if any endpoints

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi, On 13 October 2016 at 15:51, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> Hi, >> >> On 13 October 2016 at 15:02, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Baolin Wang writes: @@ -1742,6

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi, On 13 October 2016 at 15:51, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> Hi, >> >> On 13 October 2016 at 15:02, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Baolin Wang writes: @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g)

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: > Hi, > > On 13 October 2016 at 15:02, Felipe Balbi wrote: >> >> Hi, >> >> Baolin Wang writes: >>> @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) >>> dwc->gadget_driver

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: > Hi, > > On 13 October 2016 at 15:02, Felipe Balbi wrote: >> >> Hi, >> >> Baolin Wang writes: >>> @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) >>> dwc->gadget_driver = NULL; >>> spin_unlock_irqrestore(>lock, flags); >>> >>>

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi, On 13 October 2016 at 15:02, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) >> dwc->gadget_driver = NULL; >> spin_unlock_irqrestore(>lock, flags); >>

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Baolin Wang
Hi, On 13 October 2016 at 15:02, Felipe Balbi wrote: > > Hi, > > Baolin Wang writes: >> @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) >> dwc->gadget_driver = NULL; >> spin_unlock_irqrestore(>lock, flags); >> >> + /* >> + * Since the xHCI will

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: > @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) > dwc->gadget_driver = NULL; > spin_unlock_irqrestore(>lock, flags); > > + /* > + * Since the xHCI will share the same interrupt with gadget,

Re: [PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-13 Thread Felipe Balbi
Hi, Baolin Wang writes: > @@ -1742,6 +1791,17 @@ static int dwc3_gadget_stop(struct usb_gadget *g) > dwc->gadget_driver = NULL; > spin_unlock_irqrestore(>lock, flags); > > + /* > + * Since the xHCI will share the same interrupt with gadget, thus when > + * free

[PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-12 Thread Baolin Wang
When we change the USB function with configfs frequently, sometimes it will hang the system to crash. The reason is the gadget driver can not hanle the end transfer complete event after free the gadget irq (since the xHCI will share the same interrupt number with gadget, thus when free the gadget

[PATCH v2] usb: dwc3: gadget: Wait for end transfer complete before free irq

2016-10-12 Thread Baolin Wang
When we change the USB function with configfs frequently, sometimes it will hang the system to crash. The reason is the gadget driver can not hanle the end transfer complete event after free the gadget irq (since the xHCI will share the same interrupt number with gadget, thus when free the gadget