linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: Fix debugfs creation flow
@ 2021-06-17  5:56 Minas Harutyunyan
  2021-06-17  6:10 ` Greg Kroah-Hartman
  2021-06-17  6:31 ` Jack Pham
  0 siblings, 2 replies; 9+ messages in thread
From: Minas Harutyunyan @ 2021-06-17  5:56 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, Felipe Balbi, Jack Pham, Peter Chen

Creation EP's debugfs called earlier than debugfs folder for dwc3
device created. As result EP's debugfs are created in '/sys/kernel/debug'
instead of '/sys/kernel/debug/usb/dwc3.1.auto'.

Moved dwc3_debugfs_init() function call before calling
dwc3_core_init_mode() to allow create dwc3 debugfs parent before
creating EP's debugfs's.

Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
---
 drivers/usb/dwc3/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index e0a8e796c158..ba74ad7f6995 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
 	}
 
 	dwc3_check_params(dwc);
+	dwc3_debugfs_init(dwc);
 
 	ret = dwc3_core_init_mode(dwc);
 	if (ret)
 		goto err5;
 
-	dwc3_debugfs_init(dwc);
 	pm_runtime_put(dev);
 
 	return 0;
 
 err5:
+	dwc3_debugfs_exit(dwc);
 	dwc3_event_buffers_cleanup(dwc);
 
 	usb_phy_shutdown(dwc->usb2_phy);

base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  5:56 [PATCH] usb: dwc3: Fix debugfs creation flow Minas Harutyunyan
@ 2021-06-17  6:10 ` Greg Kroah-Hartman
  2021-06-17  7:11   ` Minas Harutyunyan
  2021-06-17  6:31 ` Jack Pham
  1 sibling, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2021-06-17  6:10 UTC (permalink / raw)
  To: Minas Harutyunyan; +Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
> Creation EP's debugfs called earlier than debugfs folder for dwc3
> device created. As result EP's debugfs are created in '/sys/kernel/debug'
> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
> 
> Moved dwc3_debugfs_init() function call before calling
> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
> creating EP's debugfs's.
> 
> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> ---
>  drivers/usb/dwc3/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index e0a8e796c158..ba74ad7f6995 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>  	}
>  
>  	dwc3_check_params(dwc);
> +	dwc3_debugfs_init(dwc);
>  
>  	ret = dwc3_core_init_mode(dwc);
>  	if (ret)
>  		goto err5;
>  
> -	dwc3_debugfs_init(dwc);
>  	pm_runtime_put(dev);
>  
>  	return 0;
>  
>  err5:
> +	dwc3_debugfs_exit(dwc);
>  	dwc3_event_buffers_cleanup(dwc);
>  
>  	usb_phy_shutdown(dwc->usb2_phy);
> 
> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3

I thought we fixed this already in usb-next and usb-linus, right?  Where
are you seeing this problem happening?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  5:56 [PATCH] usb: dwc3: Fix debugfs creation flow Minas Harutyunyan
  2021-06-17  6:10 ` Greg Kroah-Hartman
@ 2021-06-17  6:31 ` Jack Pham
  2021-06-17  7:24   ` Minas Harutyunyan
  1 sibling, 1 reply; 9+ messages in thread
From: Jack Pham @ 2021-06-17  6:31 UTC (permalink / raw)
  To: Minas Harutyunyan; +Cc: linux-usb, Greg Kroah-Hartman, Felipe Balbi, Peter Chen

Hi Minas,

On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
> Creation EP's debugfs called earlier than debugfs folder for dwc3
> device created. As result EP's debugfs are created in '/sys/kernel/debug'
> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.

Interesting, I didn't encounter this in my testing. Oh but in our case
we have dr_mode as USB_DR_MODE_OTG, so when dwc3_core_init_mode() calls
dwc3_drd_init() the gadget_init() is done from a worker, and meanwhile
dwc3_debugfs_init() would have already had a chance to create the root
folder before that.

