Re: usb: musb: error when trying to unbind musb-hdrc.0.auto

2018-03-07 Thread Merlijn Wajer
Hi,

I suspected that the issue was similar to the one fixed in this commit:
0c3aae9bd59978fb8c3557d7883380bef0f2cfa1 (USB: musb: fix late external
abort on suspend)

I've applied a similar fix to the musb_remove function (as well as
moving musb_platform_exit just before spin_unlock_irqrestore), and now I
can unbind successfully. I will try to send a patch for review soon.

Cheers,
Merlijn

On 07/03/18 23:41, Merlijn Wajer wrote:
> Hi,
> 
> I am trying to unbind the musb driver on my Nokia N900, but I get the
> following kernel oops [1].
> 
> This is the command that I issued:
> 
> root@n900devuan:/sys/bus/platform/drivers/musb-hdrc# echo
> musb-hdrc.0.auto > unbind
> 
> This might be omap specific. I thought that as with the vbus issue,
> calls to pm_runtime_{get,put}_sync were required, but it seems that
> pm_runtime_disable gets called before musb_platform_exit is called.
> 
> I've tried simply moving the call so that it is called before
> pm_runtime_disable (actually just before spin_unlock_irqrestore in
> musb_remove) but this doesn't seem to help.
> 
> Any thoughts?
> 
> Cheers,
> Merlijn
> 
> [1]
> 
> [ 7232.484985] Unhandled fault: external abort on non-linefetch (0x1028)
> at 0xfa0ab414
> [ 7232.485015] pgd = 9b0f7685
> [ 7232.485046] [fa0ab414] *pgd=48011452(bad)
> [ 7232.485076] Internal error: : 1028 [#1] PREEMPT ARM
> [ 7232.485076] Modules linked in: u_ether u_serial bluetooth
> ecdh_generic ipv6 omaplfb ctr
>  aes_arm_bs crypto_simd cryptd ccm pvrsrvkm cmt_speech nokia_modem
> ssi_protocol radio_plat
> form_si4713 mousedev arc4 joydev hsi_char wl1251_spi crc7 wl1251
> ir_lirc_codec mac80211 li
> rc_dev ir_rx51 rc_core smc91x gpio_keys rx51_battery pwm_omap_dmtimer
> isp1704_charger mii
> sha256_generic omap3_isp videobuf2_dma_contig v4l2_fwnode cfg80211
> videobuf2_memops si4713
>  videobuf2_v4l2 adp1653 videobuf2_core v4l2_common tsc2005 tsc200x_core
> videodev bq27xxx_b
> attery_i2c bq27xxx_battery bq2415x_charger leds_lp5523
> leds_lp55xx_common media tsl2563 rt
> c_twl twl4030_vibra ff_memless omap_ssi lis3lv02d_i2c lis3lv02d hsi
> input_polldev ti_soc_t
> hermal vfat fat [last unloaded: libcomposite]
> [ 7232.485412] CPU: 0 PID: 2803 Comm: bash Not tainted 4.15.6+ #1
> [ 7232.485412] Hardware name: Nokia RX-51 board
> [ 7232.485473] PC is at musb_default_readl+0x4/0xc
> [ 7232.485473] LR is at omap2430_musb_exit+0x2c/0x70
> [ 7232.485504] pc : []lr : []psr: a0020013
> [ 7232.485504] sp : cb2afe70  ip :   fp : 
> [ 7232.485534] r10:   r9 : 0051  r8 : 200f0013
> [ 7232.485534] r7 : c2a65920  r6 : ce354d10  r5 :   r4 : ce52e010
> [ 7232.485565] r3 : c05220f4  r2 :   r1 : fa0ab414  r0 : fa0ab000
> [ 7232.485595] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment none
> [ 7232.485595] Control: 10c5387d  Table: 8bfa4019  DAC: 0051
> [ 7232.485626] Process bash (pid: 2803, stack limit = 0x5105ec71)
> [ 7232.485626] Stack: (0xcb2afe70 to 0xcb2b)
> [ 7232.485656] fe60: ce52e010
> e000 ce388a10 c0521c
> dc
> [ 7232.485687] fe80: ce388a10 ce388a10 c0a325e8 ce388a44 0034
> c04c34d8 ce388a10 00
> 00
> [ 7232.485717] fea0: c0a325e8 c04c2170 0011 ce388a10 c0a325e8
> c0a2fef8 c9cde410 c04c0a
> 8c
> [ 7232.485717] fec0: 0011 cd8f7e00 c9cde400 cb2aff88 c9cde410
> c0259554  00
> 00
> [ 7232.485748] fee0: 0011 cb6b1600 c0259424  cb2aff88
> 000e4408 cb2ae000 c01eda
> 74
> [ 7232.485778] ff00: 0100  cb3b0180 c020a948 cb3b0cc0
> 000a cb3b0cc0 00
> 01
> [ 7232.485809] ff20: cb3b0cc0 000a 0001 c020aefc 0001
>  cb3b0cc0 c01fd4
> f4
> [ 7232.485839] ff40: cb6b1600 0002 cb6b1600 0011 
> cb2aff88 000e4408 c01edd30
> [ 7232.485870] ff60: cb6b1600 000e4408 0011 cb6b1600 cb6b1600
> 000e4408 0011 c0106fc4
> [ 7232.485900] ff80: cb2ae000 c01edee8   0011
> 0011 000e4408 b6eb3d60
> [ 7232.485900] ffa0: 0004 c0106de0 0011 000e4408 0001
> 000e4408 0011 
> [ 7232.485931] ffc0: 0011 000e4408 b6eb3d60 0004 000e4408
> 0011  
> [ 7232.485961] ffe0:  bedd1eec b6e161bb b6e52b46 0030
> 0001  
> [ 7232.485992] [] (musb_default_readl) from []
> (omap2430_musb_exit+0x2c/0x70)
> [ 7232.486022] [] (omap2430_musb_exit) from []
> (musb_remove+0x110/0x158)
> [ 7232.486053] [] (musb_remove) from []
> (platform_drv_remove+0x24/0x3c)
> [ 7232.486114] [] (platform_drv_remove) from []
> (device_release_driver_internal+0xd4/0x1dc)
> [ 7232.486145] [] (device_release_driver_internal) from
> [] (unbind_store+0x58/0x8c)
> [ 7232.486175] [] (unbind_store) from []
> (kernfs_fop_write+0x130/0x1a0)
> [ 7232.486206] [] (kernfs_fop_write) from []
> (__vfs_write+0x1c/0x11c)
> [ 7232.486236] [] (__vfs_write) from []
> (vfs_write+0xb8/0x18c)
> [ 7232.486267] [] (vfs_write) from []
> (SyS_write+0x3c/0x74)
> [ 7232.486297] [] (SyS_write) 

Re: usb: musb: error when trying to unbind musb-hdrc.0.auto

2018-03-07 Thread Merlijn Wajer
Hi,

I suspected that the issue was similar to the one fixed in this commit:
0c3aae9bd59978fb8c3557d7883380bef0f2cfa1 (USB: musb: fix late external
abort on suspend)

I've applied a similar fix to the musb_remove function (as well as
moving musb_platform_exit just before spin_unlock_irqrestore), and now I
can unbind successfully. I will try to send a patch for review soon.

