* [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
@ 2017-01-12 12:03 William Wu
2017-01-12 12:26 ` Roger Quadros
2017-01-13 3:04 ` [RESEND PATCH] " William Wu
0 siblings, 2 replies; 6+ messages in thread
From: William Wu @ 2017-01-12 12:03 UTC (permalink / raw)
To: gregkh
Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
huangtao, dianders, groeck, william.wu, rogerq, William wu
From: William wu <wulf@rock-chips.com>
On some platforms(e.g. rk3399 board), we can call hcd_add/remove
consecutively without calling usb_put_hcd/usb_create_hcd in between,
so hcd->flags can be stale.
If the HC dies due to whatever reason then without this patch we get
the below error on next hcd_add.
[173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
[173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
[173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
[173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
[173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
[173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[173.297222] usb usb6: Product: xHCI Host Controller
[173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
[173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
[173.298680] hub 6-0:1.0: USB hub found
[173.298749] hub 6-0:1.0: 1 port detected
[173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
[173.395418] hub 5-0:1.0: activate --> -19
[173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
[173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
[173.603513] Hardware name: Google Kevin (DT)
[173.603531] Call trace:
[173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
[173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
[173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
[173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
[173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
[173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
[173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
[173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
[173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
[173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
[173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
...
[173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
[173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
[173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
[173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
[173.604607] [<0000000000b16000>] 0xb16000
[173.604622] handlers:
[173.604648] [<ffffffc000642084>] usb_hcd_irq
[173.604673] Disabling IRQ #228
Signed-off-by: William wu <wulf@rock-chips.com>
Signed-off-by: William wu <william.wu@rock-chips.com>
---
drivers/usb/core/hcd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 479e223..612fab6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
}
usb_put_invalidate_rhdev(hcd);
+ hcd->flags = 0;
}
EXPORT_SYMBOL_GPL(usb_remove_hcd);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
2017-01-12 12:03 [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd William Wu
@ 2017-01-12 12:26 ` Roger Quadros
2017-01-12 15:33 ` Alan Stern
2017-01-13 3:04 ` [RESEND PATCH] " William Wu
1 sibling, 1 reply; 6+ messages in thread
From: Roger Quadros @ 2017-01-12 12:26 UTC (permalink / raw)
To: William Wu, gregkh
Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
huangtao, dianders, groeck, William wu
William,
On 12/01/17 14:03, William Wu wrote:
> From: William wu <wulf@rock-chips.com>
>
> On some platforms(e.g. rk3399 board), we can call hcd_add/remove
> consecutively without calling usb_put_hcd/usb_create_hcd in between,
> so hcd->flags can be stale.
>
> If the HC dies due to whatever reason then without this patch we get
> the below error on next hcd_add.
>
> [173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
> [173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
> [173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
> [173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
> [173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
> [173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> [173.297222] usb usb6: Product: xHCI Host Controller
> [173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
> [173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
> [173.298680] hub 6-0:1.0: USB hub found
> [173.298749] hub 6-0:1.0: 1 port detected
> [173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
> [173.395418] hub 5-0:1.0: activate --> -19
> [173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
> [173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
> [173.603513] Hardware name: Google Kevin (DT)
> [173.603531] Call trace:
> [173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
> [173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
> [173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
> [173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
> [173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
> [173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
> [173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
> [173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
> [173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
> [173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
> [173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
> ...
> [173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
> [173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
> [173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
> [173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
> [173.604607] [<0000000000b16000>] 0xb16000
> [173.604622] handlers:
> [173.604648] [<ffffffc000642084>] usb_hcd_irq
> [173.604673] Disabling IRQ #228
>
> Signed-off-by: William wu <wulf@rock-chips.com>
> Signed-off-by: William wu <william.wu@rock-chips.com>
> ---
> drivers/usb/core/hcd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 479e223..612fab6 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
> }
>
> usb_put_invalidate_rhdev(hcd);
> + hcd->flags = 0;
> }
> EXPORT_SYMBOL_GPL(usb_remove_hcd);
>
>
I suggest to initialize hcd->flags to 0 in usb_add_hcd() instead.
cheers,
-roger
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
2017-01-12 12:26 ` Roger Quadros
@ 2017-01-12 15:33 ` Alan Stern
2017-01-12 15:38 ` Roger Quadros
0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2017-01-12 15:33 UTC (permalink / raw)
To: Roger Quadros
Cc: William Wu, gregkh, heiko, linux-kernel, linux-usb,
linux-rockchip, frank.wang, huangtao, dianders, groeck,
William wu
On Thu, 12 Jan 2017, Roger Quadros wrote:
> William,
>
> On 12/01/17 14:03, William Wu wrote:
> > From: William wu <wulf@rock-chips.com>
> >
> > On some platforms(e.g. rk3399 board), we can call hcd_add/remove
> > consecutively without calling usb_put_hcd/usb_create_hcd in between,
> > so hcd->flags can be stale.
> >
> > If the HC dies due to whatever reason then without this patch we get
> > the below error on next hcd_add.
> >
> > [173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
> > [173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
> > [173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
> > [173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
> > [173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
> > [173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> > [173.297222] usb usb6: Product: xHCI Host Controller
> > [173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
> > [173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
> > [173.298680] hub 6-0:1.0: USB hub found
> > [173.298749] hub 6-0:1.0: 1 port detected
> > [173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
> > [173.395418] hub 5-0:1.0: activate --> -19
> > [173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
> > [173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
> > [173.603513] Hardware name: Google Kevin (DT)
> > [173.603531] Call trace:
> > [173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
> > [173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
> > [173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
> > [173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
> > [173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
> > [173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
> > [173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
> > [173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
> > [173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
> > [173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
> > [173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
> > ...
> > [173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
> > [173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
> > [173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
> > [173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
> > [173.604607] [<0000000000b16000>] 0xb16000
> > [173.604622] handlers:
> > [173.604648] [<ffffffc000642084>] usb_hcd_irq
> > [173.604673] Disabling IRQ #228
> >
> > Signed-off-by: William wu <wulf@rock-chips.com>
> > Signed-off-by: William wu <william.wu@rock-chips.com>
> > ---
> > drivers/usb/core/hcd.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> > index 479e223..612fab6 100644
> > --- a/drivers/usb/core/hcd.c
> > +++ b/drivers/usb/core/hcd.c
> > @@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
> > }
> >
> > usb_put_invalidate_rhdev(hcd);
> > + hcd->flags = 0;
> > }
> > EXPORT_SYMBOL_GPL(usb_remove_hcd);
> >
> >
> I suggest to initialize hcd->flags to 0 in usb_add_hcd() instead.
>
> cheers,
> -roger
Roger, didn't you originally propose this very same patch in
http://marc.info/?l=linux-usb&m=146556415503583&w=2
(and of course, the earlier versions before v10)? What happened to it?
Alan Stern
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
2017-01-12 15:33 ` Alan Stern
@ 2017-01-12 15:38 ` Roger Quadros
2017-01-13 2:37 ` wlf
0 siblings, 1 reply; 6+ messages in thread
From: Roger Quadros @ 2017-01-12 15:38 UTC (permalink / raw)
To: Alan Stern
Cc: William Wu, gregkh, heiko, linux-kernel, linux-usb,
linux-rockchip, frank.wang, huangtao, dianders, groeck,
William wu
On 12/01/17 17:33, Alan Stern wrote:
> On Thu, 12 Jan 2017, Roger Quadros wrote:
>
>> William,
>>
>> On 12/01/17 14:03, William Wu wrote:
>>> From: William wu <wulf@rock-chips.com>
>>>
>>> On some platforms(e.g. rk3399 board), we can call hcd_add/remove
>>> consecutively without calling usb_put_hcd/usb_create_hcd in between,
>>> so hcd->flags can be stale.
>>>
>>> If the HC dies due to whatever reason then without this patch we get
>>> the below error on next hcd_add.
>>>
>>> [173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
>>> [173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
>>> [173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
>>> [173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
>>> [173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
>>> [173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
>>> [173.297222] usb usb6: Product: xHCI Host Controller
>>> [173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
>>> [173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
>>> [173.298680] hub 6-0:1.0: USB hub found
>>> [173.298749] hub 6-0:1.0: 1 port detected
>>> [173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
>>> [173.395418] hub 5-0:1.0: activate --> -19
>>> [173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
>>> [173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
>>> [173.603513] Hardware name: Google Kevin (DT)
>>> [173.603531] Call trace:
>>> [173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
>>> [173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
>>> [173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
>>> [173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
>>> [173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
>>> [173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
>>> [173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
>>> [173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
>>> [173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
>>> [173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
>>> [173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
>>> ...
>>> [173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
>>> [173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
>>> [173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
>>> [173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
>>> [173.604607] [<0000000000b16000>] 0xb16000
>>> [173.604622] handlers:
>>> [173.604648] [<ffffffc000642084>] usb_hcd_irq
>>> [173.604673] Disabling IRQ #228
>>>
>>> Signed-off-by: William wu <wulf@rock-chips.com>
>>> Signed-off-by: William wu <william.wu@rock-chips.com>
>>> ---
>>> drivers/usb/core/hcd.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>>> index 479e223..612fab6 100644
>>> --- a/drivers/usb/core/hcd.c
>>> +++ b/drivers/usb/core/hcd.c
>>> @@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>>> }
>>>
>>> usb_put_invalidate_rhdev(hcd);
>>> + hcd->flags = 0;
>>> }
>>> EXPORT_SYMBOL_GPL(usb_remove_hcd);
>>>
>>>
>> I suggest to initialize hcd->flags to 0 in usb_add_hcd() instead.
>>
>> cheers,
>> -roger
>
> Roger, didn't you originally propose this very same patch in
>
> http://marc.info/?l=linux-usb&m=146556415503583&w=2
>
> (and of course, the earlier versions before v10)? What happened to it?
Alan, You are right. That patch got lost in the ML. Looks like I didn't push it hard enough
and then forgot about it. Sorry.
William,
You don't need to do any changes. My earlier version was clearing the flag
in usb_add_hcd() and I guess Alan suggested to move it to usb_remove_hcd().
So your patch is good.
You can add my.
Acked-by: Roger Quadros <rogerq@ti.com>
cheers,
-roger
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
2017-01-12 15:38 ` Roger Quadros
@ 2017-01-13 2:37 ` wlf
0 siblings, 0 replies; 6+ messages in thread
From: wlf @ 2017-01-13 2:37 UTC (permalink / raw)
To: Roger Quadros, Alan Stern
Cc: William Wu, gregkh, heiko, linux-kernel, linux-usb,
linux-rockchip, frank.wang, huangtao, dianders, groeck
Hi Roger,
在 2017年01月12日 23:38, Roger Quadros 写道:
> On 12/01/17 17:33, Alan Stern wrote:
>> On Thu, 12 Jan 2017, Roger Quadros wrote:
>>
>>> William,
>>>
>>> On 12/01/17 14:03, William Wu wrote:
>>>> From: William wu <wulf@rock-chips.com>
>>>>
>>>> On some platforms(e.g. rk3399 board), we can call hcd_add/remove
>>>> consecutively without calling usb_put_hcd/usb_create_hcd in between,
>>>> so hcd->flags can be stale.
>>>>
>>>> If the HC dies due to whatever reason then without this patch we get
>>>> the below error on next hcd_add.
>>>>
>>>> [173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
>>>> [173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
>>>> [173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
>>>> [173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
>>>> [173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
>>>> [173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
>>>> [173.297222] usb usb6: Product: xHCI Host Controller
>>>> [173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
>>>> [173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
>>>> [173.298680] hub 6-0:1.0: USB hub found
>>>> [173.298749] hub 6-0:1.0: 1 port detected
>>>> [173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
>>>> [173.395418] hub 5-0:1.0: activate --> -19
>>>> [173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
>>>> [173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
>>>> [173.603513] Hardware name: Google Kevin (DT)
>>>> [173.603531] Call trace:
>>>> [173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
>>>> [173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
>>>> [173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
>>>> [173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
>>>> [173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
>>>> [173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
>>>> [173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
>>>> [173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
>>>> [173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
>>>> [173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
>>>> [173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
>>>> ...
>>>> [173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
>>>> [173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
>>>> [173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
>>>> [173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
>>>> [173.604607] [<0000000000b16000>] 0xb16000
>>>> [173.604622] handlers:
>>>> [173.604648] [<ffffffc000642084>] usb_hcd_irq
>>>> [173.604673] Disabling IRQ #228
>>>>
>>>> Signed-off-by: William wu <wulf@rock-chips.com>
>>>> Signed-off-by: William wu <william.wu@rock-chips.com>
>>>> ---
>>>> drivers/usb/core/hcd.c | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>>>> index 479e223..612fab6 100644
>>>> --- a/drivers/usb/core/hcd.c
>>>> +++ b/drivers/usb/core/hcd.c
>>>> @@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>>>> }
>>>>
>>>> usb_put_invalidate_rhdev(hcd);
>>>> + hcd->flags = 0;
>>>> }
>>>> EXPORT_SYMBOL_GPL(usb_remove_hcd);
>>>>
>>>>
>>> I suggest to initialize hcd->flags to 0 in usb_add_hcd() instead.
>>>
>>> cheers,
>>> -roger
>> Roger, didn't you originally propose this very same patch in
>>
>> http://marc.info/?l=linux-usb&m=146556415503583&w=2
>>
>> (and of course, the earlier versions before v10)? What happened to it?
> Alan, You are right. That patch got lost in the ML. Looks like I didn't push it hard enough
> and then forgot about it. Sorry.
>
> William,
>
> You don't need to do any changes. My earlier version was clearing the flag
> in usb_add_hcd() and I guess Alan suggested to move it to usb_remove_hcd().
>
> So your patch is good.
> You can add my.
>
> Acked-by: Roger Quadros <rogerq@ti.com>
>
> cheers,
> -roger
Thanks very much for your suggestion,I will add acked-by immediately.
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RESEND PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd
2017-01-12 12:03 [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd William Wu
2017-01-12 12:26 ` Roger Quadros
@ 2017-01-13 3:04 ` William Wu
1 sibling, 0 replies; 6+ messages in thread
From: William Wu @ 2017-01-13 3:04 UTC (permalink / raw)
To: gregkh
Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
huangtao, dianders, groeck, william.wu, rogerq, stern,
William wu
From: William wu <wulf@rock-chips.com>
On some platforms(e.g. rk3399 board), we can call hcd_add/remove
consecutively without calling usb_put_hcd/usb_create_hcd in between,
so hcd->flags can be stale.
If the HC dies due to whatever reason then without this patch we get
the below error on next hcd_add.
[173.296154] xhci-hcd xhci-hcd.2.auto: HC died; cleaning up
[173.296209] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller
[173.296762] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 6
[173.296931] usb usb6: We don't know the algorithms for LPM for this host, disabling LPM.
[173.297179] usb usb6: New USB device found, idVendor=1d6b, idProduct=0003
[173.297203] usb usb6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[173.297222] usb usb6: Product: xHCI Host Controller
[173.297240] usb usb6: Manufacturer: Linux 4.4.21 xhci-hcd
[173.297257] usb usb6: SerialNumber: xhci-hcd.2.auto
[173.298680] hub 6-0:1.0: USB hub found
[173.298749] hub 6-0:1.0: 1 port detected
[173.299382] rockchip-dwc3 usb@fe800000: USB HOST connected
[173.395418] hub 5-0:1.0: activate --> -19
[173.603447] irq 228: nobody cared (try booting with the "irqpoll" option)
[173.603493] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.21 #9
[173.603513] Hardware name: Google Kevin (DT)
[173.603531] Call trace:
[173.603568] [<ffffffc0002087dc>] dump_backtrace+0x0/0x160
[173.603596] [<ffffffc00020895c>] show_stack+0x20/0x28
[173.603623] [<ffffffc0004b28a8>] dump_stack+0x90/0xb0
[173.603650] [<ffffffc00027347c>] __report_bad_irq+0x48/0xe8
[173.603674] [<ffffffc0002737cc>] note_interrupt+0x1e8/0x28c
[173.603698] [<ffffffc000270a38>] handle_irq_event_percpu+0x1d4/0x25c
[173.603722] [<ffffffc000270b0c>] handle_irq_event+0x4c/0x7c
[173.603748] [<ffffffc00027456c>] handle_fasteoi_irq+0xb4/0x124
[173.603777] [<ffffffc00026fe3c>] generic_handle_irq+0x30/0x44
[173.603804] [<ffffffc0002701a8>] __handle_domain_irq+0x90/0xbc
[173.603827] [<ffffffc0002006f4>] gic_handle_irq+0xcc/0x188
...
[173.604500] [<ffffffc000203700>] el1_irq+0x80/0xf8
[173.604530] [<ffffffc000261388>] cpu_startup_entry+0x38/0x3cc
[173.604558] [<ffffffc00090f7d8>] rest_init+0x8c/0x94
[173.604585] [<ffffffc000e009ac>] start_kernel+0x3d0/0x3fc
[173.604607] [<0000000000b16000>] 0xb16000
[173.604622] handlers:
[173.604648] [<ffffffc000642084>] usb_hcd_irq
[173.604673] Disabling IRQ #228
Signed-off-by: William wu <wulf@rock-chips.com>
Acked-by: Roger Quadros <rogerq@ti.com>
---
drivers/usb/core/hcd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 479e223..612fab6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -3017,6 +3017,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
}
usb_put_invalidate_rhdev(hcd);
+ hcd->flags = 0;
}
EXPORT_SYMBOL_GPL(usb_remove_hcd);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-01-13 3:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 12:03 [PATCH] usb: hcd: initialize hcd->flags to 0 when rm hcd William Wu
2017-01-12 12:26 ` Roger Quadros
2017-01-12 15:33 ` Alan Stern
2017-01-12 15:38 ` Roger Quadros
2017-01-13 2:37 ` wlf
2017-01-13 3:04 ` [RESEND PATCH] " William Wu
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).