I'm assuming you're seeing this with dr_mode == USB_DR_MODE_PERIPHERAL?
Then in that case dwc3_core_init_mode() synchronously calls
dwc3_gadget_init() before the debugfs_init.

> Moved dwc3_debugfs_init() function call before calling
> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
> creating EP's debugfs's.
> 
> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")

Isn't it fixing 8d396bb0a5b6 ("usb: dwc3: debugfs: Add and remove
endpoint dirs dynamically")?  More fallout from my change I guess :-/.

Anyway it looks good to me, thanks!

Reviewed-by: Jack Pham <jackp@codeaurora.org>

> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> ---
>  drivers/usb/dwc3/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index e0a8e796c158..ba74ad7f6995 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>  	}
>  
>  	dwc3_check_params(dwc);
> +	dwc3_debugfs_init(dwc);
>  
>  	ret = dwc3_core_init_mode(dwc);
>  	if (ret)
>  		goto err5;
>  
> -	dwc3_debugfs_init(dwc);
>  	pm_runtime_put(dev);
>  
>  	return 0;
>  
>  err5:
> +	dwc3_debugfs_exit(dwc);
>  	dwc3_event_buffers_cleanup(dwc);
>  
>  	usb_phy_shutdown(dwc->usb2_phy);
> 
> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  6:10 ` Greg Kroah-Hartman
@ 2021-06-17  7:11   ` Minas Harutyunyan
  2021-06-17  7:33     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Minas Harutyunyan @ 2021-06-17  7:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Minas Harutyunyan
  Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

Hi Greg,

On 6/17/2021 10:10 AM, Greg Kroah-Hartman wrote:
> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
>> Creation EP's debugfs called earlier than debugfs folder for dwc3
>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
>>
>> Moved dwc3_debugfs_init() function call before calling
>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
>> creating EP's debugfs's.
>>
>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>> ---
>>   drivers/usb/dwc3/core.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index e0a8e796c158..ba74ad7f6995 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>   	}
>>   
>>   	dwc3_check_params(dwc);
>> +	dwc3_debugfs_init(dwc);
>>   
>>   	ret = dwc3_core_init_mode(dwc);
>>   	if (ret)
>>   		goto err5;
>>   
>> -	dwc3_debugfs_init(dwc);
>>   	pm_runtime_put(dev);
>>   
>>   	return 0;
>>   
>>   err5:
>> +	dwc3_debugfs_exit(dwc);
>>   	dwc3_event_buffers_cleanup(dwc);
>>   
>>   	usb_phy_shutdown(dwc->usb2_phy);
>>
>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
> 
> I thought we fixed this already in usb-next and usb-linus, right?  Where
> are you seeing this problem happening?

I faced this issue on 5.13.0-rc6. Patch "USB: dwc3: remove debugfs root 
dentry storage" introduced this issue, because of debugfs_lookup() 
function. I don't see any fix in usb-next.

Thanks,
Minas

> 
> thanks,
> 
> greg k-h
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  6:31 ` Jack Pham
@ 2021-06-17  7:24   ` Minas Harutyunyan
  0 siblings, 0 replies; 9+ messages in thread
From: Minas Harutyunyan @ 2021-06-17  7:24 UTC (permalink / raw)
  To: Jack Pham, Minas Harutyunyan
  Cc: linux-usb, Greg Kroah-Hartman, Felipe Balbi, Peter Chen

Hi Jack,

On 6/17/2021 10:31 AM, Jack Pham wrote:
> Hi Minas,
> 
> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
>> Creation EP's debugfs called earlier than debugfs folder for dwc3
>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
> 
> Interesting, I didn't encounter this in my testing. Oh but in our case
> we have dr_mode as USB_DR_MODE_OTG, so when dwc3_core_init_mode() calls
> dwc3_drd_init() the gadget_init() is done from a worker, and meanwhile
> dwc3_debugfs_init() would have already had a chance to create the root
> folder before that.
> 
> I'm assuming you're seeing this with dr_mode == USB_DR_MODE_PERIPHERAL?
> Then in that case dwc3_core_init_mode() synchronously calls
> dwc3_gadget_init() before the debugfs_init.

