[Letux-kernel] modprobe twl4030_* hangs

H. Nikolaus Schaller hns at goldelico.com
Sun Feb 14 11:45:48 CET 2016


Am 13.02.2016 um 21:14 schrieb H. Nikolaus Schaller <hns at goldelico.com>:

> Hi,
> I may have found it - at least for the twl4030 on GTA04.
> 
> The problem are devm_ calls.
> 
> They are risky if there is a simple return -EPROBE_DEFER.
> And EPROBE_DEFER is what I have recently added back to
> our drivers.
> 
> This apparently was inserted at a different location than before, so the
> code could succeed with uninitialized data.
> 
> There is another similar issue with our VAC iio patch. It may also fail
> with EPROBE_DEFER.
> 
> We better should also make the twl4030_charger defer in that case
> as well, so that the madc subsystem is initialized. Otherwise we can't
> detect VAC in some cases (whoever is faster with probing).
> 
> So the sequence must be:
> 
> 1. parse DT
> 2. check if all resources are available (PHY, iio) - return -EPROBE_DEFER
> 3. only then start with devm_power_supply_register or devm_request_threaded_irq - never return -EPROBE_DEFER
> 
> After reordering things, it looks fine again and
> 
> for i in $(lsmod | sed 's|\([a-zA-Z_0-9]\) .*|\1|'); do echo $i; modprobe -v $i; done
> 
> does not show any hangs.
> 
> Now I have to rework the patch set to transform linus/master to the new version.
> 
> This is a little tricky since we must reorder the code *before* we insert the
> -EPROBE_DEFER code since if we do the other way round, it is no longer
> bisectable at this position.
> 
> For the bq2429x_charger it must be something different because there is only
> devm_kzalloc used and nothing else.

Yes, it appears to be the interrupt initialization. I have disabled it and all problems with
this driver are gone. This is not a big issue since interrupts aren't used anyways
at the moment.

Lesson learnt: if you ever have spurious problems like modprobe trying to insmod a module
that is already registered or if poweroff hangs, check if drivers initialize interrupts
properly...

BR,
NIkolaus