Cheers,
Merlijn

On 07/03/18 23:41, Merlijn Wajer wrote:
> Hi,
> 
> I am trying to unbind the musb driver on my Nokia N900, but I get the
> following kernel oops [1].
> 
> This is the command that I issued:
> 
> root@n900devuan:/sys/bus/platform/drivers/musb-hdrc# echo
> musb-hdrc.0.auto > unbind
> 
> This might be omap specific. I thought that as with the vbus issue,
> calls to pm_runtime_{get,put}_sync were required, but it seems that
> pm_runtime_disable gets called before musb_platform_exit is called.
> 
> I've tried simply moving the call so that it is called before
> pm_runtime_disable (actually just before spin_unlock_irqrestore in
> musb_remove) but this doesn't seem to help.
> 
> Any thoughts?
> 
> Cheers,
> Merlijn
> 
> [1]
> 
> [ 7232.484985] Unhandled fault: external abort on non-linefetch (0x1028)
> at 0xfa0ab414
> [ 7232.485015] pgd = 9b0f7685
> [ 7232.485046] [fa0ab414] *pgd=48011452(bad)
> [ 7232.485076] Internal error: : 1028 [#1] PREEMPT ARM
> [ 7232.485076] Modules linked in: u_ether u_serial bluetooth
> ecdh_generic ipv6 omaplfb ctr
>  aes_arm_bs crypto_simd cryptd ccm pvrsrvkm cmt_speech nokia_modem
> ssi_protocol radio_plat
> form_si4713 mousedev arc4 joydev hsi_char wl1251_spi crc7 wl1251
> ir_lirc_codec mac80211 li
> rc_dev ir_rx51 rc_core smc91x gpio_keys rx51_battery pwm_omap_dmtimer
> isp1704_charger mii
> sha256_generic omap3_isp videobuf2_dma_contig v4l2_fwnode cfg80211
> videobuf2_memops si4713
>  videobuf2_v4l2 adp1653 videobuf2_core v4l2_common tsc2005 tsc200x_core
> videodev bq27xxx_b
> attery_i2c bq27xxx_battery bq2415x_charger leds_lp5523
> leds_lp55xx_common media tsl2563 rt
> c_twl twl4030_vibra ff_memless omap_ssi lis3lv02d_i2c lis3lv02d hsi
> input_polldev ti_soc_t
> hermal vfat fat [last unloaded: libcomposite]
> [ 7232.485412] CPU: 0 PID: 2803 Comm: bash Not tainted 4.15.6+ #1
> [ 7232.485412] Hardware name: Nokia RX-51 board
> [ 7232.485473] PC is at musb_default_readl+0x4/0xc
> [ 7232.485473] LR is at omap2430_musb_exit+0x2c/0x70
> [ 7232.485504] pc : []lr : []psr: a0020013
> [ 7232.485504] sp : cb2afe70  ip :   fp : 
> [ 7232.485534] r10:   r9 : 0051  r8 : 200f0013
> [ 7232.485534] r7 : c2a65920  r6 : ce354d10  r5 :   r4 : ce52e010
> [ 7232.485565] r3 : c05220f4  r2 :   r1 : fa0ab414  r0 : fa0ab000
> [ 7232.485595] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment none
> [ 7232.485595] Control: 10c5387d  Table: 8bfa4019  DAC: 0051
> [ 7232.485626] Process bash (pid: 2803, stack limit = 0x5105ec71)
> [ 7232.485626] Stack: (0xcb2afe70 to 0xcb2b)
> [ 7232.485656] fe60: ce52e010
> e000 ce388a10 c0521c
> dc
> [ 7232.485687] fe80: ce388a10 ce388a10 c0a325e8 ce388a44 0034
> c04c34d8 ce388a10 00
> 00
> [ 7232.485717] fea0: c0a325e8 c04c2170 0011 ce388a10 c0a325e8
> c0a2fef8 c9cde410 c04c0a
> 8c
> [ 7232.485717] fec0: 0011 cd8f7e00 c9cde400 cb2aff88 c9cde410
> c0259554  00
> 00
> [ 7232.485748] fee0: 0011 cb6b1600 c0259424  cb2aff88
> 000e4408 cb2ae000 c01eda
> 74
> [ 7232.485778] ff00: 0100  cb3b0180 c020a948 cb3b0cc0
> 000a cb3b0cc0 00
> 01
> [ 7232.485809] ff20: cb3b0cc0 000a 0001 c020aefc 0001
>  cb3b0cc0 c01fd4
> f4
> [ 7232.485839] ff40: cb6b1600 0002 cb6b1600 0011 
> cb2aff88 000e4408 c01edd30
> [ 7232.485870] ff60: cb6b1600 000e4408 0011 cb6b1600 cb6b1600
> 000e4408 0011 c0106fc4
> [ 7232.485900] ff80: cb2ae000 c01edee8   0011
> 0011 000e4408 b6eb3d60
> [ 7232.485900] ffa0: 0004 c0106de0 0011 000e4408 0001
> 000e4408 0011 
> [ 7232.485931] ffc0: 0011 000e4408 b6eb3d60 0004 000e4408
> 0011  
> [ 7232.485961] ffe0:  bedd1eec b6e161bb b6e52b46 0030
> 0001  
> [ 7232.485992] [] (musb_default_readl) from []
> (omap2430_musb_exit+0x2c/0x70)
> [ 7232.486022] [] (omap2430_musb_exit) from []
> (musb_remove+0x110/0x158)
> [ 7232.486053] [] (musb_remove) from []
> (platform_drv_remove+0x24/0x3c)
> [ 7232.486114] [] (platform_drv_remove) from []
> (device_release_driver_internal+0xd4/0x1dc)
> [ 7232.486145] [] (device_release_driver_internal) from
> [] (unbind_store+0x58/0x8c)
> [ 7232.486175] [] (unbind_store) from []
> (kernfs_fop_write+0x130/0x1a0)
> [ 7232.486206] [] (kernfs_fop_write) from []
> (__vfs_write+0x1c/0x11c)
> [ 7232.486236] [] (__vfs_write) from []
> (vfs_write+0xb8/0x18c)
> [ 7232.486267] [] (vfs_write) from []
> (SyS_write+0x3c/0x74)
> [ 7232.486297] [] (SyS_write)