In my case dr_mode forced to gadget.

> 
>> Moved dwc3_debugfs_init() function call before calling
>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
>> creating EP's debugfs's.
>>
>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
> 
> Isn't it fixing 8d396bb0a5b6 ("usb: dwc3: debugfs: Add and remove
> endpoint dirs dynamically")?  More fallout from my change I guess :-/.
> 

Issue happen because of instead of 'dwc->root' uses debugfs_lookup() 
function on debugfs's creation. This is why I think my "Fixes:" tag is 
correct.

Thanks,
Minas


> Anyway it looks good to me, thanks!
> 
> Reviewed-by: Jack Pham <jackp@codeaurora.org>
> 
>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>> ---
>>   drivers/usb/dwc3/core.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index e0a8e796c158..ba74ad7f6995 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>   	}
>>   
>>   	dwc3_check_params(dwc);
>> +	dwc3_debugfs_init(dwc);
>>   
>>   	ret = dwc3_core_init_mode(dwc);
>>   	if (ret)
>>   		goto err5;
>>   
>> -	dwc3_debugfs_init(dwc);
>>   	pm_runtime_put(dev);
>>   
>>   	return 0;
>>   
>>   err5:
>> +	dwc3_debugfs_exit(dwc);
>>   	dwc3_event_buffers_cleanup(dwc);
>>   
>>   	usb_phy_shutdown(dwc->usb2_phy);
>>
>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
>> -- 
>> 2.11.0
>>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  7:11   ` Minas Harutyunyan
@ 2021-06-17  7:33     ` Greg Kroah-Hartman
  2021-06-17  9:14       ` Minas Harutyunyan
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2021-06-17  7:33 UTC (permalink / raw)
  To: Minas Harutyunyan; +Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

On Thu, Jun 17, 2021 at 07:11:33AM +0000, Minas Harutyunyan wrote:
> Hi Greg,
> 
> On 6/17/2021 10:10 AM, Greg Kroah-Hartman wrote:
> > On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
> >> Creation EP's debugfs called earlier than debugfs folder for dwc3
> >> device created. As result EP's debugfs are created in '/sys/kernel/debug'
> >> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
> >>
> >> Moved dwc3_debugfs_init() function call before calling
> >> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
> >> creating EP's debugfs's.
> >>
> >> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
> >> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> >> ---
> >>   drivers/usb/dwc3/core.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >> index e0a8e796c158..ba74ad7f6995 100644
> >> --- a/drivers/usb/dwc3/core.c
> >> +++ b/drivers/usb/dwc3/core.c
> >> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
> >>   	}
> >>   
> >>   	dwc3_check_params(dwc);
> >> +	dwc3_debugfs_init(dwc);
> >>   
> >>   	ret = dwc3_core_init_mode(dwc);
> >>   	if (ret)
> >>   		goto err5;
> >>   
> >> -	dwc3_debugfs_init(dwc);
> >>   	pm_runtime_put(dev);
> >>   
> >>   	return 0;
> >>   
> >>   err5:
> >> +	dwc3_debugfs_exit(dwc);
> >>   	dwc3_event_buffers_cleanup(dwc);
> >>   
> >>   	usb_phy_shutdown(dwc->usb2_phy);
> >>
> >> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
> > 
> > I thought we fixed this already in usb-next and usb-linus, right?  Where
> > are you seeing this problem happening?
> 
> I faced this issue on 5.13.0-rc6. Patch "USB: dwc3: remove debugfs root 
> dentry storage" introduced this issue, because of debugfs_lookup() 
> function. I don't see any fix in usb-next.

4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") in
linux-next "should" solve this issue.  Or it was supposed to.  I
thought.  I'm getting confused about this problem these days...

The commit you reference above in the fixes line is NOT in 5.13-rc6, so
how can this commit fix a problem in 5.13-rc6?

still confused,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  7:33     ` Greg Kroah-Hartman
@ 2021-06-17  9:14       ` Minas Harutyunyan
  2021-06-17 11:01         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Minas Harutyunyan @ 2021-06-17  9:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Minas Harutyunyan
  Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

Hi Greg,

On 6/17/2021 11:33 AM, Greg Kroah-Hartman wrote:
> On Thu, Jun 17, 2021 at 07:11:33AM +0000, Minas Harutyunyan wrote:
>> Hi Greg,
>>
>> On 6/17/2021 10:10 AM, Greg Kroah-Hartman wrote:
>>> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
>>>> Creation EP's debugfs called earlier than debugfs folder for dwc3
>>>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
>>>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
>>>>
>>>> Moved dwc3_debugfs_init() function call before calling
>>>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
>>>> creating EP's debugfs's.
>>>>
>>>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>>> ---
>>>>    drivers/usb/dwc3/core.c | 3 ++-
>>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>>> index e0a8e796c158..ba74ad7f6995 100644
>>>> --- a/drivers/usb/dwc3/core.c
>>>> +++ b/drivers/usb/dwc3/core.c
>>>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>>>    	}
>>>>    
>>>>    	dwc3_check_params(dwc);
>>>> +	dwc3_debugfs_init(dwc);
>>>>    
>>>>    	ret = dwc3_core_init_mode(dwc);
>>>>    	if (ret)
>>>>    		goto err5;
>>>>    
>>>> -	dwc3_debugfs_init(dwc);
>>>>    	pm_runtime_put(dev);
>>>>    
>>>>    	return 0;
>>>>    
>>>>    err5:
>>>> +	dwc3_debugfs_exit(dwc);
>>>>    	dwc3_event_buffers_cleanup(dwc);
>>>>    
>>>>    	usb_phy_shutdown(dwc->usb2_phy);
>>>>
>>>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
>>>
>>> I thought we fixed this already in usb-next and usb-linus, right?  Where
>>> are you seeing this problem happening?
>>
>> I faced this issue on 5.13.0-rc6. Patch "USB: dwc3: remove debugfs root
>> dentry storage" introduced this issue, because of debugfs_lookup()
>> function. I don't see any fix in usb-next.
> 
> 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") in
> linux-next "should" solve this issue.  Or it was supposed to.  I
> thought.  I'm getting confused about this problem these days...

No, 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") 
fix another thing.
> 
> The commit you reference above in the fixes line is NOT in 5.13-rc6, so
> how can this commit fix a problem in 5.13-rc6?

I see that commit in your "usb-next" below "Merge tag 'v5.13-rc6'":

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?qt=grep&q=&h=usb-next

Thanks,
Minas


> 
> still confused,
> 
> greg k-h
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17  9:14       ` Minas Harutyunyan
@ 2021-06-17 11:01         ` Greg Kroah-Hartman
  2021-06-17 16:20           ` Minas Harutyunyan
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2021-06-17 11:01 UTC (permalink / raw)
  To: Minas Harutyunyan; +Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

