Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Dan Carpenter
On Fri, Dec 07, 2018 at 02:13:18PM +, Minas Harutyunyan wrote: > > My patch doesn't pass sparse checking: "warning: context imbalance in > 'dwc2_hsotg_core_init_disconnected' - unexpected unlock". Sparse persist! > So, I need to re-work patch. Can I use your idea with > dwc2_hsotg_ep_disable

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Minas Harutyunyan
Hi Dan, On 12/7/2018 3:20 PM, Minas Harutyunyan wrote: > Hi Dan, > > On 12/7/2018 2:16 PM, Dan Carpenter wrote: >> On Wed, Dec 05, 2018 at 12:52:22PM +, Minas Harutyunyan wrote: >>> Hi, >>> >>> On 12/4/2018 5:29 PM, Dan Carpenter wrote: On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Har

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Minas Harutyunyan
Hi Dan, On 12/7/2018 2:16 PM, Dan Carpenter wrote: > On Wed, Dec 05, 2018 at 12:52:22PM +, Minas Harutyunyan wrote: >> Hi, >> >> On 12/4/2018 5:29 PM, Dan Carpenter wrote: >>> On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Harutyunyan wrote: @@ -3185,12 +3183,13 @@ void dwc2_hsotg_discon

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Dan Carpenter
On Wed, Dec 05, 2018 at 12:52:22PM +, Minas Harutyunyan wrote: > Hi, > > On 12/4/2018 5:29 PM, Dan Carpenter wrote: > > On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Harutyunyan wrote: > >> @@ -3185,12 +3183,13 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg > >> *hsotg) > >> hsot

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Felipe Balbi
Hi, Minas Harutyunyan writes: > Hi Filipe, > > My patch dccf1bad4be7eaa096c1f3697bd37883f9a08ecb "usb: dwc2: Disable > all EP's on disconnect" applied to 4.20-rc1. > > I need to update this patch. What I should do. There are 2 options: > > 1.

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Minas Harutyunyan
Hi Filipe, My patch dccf1bad4be7eaa096c1f3697bd37883f9a08ecb "usb: dwc2: Disable all EP's on disconnect" applied to 4.20-rc1. I need to update this patch. What I should do. There are 2 options: 1. Ack Marek Szyprowski [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP&#

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Felipe Balbi
;>>> >>> Hi Dan, Marek, Maynard, >>> >>> Could you please apply bellow patch over follow patches: >>> >>> dccf1bad4be7 usb: dwc2: Disable all EP's on disconnect >>> 6f774b501928 usb: dwc2: Fix ep disable spinlock flow. >>> &

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Minas Harutyunyan
:43 PM, Dan Carpenter wrote: >>> Ugh... We also had a long thread about the v2 patch but it turns out >>> the list was not CC'd. I should have checked for that. >>> >>> You have to pass a flag to say if the caller holds the lock or not... >>>

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-07 Thread Minas Harutyunyan
CC'd. I should have checked for that. >>> >>> You have to pass a flag to say if the caller holds the lock or not... >>> >>> regards, >>> dan carpenter >>> >> Hi Dan, Marek, Maynard, >> >> Could you please apply bellow pat

RE: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-06 Thread Maynard CABIENTE
checked for that. > > > > You have to pass a flag to say if the caller holds the lock or not... > > > > regards, > > dan carpenter > > > > Hi Dan, Marek, Maynard, > > Could you please apply bellow patch over follow patches: > > dccf1bad4be

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-06 Thread Marek Szyprowski
Hi Dan, On 2018-12-06 15:52, Dan Carpenter wrote: > Hi Marek, > > I'm surprised you don't get deadlocks when you apply this patch. Why should I get it? It is just a revert to the state before applying the mentioned incorrect patch. > On Wed, Nov 21, 2018 at 04:45:04PM +0100, Marek Szyprowski wro

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-06 Thread Marek Szyprowski
g to say if the caller holds the lock or not... >> >> regards, >> dan carpenter >> > Hi Dan, Marek, Maynard, > > Could you please apply bellow patch over follow patches: > > dccf1bad4be7 usb: dwc2: Disable all EP's on disconnect > 6f774b501928 u

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-06 Thread Dan Carpenter
Hi Marek, I'm surprised you don't get deadlocks when you apply this patch. On Wed, Nov 21, 2018 at 04:45:04PM +0100, Marek Szyprowski wrote: > @@ -4020,9 +4008,7 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) > > epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); > > -

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-05 Thread Minas Harutyunyan
Hi, On 12/4/2018 5:29 PM, Dan Carpenter wrote: > On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Harutyunyan wrote: >> @@ -3185,12 +3183,13 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg) >> hsotg->connected = 0; >> hsotg->test_mode = 0; >> >> - /* all endpoints s

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-04 Thread Dan Carpenter
On Tue, Dec 04, 2018 at 12:34:08PM +, Minas Harutyunyan wrote: > @@ -3185,12 +3183,13 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg) > hsotg->connected = 0; > hsotg->test_mode = 0; > > - /* all endpoints should be shutdown */ > for (ep = 0; ep < hsotg-

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-12-04 Thread Minas Harutyunyan
arpenter > Hi Dan, Marek, Maynard, Could you please apply bellow patch over follow patches: dccf1bad4be7 usb: dwc2: Disable all EP's on disconnect 6f774b501928 usb: dwc2: Fix ep disable spinlock flow. Please review and test. Feedback is appreciated :-) diff --git a/drivers/usb/dwc2/ga

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-11-23 Thread Dan Carpenter
Ugh... We also had a long thread about the v2 patch but it turns out the list was not CC'd. I should have checked for that. You have to pass a flag to say if the caller holds the lock or not... regards, dan carpenter

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-11-23 Thread Marek Szyprowski
t; /* >> * we must now enable ep0 ready for host detection and then >> @@ -4004,7 +3993,6 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) >> unsigned long flags; >> u32 epctrl_reg; >> u32 ctrl; >> -int locked; >> >> dev

Re: [PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-11-21 Thread Minas Harutyunyan
= spin_is_locked(&hsotg->lock); > - if (!locked) > - spin_lock_irqsave(&hsotg->lock, flags); > + spin_lock_irqsave(&hsotg->lock, flags); > > ctrl = dwc2_readl(hsotg, epctrl_reg); > > @@ -4046,9 +4032,7 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) > hs_ep->fifo_index = 0; > hs_ep->fifo_size = 0; > > - if (!locked) > - spin_unlock_irqrestore(&hsotg->lock, flags); > - > + spin_unlock_irqrestore(&hsotg->lock, flags); > return 0; > } > > Could you please apply "[PATCH v2] usb: dwc2: Disable all EP's on disconnect" and fix for that patch "[PATCH] usb: dwc2: Fix ep disable spinlock flow.". Let me know on test results. Thanks, Minas

[PATCH] usb: dwc2: Revert "usb: dwc2: Disable all EP's on disconnect"

2018-11-21 Thread Marek Szyprowski
This reverts commit dccf1bad4be7eaa096c1f3697bd37883f9a08ecb. The reverted commit breaks locking in the DWC2 driver. It causes random crashes or memory corruption related issues on SMP machines. Here is an example of the observed reproducible issue (other are a bit more random): =

Re: usb: dwc2: Disable all EP's on disconnect

2018-10-28 Thread Geert Uytterhoeven
.org/torvalds/c/dccf1bad4be7eaa096c1f3697bd37883f9a08ecb > Author: Minas Harutyunyan > AuthorDate: Wed Sep 19 18:13:52 2018 +0400 > Committer: Felipe Balbi > CommitDate: Tue Oct 2 10:33:15 2018 +0300 > > usb: dwc2: Disable all EP's on disconnect > > Disabling all EP's allow to

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-20 Thread Dan Carpenter
l. > > How do we know that it's safe for the other thread to drop the lock? > > > > There should at least be a long comment in front of the code explaining > > why it's safe to steal the lock like this. > > Please review patch version 2: "[PATCH v2] us

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-20 Thread Minas Harutyunyan
gt; There should at least be a long comment in front of the code explaining > why it's safe to steal the lock like this. Please review patch version 2: "[PATCH v2] usb: dwc2: Disable all EP's on disconnect" Thanks, Minas

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-20 Thread Dan Carpenter
Hi Minas, url: https://github.com/0day-ci/linux/commits/Minas-Harutyunyan/usb-dwc2-Disable-all-EP-s-on-disconnect/20180919-104259 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next smatch warnings: drivers/usb/dwc2/gadget.c:4024 dwc2_hsotg_ep_disable() error: double un

[PATCH v2] usb: dwc2: Disable all EP's on disconnect

2018-09-19 Thread Minas Harutyunyan
Disabling all EP's allow to reset EP's to initial state. On disconnect disable all EP's instead of just killing all requests. Because of some platform didn't catch disconnect event, same stuff added to dwc2_hsotg_core_init_disconnected() function when USB reset detected on the bus. Changed from ve

Re: [PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-18 Thread kbuild test robot
Hi Minas, I love your patch! Perhaps something to improve: [auto build test WARNING on balbi-usb/next] [also build test WARNING on v4.19-rc4 next-20180918] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linu

[PATCH] usb: dwc2: Disable all EP's on disconnect

2018-09-18 Thread Minas Harutyunyan
Disabling all EP's allow to reset EP's to initial state. On disconnect disable all EP's instead of just killing all requests. Because of some platform didn't catch disconnect event, same stuff added to dwc2_hsotg_core_init_disconnected() function when USB reset detected on the bus. In dwc2_hsotg_ep