> 
> BR,
> Nikolaus
> 
> Am 12.02.2016 um 12:13 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
>> Hi,
>> after some more tests it is clearly:
>> 
>> twl4030_charger on the GTA04
>> bq2429x_charger on the Pyra
>> 
>> If I remove these modules and do a depmod -a both systems boot (almost) fine and fast.
>> On the GTA04 I have no USB/OTG connection.
>> 
>> Then doing a modprobe twl4030_charger on the GTA04 makes the modprobe hang...
>> 
>> I.e. the driver is buggy. Perhaps the EPROBE_DEFER patch we have introduced?
>> Which waits for the USB-PHY (which appears not to be available).
>> 
>> AFAIK these drivers have nothing in common. Except part of the name and that
>> both are I2C devices. And both register as "power supply".
>> 
>> Any ideas?
>> 
>> BR,
>> Nikolaus
>> 
>> 
>> Am 11.02.2016 um 12:28 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>> 
>>> 
>>> Am 11.02.2016 um 12:18 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>> 
>>>> 
>>>> Am 11.02.2016 um 12:13 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>>> 
>>>>> Hi,
>>>>> I have found a strange thing in my latest 4.5-rc3.
>>>>> 
>>>>> root at letux:~# modprobe twl4030_madc_battery
>>>>> root at letux:~# modprobe twl4030_pwrbutton   
>>>>> ^C
>>>>> root at letux:~# modprobe twl4030_vibra    
>>>>> root at letux:~# modprobe twl4030_charger
>>>>> ^C
>>>>> root at letux:~# modprobe twl4030_madc   
>>>>> root at letux:~# modprobe phy_twl4030_usb
>>>>> ^C
>>>>> root at letux:~# 
>>>>> 
>>>>> Some twl4030 related modules can't be modprobed and simply hang.
>>>>> Some others work.
>>>>> 
>>>>> The total effect is that the kernel needs ~200 seconds to boot.
>>>>> 
>>>>> And I have the same on the OMAP5 (where the twl4030 modules
>>>>> are not loaded/needed at all).
>>>> 
>>>> Well, there it is the bq2429x driver. And the common part is that both
>>>> create charger nodes, registered by power_supply_register().
>>>> 
>>>> What is even more strange is that they show up in lsmod. But a
>>>> second modprobe -v reports that it tries another insmod:
>>>> 
>>>> root at letux:~# lsmod | fgrep bq24
>>>> bq2429x_charger        13916  1 
>>>> root at letux:~# modprobe -v bq2429x_charger
>>>> insmod /lib/modules/4.5.0-rc3-letux+/kernel/drivers/power/bq2429x_charger.ko 
>>>> ^C
>>>> root at letux:~# 
>>>> 
>>> 
>>> I just found that modprobe understands verbosity levels:
>>> 
>>> root at letux:~# modprobe -v -v -v bq2429x_charger
>>> modprobe: INFO: ../libkmod/libkmod.c:354 kmod_set_log_fn() custom logging function 0x7f654a6d registered
>>> modprobe: DEBUG: ../libkmod/libkmod-index.c:790 index_mm_open() file=/lib/modules/4.5.0-rc3-letux+/modules.dep.bin
>>> modprobe: DEBUG: ../libkmod/libkmod-index.c:790 index_mm_open() file=/lib/modules/4.5.0-rc3-letux+/modules.alias.bin
>>> modprobe: DEBUG: ../libkmod/libkmod-index.c:790 index_mm_open() file=/lib/modules/4.5.0-rc3-letux+/modules.symbols.bin
>>> modprobe: DEBUG: ../libkmod/libkmod-index.c:790 index_mm_open() file=/lib/modules/4.5.0-rc3-letux+/modules.builtin.bin
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:540 kmod_module_new_from_lookup() input alias=bq2429x_charger, normalized=bq2429x_charger
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:546 kmod_module_new_from_lookup() lookup modules.dep bq2429x_charger
>>> modprobe: DEBUG: ../libkmod/libkmod.c:545 kmod_search_moddep() use mmaped index 'modules.dep' modname=bq2429x_charger
>>> modprobe: DEBUG: ../libkmod/libkmod.c:392 kmod_pool_get_module() get module name='bq2429x_charger' found=(nil)
>>> modprobe: DEBUG: ../libkmod/libkmod.c:400 kmod_pool_add_module() add 0x7f6773f0 key='bq2429x_charger'
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:196 kmod_module_parse_depline() 0 dependencies for bq2429x_charger
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:567 kmod_module_new_from_lookup() lookup bq2429x_charger=0, list=0x7f6770d8
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=snd_pcsp mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=snd_usb_audio mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=cx88_alsa mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=snd_atiixp_modem mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=snd_intel8x0m mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=snd_via82xx_modem mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=cirrus mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:1374 kmod_module_get_options() modname=mgag200 mod->name=bq2429x_charger mod->alias=(null)
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:728 kmod_module_get_path() name='bq2429x_charger' path='/lib/modules/4.5.0-rc3-letux+/kernel/drivers/power/bq2429x_charger.ko'
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:728 kmod_module_get_path() name='bq2429x_charger' path='/lib/modules/4.5.0-rc3-letux+/kernel/drivers/power/bq2429x_charger.ko'
>>> insmod /lib/modules/4.5.0-rc3-letux+/kernel/drivers/power/bq2429x_charger.ko 
>>> modprobe: DEBUG: ../libkmod/libkmod-module.c:728 kmod_module_get_path() name='bq2429x_charger' path='/lib/modules/4.5.0-rc3-letux+/kernel/drivers/power/bq2429x_charger.ko'
>>> 
>>> Maybe something in the MODULE_ALIAS is broken?
>>> 
>>> Really strange...
>>> 
>>> BR,
>>> Nikolaus
>>> 
>>> _______________________________________________
>>> http://projects.goldelico.com/p/gta04-kernel/
>>> Letux-kernel mailing list
>>> Letux-kernel at openphoenux.org
>>> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
>> 
>> _______________________________________________
>> http://projects.goldelico.com/p/gta04-kernel/
>> Letux-kernel mailing list
>> Letux-kernel at openphoenux.org
>> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
> 
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel



More information about the Letux-kernel mailing list