On Thu, Jun 17, 2021 at 09:14:37AM +0000, Minas Harutyunyan wrote:
> Hi Greg,
> 
> On 6/17/2021 11:33 AM, Greg Kroah-Hartman wrote:
> > On Thu, Jun 17, 2021 at 07:11:33AM +0000, Minas Harutyunyan wrote:
> >> Hi Greg,
> >>
> >> On 6/17/2021 10:10 AM, Greg Kroah-Hartman wrote:
> >>> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
> >>>> Creation EP's debugfs called earlier than debugfs folder for dwc3
> >>>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
> >>>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
> >>>>
> >>>> Moved dwc3_debugfs_init() function call before calling
> >>>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
> >>>> creating EP's debugfs's.
> >>>>
> >>>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
> >>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
> >>>> ---
> >>>>    drivers/usb/dwc3/core.c | 3 ++-
> >>>>    1 file changed, 2 insertions(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> >>>> index e0a8e796c158..ba74ad7f6995 100644
> >>>> --- a/drivers/usb/dwc3/core.c
> >>>> +++ b/drivers/usb/dwc3/core.c
> >>>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
> >>>>    	}
> >>>>    
> >>>>    	dwc3_check_params(dwc);
> >>>> +	dwc3_debugfs_init(dwc);
> >>>>    
> >>>>    	ret = dwc3_core_init_mode(dwc);
> >>>>    	if (ret)
> >>>>    		goto err5;
> >>>>    
> >>>> -	dwc3_debugfs_init(dwc);
> >>>>    	pm_runtime_put(dev);
> >>>>    
> >>>>    	return 0;
> >>>>    
> >>>>    err5:
> >>>> +	dwc3_debugfs_exit(dwc);
> >>>>    	dwc3_event_buffers_cleanup(dwc);
> >>>>    
> >>>>    	usb_phy_shutdown(dwc->usb2_phy);
> >>>>
> >>>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
> >>>
> >>> I thought we fixed this already in usb-next and usb-linus, right?  Where
> >>> are you seeing this problem happening?
> >>
> >> I faced this issue on 5.13.0-rc6. Patch "USB: dwc3: remove debugfs root
> >> dentry storage" introduced this issue, because of debugfs_lookup()
> >> function. I don't see any fix in usb-next.
> > 
> > 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") in
> > linux-next "should" solve this issue.  Or it was supposed to.  I
> > thought.  I'm getting confused about this problem these days...
> 
> No, 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") 
> fix another thing.
> > 
> > The commit you reference above in the fixes line is NOT in 5.13-rc6, so
> > how can this commit fix a problem in 5.13-rc6?
> 
> I see that commit in your "usb-next" below "Merge tag 'v5.13-rc6'":
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?qt=grep&q=&h=usb-next

