Message ID | 1346940106-20269-1-git-send-email-panto@antoniou-consulting.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Sep 06, 2012 at 05:01:46PM +0300, Pantelis Antoniou wrote: > Marking functions as __init or __devinit and calling them at other times > leads to predictable crashes (if you're lucky). > > Remove them for now. > > Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> > --- > drivers/usb/musb/musb_core.c | 16 ++++++++-------- > drivers/usb/musb/musb_debugfs.c | 2 +- > drivers/usb/musb/musb_dma.h | 2 +- > drivers/usb/musb/musb_gadget.c | 6 +++--- > drivers/usb/musb/musbhsdma.c | 2 +- > drivers/usb/musb/omap2430.c | 2 +- > 6 files changed, 15 insertions(+), 15 deletions(-) > > diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c > index 26f1bef..215d2d5 100644 > --- a/drivers/usb/musb/musb_core.c > +++ b/drivers/usb/musb/musb_core.c > @@ -1160,7 +1160,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { > * > * returns negative errno or offset for next fifo. > */ > -static int __devinit > +static int > fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, > const struct musb_fifo_cfg *cfg, u16 offset) Are you sure all these functions are called from outside .init.text ? At least fifo_setup(), ep_config_from_table() and musb_core_init() are only during probe(), which sits in .init.text too.
Hi Felipe, A proper answer required some instrumentation printks(). So what I did is that I peppered each function marked with a removed __init or __devinit with a > printk(KERN_INFO "%s:%d (%s) %s\n", __FILE__, __LINE__, KBUILD_MODNAME, __func__); > Both omap2430 & musb_hdrc are compiled as module, and I issued the following commands on a beagleboard xm. # modprobe omap2430 # modprobe g_mass_storage file=backing_file # rmmod g_mass_storage # rmmod omap2430 # modprobe omap2430 The problem is obvious when you see that functions marked as init or devinit are called when re-loading the omap2430 module again. Those functions if marked as much can (and will as I have witnessed) be removed from memory, leading to a crash. What do you think? Regards -- Pantelis On Sep 6, 2012, at 4:04 PM, Felipe Balbi wrote: > On Thu, Sep 06, 2012 at 05:01:46PM +0300, Pantelis Antoniou wrote: >> Marking functions as __init or __devinit and calling them at other times >> leads to predictable crashes (if you're lucky). >> >> Remove them for now. >> >> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> >> --- >> drivers/usb/musb/musb_core.c | 16 ++++++++-------- >> drivers/usb/musb/musb_debugfs.c | 2 +- >> drivers/usb/musb/musb_dma.h | 2 +- >> drivers/usb/musb/musb_gadget.c | 6 +++--- >> drivers/usb/musb/musbhsdma.c | 2 +- >> drivers/usb/musb/omap2430.c | 2 +- >> 6 files changed, 15 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c >> index 26f1bef..215d2d5 100644 >> --- a/drivers/usb/musb/musb_core.c >> +++ b/drivers/usb/musb/musb_core.c >> @@ -1160,7 +1160,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { >> * >> * returns negative errno or offset for next fifo. >> */ >> -static int __devinit >> +static int >> fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, >> const struct musb_fifo_cfg *cfg, u16 offset) > > Are you sure all these functions are called from outside .init.text ? At > least fifo_setup(), ep_config_from_table() and musb_core_init() are only > during probe(), which sits in .init.text too. > > -- > balbi Log... > root@beagleboard:~# modprobe omap2430 > [ 114.643920] drivers/usb/musb/omap2430.c:584 (omap2430) omap2430_init > [ 114.650939] drivers/usb/musb/omap2430.c:445 (omap2430) omap2430_probe > [ 114.792205] drivers/usb/musb/musb_core.c:2409 (musb_hdrc) musb_init > [ 114.798889] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host) > [ 114.805358] drivers/usb/musb/musb_core.c:2118 (musb_hdrc) musb_probe > [ 114.812225] drivers/usb/musb/musb_core.c:1888 (musb_hdrc) musb_init_controller > [ 114.819824] drivers/usb/musb/musb_core.c:1813 (musb_hdrc) allocate_instance > [ 114.835723] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 114.841339] drivers/usb/musb/musbhsdma.c:391 (musb_hdrc) dma_controller_create > [ 114.848999] drivers/usb/musb/musb_core.c:1388 (musb_hdrc) musb_core_init > [ 114.856079] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) > [ 114.867095] musb-hdrc: MHDRC RTL version 1.800 > [ 114.871887] drivers/usb/musb/musb_core.c:1246 (musb_hdrc) ep_config_from_table > [ 114.879486] musb-hdrc: setup fifo_mode 4 > [ 114.883666] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.890319] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.897033] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.903686] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.910369] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.917083] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.923767] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.930480] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.937133] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.943817] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.950500] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.957183] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.963867] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.970550] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.977264] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.983947] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.990631] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 114.997314] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.003997] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.010711] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.017395] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.024078] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.030761] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.037475] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.044158] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.050842] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.057556] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.064239] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 115.070922] musb-hdrc: 28/31 max ep, 16384/16384 memory > [ 115.076599] drivers/usb/musb/musb_gadget.c:1879 (musb_hdrc) musb_gadget_setup > [ 115.084136] drivers/usb/musb/musb_gadget.c:1842 (musb_hdrc) musb_g_init_endpoints > [ 115.092010] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.099609] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.107238] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.114837] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.122406] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.130035] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.137634] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.145233] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.152832] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.160461] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.168060] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.175689] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.183288] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.190948] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.198516] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.206146] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.213775] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.221374] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.229003] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.236633] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.244232] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.251861] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.259460] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.267089] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.274688] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.282287] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.289916] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.297546] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 115.307617] musb-hdrc musb-hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ 92 > [ 115.324279] twl4030_usb twl4030_usb: twl4030_phy_suspend > > root@beagleboard:~# lsmod > Module Size Used by > musb_hdrc 53393 0 > omap2430 5518 0 > root@beagleboard:~# modprobe g_mass_storage file=backing_file > [ 138.156799] udc musb-hdrc: registering UDC driver [g_mass_storage] > [ 138.163330] gadget: adding config #1 'Linux File-Backed Storage'/bf0217e8 > [ 138.171966] lun0: open backing file: backing_file > [ 138.182464] gadget: Mass Storage Function, version: 2009/09/11 > [ 138.188812] gadget: Number of LUNs=1 > [ 138.192901] lun0: LUN: file: /home/root/backing_file > [ 138.198272] gadget: I/O thread pid: 1976 > [ 138.202484] gadget: adding 'Mass Storage Function'/ddda81c0 to config 'Linux File-Backed Storage'/bf0217e8 > [ 138.212799] gadget: cfg 1/bf0217e8 speeds: high full > [ 138.218109] gadget: interface 0 = Mass Storage Function/ddda81c0 > [ 138.224731] gadget: Mass Storage Gadget, version: 2009/09/11 > [ 138.230804] gadget: userspace failed to provide iSerialNumber > [ 138.236968] gadget: g_mass_storage ready[ 138.252227] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 138.252441] musb-hdrc musb-hdrc: MUSB HDRC host driver > [ 138.254364] musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 2 > [ 138.254821] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002 > [ 138.254852] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 > [ 138.254852] usb usb2: Product: MUSB HDRC host driver > [ 138.254852] usb usb2: Manufacturer: Linux 3.6.0-rc4-01179-g83ccc22-dirty musb-hcd > [ 138.254882] usb usb2: SerialNumber: musb-hdrc > [ 138.257629] hub 2-0:1.0: USB hub found > [ 138.257843] hub 2-0:1.0: 1 port detected > [ 138.347778] twl4030_usb twl4030_usb: HW_CONDITIONS 0xc0/192; link 3 > [ 138.670959] twl4030_usb twl4030_usb: HW_CONDITIONS 0x40/64; link 4 > [ 138.680175] twl4030_usb twl4030_usb: twl4030_phy_suspend > > root@beagleboard:~# rmmod g_mass_storage > [ 144.341522] g_mass_storage musb-hdrc: unregistering UDC driver [musb-hdrc] > [ 144.360473] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 144.366333] gadget: unbind function 'Mass Storage Function'/ddda81c0 > [ 144.373199] gadget: unbind > [ 144.381652] twl4030_usb twl4030_usb: twl4030_phy_suspend > [ 144.389312] lun0: close backing file > [ 144.400421] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 144.406036] musb-hdrc musb-hdrc: remove, state 4 > [ 144.411590] usb usb2: USB disconnect, device number 1 > [ 144.429382] musb-hdrc musb-hdrc: USB bus 2 deregistered > [ 144.464599] twl4030_usb twl4030_usb: twl4030_phy_suspend > root@beagleboard:~# rmmod omap2430 > [ 148.530517] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 148.540649] twl4030_usb twl4030_usb: twl4030_phy_suspend > [ 148.552124] udc musb-hdrc: releasing 'musb-hdrc' > root@beagleboard:~# modprobe omap2430 > [ 154.626739] drivers/usb/musb/omap2430.c:584 (omap2430) omap2430_init > [ 154.633728] drivers/usb/musb/omap2430.c:445 (omap2430) omap2430_probe > [ 154.640533] musb-omap2430 musb-omap2430: Unbalanced pm_runtime_enable! > [ 154.647918] drivers/usb/musb/musb_core.c:2118 (musb_hdrc) musb_probe > [ 154.654663] drivers/usb/musb/musb_core.c:1888 (musb_hdrc) musb_init_controller > [ 154.662292] drivers/usb/musb/musb_core.c:1813 (musb_hdrc) allocate_instance > [ 154.698333] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 154.704010] drivers/usb/musb/musbhsdma.c:391 (musb_hdrc) dma_controller_create > [ 154.711761] drivers/usb/musb/musb_core.c:1388 (musb_hdrc) musb_core_init > [ 154.718811] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) > [ 154.729888] musb-hdrc: MHDRC RTL version 1.800 > [ 154.734680] drivers/usb/musb/musb_core.c:1246 (musb_hdrc) ep_config_from_table > [ 154.742279] musb-hdrc: setup fifo_mode 4 > [ 154.746398] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.753082] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.759765] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.766479] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.773162] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.779846] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.786529] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.793212] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.799926] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.806640] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.813323] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.819976] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.826660] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.833343] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.840026] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.846710] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.853393] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.860107] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.866760] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.873443] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.880126] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.886840] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.893524] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.900207] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.906860] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.913513] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.920196] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.926879] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 154.933593] musb-hdrc: 28/31 max ep, 16384/16384 memory > [ 154.939331] drivers/usb/musb/musb_gadget.c:1879 (musb_hdrc) musb_gadget_setup > [ 154.946838] drivers/usb/musb/musb_gadget.c:1842 (musb_hdrc) musb_g_init_endpoints > [ 154.954742] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 154.962341] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 154.969909] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 154.977539] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 154.985137] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 154.992736] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.000305] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.007904] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.015472] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.023071] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.030700] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.038269] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.045898] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.053497] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.061096] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.068695] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.076293] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.083923] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.091522] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.099090] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.106689] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.114318] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.121917] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.129486] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.137084] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.144683] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.152282] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.159881] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 155.169403] musb-hdrc musb-hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ 92 > [ 155.198974] twl4030_usb twl4030_usb: twl4030_phy_suspend > -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, On Thu, Sep 06, 2012 at 05:58:27PM +0300, Pantelis Antoniou wrote: > Hi Felipe, > > A proper answer required some instrumentation printks(). > > So what I did is that I peppered each function marked with a removed > __init or __devinit with a > > > printk(KERN_INFO "%s:%d (%s) %s\n", __FILE__, __LINE__, KBUILD_MODNAME, __func__); > > > > Both omap2430 & musb_hdrc are compiled as module, and I issued the following > commands on a beagleboard xm. > > # modprobe omap2430 > # modprobe g_mass_storage file=backing_file > # rmmod g_mass_storage > # rmmod omap2430 > # modprobe omap2430 > > The problem is obvious when you see that functions marked as init or devinit are > called when re-loading the omap2430 module again. Those functions if marked as > much can (and will as I have witnessed) be removed from memory, leading to a > crash. > > What do you think? the problem would be with usage of __init. __devinit will only drop .devinit.text if HOTPLUG and MODULE isn't set, AFAICT. I also can't see a crash on below logs.
Hi Felipe I see about __devinit. There's no crash because in those logs the __init modifiers are gone. Regards -- Pantelis On Sep 6, 2012, at 8:07 PM, Felipe Balbi wrote: > Hi, > > On Thu, Sep 06, 2012 at 05:58:27PM +0300, Pantelis Antoniou wrote: >> Hi Felipe, >> >> A proper answer required some instrumentation printks(). >> >> So what I did is that I peppered each function marked with a removed >> __init or __devinit with a >> >>> printk(KERN_INFO "%s:%d (%s) %s\n", __FILE__, __LINE__, KBUILD_MODNAME, __func__); >>> >> >> Both omap2430 & musb_hdrc are compiled as module, and I issued the following >> commands on a beagleboard xm. >> >> # modprobe omap2430 >> # modprobe g_mass_storage file=backing_file >> # rmmod g_mass_storage >> # rmmod omap2430 >> # modprobe omap2430 >> >> The problem is obvious when you see that functions marked as init or devinit are >> called when re-loading the omap2430 module again. Those functions if marked as >> much can (and will as I have witnessed) be removed from memory, leading to a >> crash. >> >> What do you think? > > the problem would be with usage of __init. __devinit will only drop > .devinit.text if HOTPLUG and MODULE isn't set, AFAICT. I also can't see > a crash on below logs. > > -- > balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: > Hi Felipe > > I see about __devinit. > There's no crash because in those logs the __init modifiers are gone. it'd be cool to see the crash, though ;-)
Hi, On Thu, Sep 06, 2012 at 08:42:56PM +0300, Pantelis Antoniou wrote: > > On Sep 6, 2012, at 8:37 PM, Felipe Balbi wrote: > > > Hi, > > > > On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: > >> Hi Felipe > >> > >> I see about __devinit. > >> There's no crash because in those logs the __init modifiers are gone. > > > > it'd be cool to see the crash, though ;-) > > > > -- > > balbi > > Heh, OK, > > My word is not enough? :) > > Gimme a few minutes... Didn't say that, but I don't know what issue you're talking about since __devinit is supposed to keep .devinit.text intact unless !HOTPLUG. This could be a bug on some linker script (though unlikely) just trying to get understand the issue before I apply the patch, that's all.
On Sep 6, 2012, at 8:37 PM, Felipe Balbi wrote: > Hi, > > On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: >> Hi Felipe >> >> I see about __devinit. >> There's no crash because in those logs the __init modifiers are gone. > > it'd be cool to see the crash, though ;-) > > -- > balbi Heh, OK, My word is not enough? :) Gimme a few minutes... -- Pantelis -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Felipe, On Sep 6, 2012, at 8:41 PM, Felipe Balbi wrote: > Hi, > > On Thu, Sep 06, 2012 at 08:42:56PM +0300, Pantelis Antoniou wrote: >> >> On Sep 6, 2012, at 8:37 PM, Felipe Balbi wrote: >> >>> Hi, >>> >>> On Thu, Sep 06, 2012 at 08:36:39PM +0300, Pantelis Antoniou wrote: >>>> Hi Felipe >>>> >>>> I see about __devinit. >>>> There's no crash because in those logs the __init modifiers are gone. >>> >>> it'd be cool to see the crash, though ;-) >>> >>> -- >>> balbi >> >> Heh, OK, >> >> My word is not enough? :) >> >> Gimme a few minutes... > > Didn't say that, but I don't know what issue you're talking about since > __devinit is supposed to keep .devinit.text intact unless !HOTPLUG. > > This could be a bug on some linker script (though unlikely) just trying > to get understand the issue before I apply the patch, that's all. > > -- > balbi With my init removal patch reverted, but with the instrumentation printk still in Board hanged this time. It is not certain you will crash, you might get a hang or anything else. It all depends on what kind of garbage is there in memory when you start calling into the void. The results are boundedly undefined :) Regards -- Pantelis > root@beagleboard:~# modprobe omap2430 > [ 119.741851] drivers/usb/musb/omap2430.c:584 (omap2430) omap2430_init > [ 119.748870] drivers/usb/musb/omap2430.c:445 (omap2430) omap2430_probe > root@beagleboard:~# [ 119.797760] drivers/usb/musb/musb_core.c:2409 (musb_hdrc) musb_init > [ 119.804504] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host) > [ 119.811004] drivers/usb/musb/musb_core.c:2118 (musb_hdrc) musb_probe > [ 119.817962] drivers/usb/musb/musb_core.c:1888 (musb_hdrc) musb_init_controller > [ 119.825622] drivers/usb/musb/musb_core.c:1813 (musb_hdrc) allocate_instance > [ 119.841735] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 119.847290] drivers/usb/musb/musbhsdma.c:391 (musb_hdrc) dma_controller_create > [ 119.855041] drivers/usb/musb/musb_core.c:1388 (musb_hdrc) musb_core_init > [ 119.862121] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn) > [ 119.873229] musb-hdrc: MHDRC RTL version 1.800 > [ 119.877990] drivers/usb/musb/musb_core.c:1246 (musb_hdrc) ep_config_from_table > [ 119.885620] musb-hdrc: setup fifo_mode 4 > [ 119.889801] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.896514] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.903228] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.909912] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.916625] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.923339] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.930084] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.936798] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.943542] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.950256] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.956939] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.963653] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.970367] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.977081] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.983825] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.990539] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 119.997253] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.003936] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.010650] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.017364] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.024078] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.030792] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.037536] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.044250] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.050933] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.057678] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.064392] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.071105] drivers/usb/musb/musb_core.c:1173 (musb_hdrc) fifo_setup > [ 120.077819] musb-hdrc: 28/31 max ep, 16384/16384 memory > [ 120.083587] drivers/usb/musb/musb_gadget.c:1879 (musb_hdrc) musb_gadget_setup > [ 120.091156] drivers/usb/musb/musb_gadget.c:1842 (musb_hdrc) musb_g_init_endpoints > [ 120.099060] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.106689] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.114318] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.121948] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.129608] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.137237] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.144866] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.152465] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.160095] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.167724] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.175354] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.182983] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.190612] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.198272] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.205902] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.213531] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.221160] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.228790] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.236419] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.244049] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.251678] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.259338] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.266967] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.274597] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.282196] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.289855] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.297485] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.305114] drivers/usb/musb/musb_gadget.c:1803 (musb_hdrc) init_peripheral_ep > [ 120.315155] musb-hdrc musb-hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ 92 > [ 120.415344] twl4030_usb twl4030_usb: twl4030_phy_suspend > > INIT: Id "S" respawning too fast: disabled for 5 minutes > ing_file > [ 132.275848] udc musb-hdrc: registering UDC driver [g_mass_storage] > [ 132.282501] gadget: adding config #1 'Linux File-Backed Storage'/bf0207e8 > [ 132.291137] lun0: open backing file: backing_file > [ 132.304260] gadget: Mass Storage Function, version: 2009/09/11 > [ 132.310638] gadget: Number of LUNs=1 > [ 132.314758] lun0: LUN: file: /home/root/backing_file > [ 132.320129] gadget: I/O thread pid: 1979 > [ 132.324371] gadget: adding 'Mass Storage Function'/d7d6b740 to config 'Linux File-Backed Storage'/bf0207e8 > [ 132.334686] gadget: cfg 1/bf0207e8 speeds: high full > [ 132.339996] gadget: interface 0 = Mass Storage Function/d7d6b740 > [ 132.346649] gadget: Mass Storage Gadget, version: 2009/09/11 > [ 132.352752] gadget: userspace failed to provide iSerialNumber > [ 132.358978] gadget: g_mass_storage ready > [ 132.375366] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 132.375549] musb-hdrc musb-hdrc: MUSB HDRC host driver > [ 132.377777] musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 2 > [ 132.378295] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002 > [ 132.378326] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 > [ 132.378326] usb usb2: Product: MUSB HDRC host driver > [ 132.378356] usb usb2: Manufacturer: Linux 3.6.0-rc4-01179-g83ccc22-dirty musb-hcd > [ 132.378356] usb usb2: SerialNumber: musb-hdrc > [ 132.381072] hub 2-0:1.0: USB hub found > [ 132.381256] hub 2-0:1.0: 1 port detected > root@beagleboard:~# [ 132.471069] twl4030_usb twl4030_usb: HW_CONDITIONS 0xc0/192; link 3 > [ 132.797393] twl4030_usb twl4030_usb: HW_CONDITIONS 0x40/64; link 4 > [ 132.806701] twl4030_usb twl4030_usb: twl4030_phy_suspend > > root@beagleboard:~# rmmod g_mass_storage > [ 139.405426] g_mass_storage musb-hdrc: unregistering UDC driver [musb-hdrc] > [ 139.424591] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 139.430450] gadget: unbind function 'Mass Storage Function'/d7d6b740 > [ 139.437316] gadget: unbind > [ 139.445831] twl4030_usb twl4030_usb: twl4030_phy_suspend > [ 139.453552] lun0: close backing file > [ 139.464691] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 139.470336] musb-hdrc musb-hdrc: remove, state 4 > [ 139.475921] usb usb2: USB disconnect, device number 1 > [ 139.493743] musb-hdrc musb-hdrc: USB bus 2 deregistered > [ 139.534484] twl4030_usb twl4030_usb: twl4030_phy_suspend > root@beagleboard:~# rmmod omap2430 > [ 144.525634] twl4030_usb twl4030_usb: twl4030_phy_resume > [ 144.534027] twl4030_usb twl4030_usb: twl4030_phy_suspend > [ 144.545501] udc musb-hdrc: releasing 'musb-hdrc' > root@beagleboard:~# modprobe omap2430 > [ 147.650756] drivers/usb/musb/omap2430.c:584 (omap2430) omap2430_init > [ 147.657806] drivers/usb/musb/omap2430.c:445 (omap2430) omap2430_probe > [ 147.664703] musb-omap2430 musb-omap2430: Unbalanced pm_runtime_enable! > [ 147.672119] drivers/usb/musb/musb_core.c:2118 (musb_hdrc) musb_probe > [ 147.678833] drivers/usb/musb/musb_core.c:1888 (musb_hdrc) musb_init_controller > [ 147.686523] drivers/usb/musb/musb_core.c:1813 (musb_hdrc) allocate_instance > <HANG>-- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 26f1bef..215d2d5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1160,7 +1160,7 @@ static struct musb_fifo_cfg __devinitdata mode_5_cfg[] = { * * returns negative errno or offset for next fifo. */ -static int __devinit +static int fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, const struct musb_fifo_cfg *cfg, u16 offset) { @@ -1235,7 +1235,7 @@ static struct musb_fifo_cfg __devinitdata ep0_cfg = { .style = FIFO_RXTX, .maxpacket = 64, }; -static int __devinit ep_config_from_table(struct musb *musb) +static int ep_config_from_table(struct musb *musb) { const struct musb_fifo_cfg *cfg; unsigned i, n; @@ -1326,7 +1326,7 @@ done: * ep_config_from_hw - when MUSB_C_DYNFIFO_DEF is false * @param musb the controller */ -static int __devinit ep_config_from_hw(struct musb *musb) +static int ep_config_from_hw(struct musb *musb) { u8 epnum = 0; struct musb_hw_ep *hw_ep; @@ -1373,7 +1373,7 @@ enum { MUSB_CONTROLLER_MHDRC, MUSB_CONTROLLER_HDRC, }; /* Initialize MUSB (M)HDRC part of the USB hardware subsystem; * configure endpoints, or take their config from silicon */ -static int __devinit musb_core_init(u16 musb_type, struct musb *musb) +static int musb_core_init(u16 musb_type, struct musb *musb) { u8 reg; char *type; @@ -1797,7 +1797,7 @@ static void musb_irq_work(struct work_struct *data) * Init support */ -static struct musb *__devinit +static struct musb * allocate_instance(struct device *dev, struct musb_hdrc_config *config, void __iomem *mbase) { @@ -1873,7 +1873,7 @@ static void musb_free(struct musb *musb) * @mregs: virtual address of controller registers, * not yet corrected for platform-specific offsets */ -static int __devinit +static int musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) { int status; @@ -2101,7 +2101,7 @@ fail0: static u64 *orig_dma_mask; #endif -static int __devinit musb_probe(struct platform_device *pdev) +static int musb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; int irq = platform_get_irq_byname(pdev, "mc"); @@ -2397,7 +2397,7 @@ static struct platform_driver musb_driver = { /*-------------------------------------------------------------------------*/ -static int __init musb_init(void) +static int /* __init */ musb_init(void) { if (usb_disabled()) return 0; diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index 40a37c9..8f8597d 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -235,7 +235,7 @@ static const struct file_operations musb_test_mode_fops = { .release = single_release, }; -int __devinit musb_init_debugfs(struct musb *musb) +int musb_init_debugfs(struct musb *musb) { struct dentry *root; struct dentry *file; diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 3a97c4e..69254c8 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h @@ -178,7 +178,7 @@ struct dma_controller { extern void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit); -extern struct dma_controller *__init +extern struct dma_controller * /* __init */ dma_controller_create(struct musb *, void __iomem *); extern void dma_controller_destroy(struct dma_controller *); diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index f7194cf..f3d9f4e 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1795,7 +1795,7 @@ static void musb_gadget_release(struct device *dev) } -static void __devinit +static void init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) { struct musb_hw_ep *hw_ep = musb->endpoints + epnum; @@ -1832,7 +1832,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, u8 epnum, int is_in) * Initialize the endpoints exposed to peripheral drivers, with backlinks * to the rest of the driver state. */ -static inline void __devinit musb_g_init_endpoints(struct musb *musb) +static inline void musb_g_init_endpoints(struct musb *musb) { u8 epnum; struct musb_hw_ep *hw_ep; @@ -1865,7 +1865,7 @@ static inline void __devinit musb_g_init_endpoints(struct musb *musb) /* called once during driver setup to initialize and link into * the driver model; memory is zeroed. */ -int __devinit musb_gadget_setup(struct musb *musb) +int musb_gadget_setup(struct musb *musb) { int status; diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 57a6085..49b548f 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -380,7 +380,7 @@ void dma_controller_destroy(struct dma_controller *c) kfree(controller); } -struct dma_controller *__init +struct dma_controller * /* __init */ dma_controller_create(struct musb *musb, void __iomem *base) { struct musb_dma_controller *controller; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 5fdb9da..d8c6aeb 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -435,7 +435,7 @@ static const struct musb_platform_ops omap2430_ops = { static u64 omap2430_dmamask = DMA_BIT_MASK(32); -static int __devinit omap2430_probe(struct platform_device *pdev) +static int omap2430_probe(struct platform_device *pdev) { struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; struct platform_device *musb;
Marking functions as __init or __devinit and calling them at other times leads to predictable crashes (if you're lucky). Remove them for now. Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com> --- drivers/usb/musb/musb_core.c | 16 ++++++++-------- drivers/usb/musb/musb_debugfs.c | 2 +- drivers/usb/musb/musb_dma.h | 2 +- drivers/usb/musb/musb_gadget.c | 6 +++--- drivers/usb/musb/musbhsdma.c | 2 +- drivers/usb/musb/omap2430.c | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-)