Yes, but that is NOT in 5.13-rc6, so your above comment does not make
sense to me.

So, to be specific, what commit causes this problem, that this patch
fixes?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] usb: dwc3: Fix debugfs creation flow
  2021-06-17 11:01         ` Greg Kroah-Hartman
@ 2021-06-17 16:20           ` Minas Harutyunyan
  0 siblings, 0 replies; 9+ messages in thread
From: Minas Harutyunyan @ 2021-06-17 16:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Minas Harutyunyan
  Cc: linux-usb, Felipe Balbi, Jack Pham, Peter Chen

Hi Greg,

On 6/17/2021 3:01 PM, Greg Kroah-Hartman wrote:
> On Thu, Jun 17, 2021 at 09:14:37AM +0000, Minas Harutyunyan wrote:
>> Hi Greg,
>>
>> On 6/17/2021 11:33 AM, Greg Kroah-Hartman wrote:
>>> On Thu, Jun 17, 2021 at 07:11:33AM +0000, Minas Harutyunyan wrote:
>>>> Hi Greg,
>>>>
>>>> On 6/17/2021 10:10 AM, Greg Kroah-Hartman wrote:
>>>>> On Wed, Jun 16, 2021 at 10:56:02PM -0700, Minas Harutyunyan wrote:
>>>>>> Creation EP's debugfs called earlier than debugfs folder for dwc3
>>>>>> device created. As result EP's debugfs are created in '/sys/kernel/debug'
>>>>>> instead of '/sys/kernel/debug/usb/dwc3.1.auto'.
>>>>>>
>>>>>> Moved dwc3_debugfs_init() function call before calling
>>>>>> dwc3_core_init_mode() to allow create dwc3 debugfs parent before
>>>>>> creating EP's debugfs's.
>>>>>>
>>>>>> Fixes: 8562d5bfc0fc ("USB: dwc3: remove debugfs root dentry storage")
>>>>>> Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
>>>>>> ---
>>>>>>     drivers/usb/dwc3/core.c | 3 ++-
>>>>>>     1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>>>>> index e0a8e796c158..ba74ad7f6995 100644
>>>>>> --- a/drivers/usb/dwc3/core.c
>>>>>> +++ b/drivers/usb/dwc3/core.c
>>>>>> @@ -1620,17 +1620,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>>>>>     	}
>>>>>>     
>>>>>>     	dwc3_check_params(dwc);
>>>>>> +	dwc3_debugfs_init(dwc);
>>>>>>     
>>>>>>     	ret = dwc3_core_init_mode(dwc);
>>>>>>     	if (ret)
>>>>>>     		goto err5;
>>>>>>     
>>>>>> -	dwc3_debugfs_init(dwc);
>>>>>>     	pm_runtime_put(dev);
>>>>>>     
>>>>>>     	return 0;
>>>>>>     
>>>>>>     err5:
>>>>>> +	dwc3_debugfs_exit(dwc);
>>>>>>     	dwc3_event_buffers_cleanup(dwc);
>>>>>>     
>>>>>>     	usb_phy_shutdown(dwc->usb2_phy);
>>>>>>
>>>>>> base-commit: 1da8116eb0c5dfc05cfb89896239badb18c4daf3
>>>>>
>>>>> I thought we fixed this already in usb-next and usb-linus, right?  Where
>>>>> are you seeing this problem happening?
>>>>
>>>> I faced this issue on 5.13.0-rc6. Patch "USB: dwc3: remove debugfs root
>>>> dentry storage" introduced this issue, because of debugfs_lookup()
>>>> function. I don't see any fix in usb-next.
>>>
>>> 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot") in
>>> linux-next "should" solve this issue.  Or it was supposed to.  I
>>> thought.  I'm getting confused about this problem these days...
>>
>> No, 4bf584a03eec ("usb: dwc3: core: fix kernel panic when do reboot")
>> fix another thing.
>>>
>>> The commit you reference above in the fixes line is NOT in 5.13-rc6, so
>>> how can this commit fix a problem in 5.13-rc6?
>>
>> I see that commit in your "usb-next" below "Merge tag 'v5.13-rc6'":
>>
>> https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/log/?qt=grep&q=&h=usb-next__;!!A4F2R9G_pg!PTDgJQuQ-2Fm-W1USauFWPakwOBeq629PhvUGclN6bPr75tv_is1kmBI6aiibjvBcw8yzIOm$
> 
> Yes, but that is NOT in 5.13-rc6, so your above comment does not make
> sense to me.
> 
> So, to be specific, what commit causes this problem, that this patch
> fixes?

Yes, you are right. My fixes tag is incorrect. Sorry, for noise.

Recently on debugfs of dwc3 submitted 4 commits:
8d396bb0a5b6 Jack Pham usb: dwc3: debugfs: Add and remove endpoint dirs 
dynamically
2a042767814b Peter Chen usb: dwc3: core: fix kernel panic when do reboot
8562d5bfc0fc Greg Kroah-Hartman USB: dwc3: remove debugfs root dentry 
storage
7f5167c67cd9 Minas Harutyunyan usb: dwc3: Fix debugfs creation flow

Issue introduced by Jack commit 8d396bb0a5b6.
Peters commit 2a042767814b fix issue of Jack commit on deleting debugfs 
flow.
My commit 7f5167c67cd9 fix issue of Jack commit on creating debugfs flow.

Soon I'll submit V2 commit with correct fixes tag.

Thanks,
Minas


> 
> thanks,
> 
> greg k-h
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-17 16:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  5:56 [PATCH] usb: dwc3: Fix debugfs creation flow Minas Harutyunyan
2021-06-17  6:10 ` Greg Kroah-Hartman
2021-06-17  7:11   ` Minas Harutyunyan
2021-06-17  7:33     ` Greg Kroah-Hartman
2021-06-17  9:14       ` Minas Harutyunyan
2021-06-17 11:01         ` Greg Kroah-Hartman
2021-06-17 16:20           ` Minas Harutyunyan
2021-06-17  6:31 ` Jack Pham
2021-06-17  7:24   ` Minas Harutyunyan

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