[Letux-kernel] omap_hsmmc_init/omap_hsmmc_late_init

H. Nikolaus Schaller hns at goldelico.com
Fri Sep 8 16:25:06 CEST 2017


Hi Tony,

I am stumbling over some legacy OpenPandora code, which seems to be
the last board which needs special hsmmc quirks for the WiFi chip.

With 4.13 kernel I get this boot message:

[    1.051727] ------------[ cut here ]------------
[    1.051818] WARNING: CPU: 0 PID: 1 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x54/0x74
[    1.051849] sysfs: cannot create duplicate filename '/devices/platform/omap_hsmmc.2'
[    1.051879] Modules linked in:
[    1.051971] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-letux+ #1360
[    1.052001] Hardware name: Generic OMAP3 (Flattened Device Tree)
[    1.052062] [<c010f690>] (unwind_backtrace) from [<c010bba8>] (show_stack+0x10/0x14)
[    1.052124] [<c010bba8>] (show_stack) from [<c075dc88>] (dump_stack+0x98/0xd0)
[    1.052185] [<c075dc88>] (dump_stack) from [<c012f398>] (__warn+0xd0/0x100)
[    1.052215] [<c012f398>] (__warn) from [<c012f3fc>] (warn_slowpath_fmt+0x34/0x44)
[    1.052276] [<c012f3fc>] (warn_slowpath_fmt) from [<c02ebcb4>] (sysfs_warn_dup+0x54/0x74)
[    1.052337] [<c02ebcb4>] (sysfs_warn_dup) from [<c02ebd90>] (sysfs_create_dir_ns+0x74/0x84)
[    1.052398] [<c02ebd90>] (sysfs_create_dir_ns) from [<c0761b8c>] (kobject_add_internal+0xd0/0x294)
[    1.052429] [<c0761b8c>] (kobject_add_internal) from [<c0761f00>] (kobject_add+0x6c/0x8c)
[    1.052490] [<c0761f00>] (kobject_add) from [<c04e831c>] (device_add+0xe4/0x510)
[    1.052551] [<c04e831c>] (device_add) from [<c04ec6e4>] (platform_device_add+0x130/0x1c0)
[    1.052612] [<c04ec6e4>] (platform_device_add) from [<c01281c0>] (omap_hsmmc_late_init+0x3c/0x60)
[    1.052673] [<c01281c0>] (omap_hsmmc_late_init) from [<c0b0fa44>] (omap3_pandora_legacy_init+0x24/0xb4)
[    1.052734] [<c0b0fa44>] (omap3_pandora_legacy_init) from [<c0128178>] (pdata_quirks_check+0x30/0x3c)
[    1.052795] [<c0128178>] (pdata_quirks_check) from [<c0b0f950>] (omap_generic_init+0xc/0x18)
[    1.052856] [<c0b0f950>] (omap_generic_init) from [<c0b03480>] (customize_machine+0x1c/0x28)
[    1.052917] [<c0b03480>] (customize_machine) from [<c0101938>] (do_one_initcall+0xa8/0x150)
[    1.052947] [<c0101938>] (do_one_initcall) from [<c0b00d70>] (kernel_init_freeable+0x110/0x1d4)
[    1.053009] [<c0b00d70>] (kernel_init_freeable) from [<c076f198>] (kernel_init+0x8/0x10c)
[    1.053070] [<c076f198>] (kernel_init) from [<c01070f0>] (ret_from_fork+0x14/0x24)
[    1.055023] ---[ end trace 44e490b09ac4ab88 ]---

This can be traced down to the calls of 

	omap_hsmmc_init(pandora_mmc3);
	omap_hsmmc_late_init(pandora_mmc3);

in omap3_pandora_legacy_init().

Those were introduced by

	https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3b972bf06c22f5abfa6586a8baf50321cd825965

Now trying to understand how that works, I wonder why there
is in omap_hsmmc_init()

	if (omap_hsmmc_done)
		return;
	omap_hsmmc_done = 1;


and in omap_hsmmc_late_init()

	if (omap_hsmmc_done != 1)
		return;
	omap_hsmmc_done++;

This means that the code following the omap_hsmmc_done++ is
executed only if omap_hsmmc_init() was successfully called.
The result is that the device is registered twice.

I'd expect that either one should succeed and never both.
So shouldn't it be

	if (omap_hsmmc_done)
		return;
	omap_hsmmc_done = 1;

in both places?

Maybe it was never noticed because OpenPandora is the last user
of that code and maybe the sysfs: warning depends on other configs.

When "fixing" this, I found a strange side-effect: it also fixes
the OMAPDSS problem I am finding since 4.13-rc1. But WiFi isn't
working either.

I have not yet analyzed the DSS issue further, but it manifests itself as

[   10.329742] Unable to handle kernel paging request at virtual address 62696d04
[   10.337341] pgd = dc8a4000
[   10.340179] [62696d04] *pgd=00000000
[   10.343933] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[   10.349517] Modules linked in: omapdss(+) omapdss_base
[   10.354949] CPU: 0 PID: 1002 Comm: udevd Tainted: G        W       4.13.0-letux+ #1360
[   10.363220] Hardware name: Generic OMAP3 (Flattened Device Tree)
[   10.369537] task: dda5f1c0 task.stack: dc8a0000
[   10.374298] PC is at __lock_acquire+0xc8/0x760
[   10.378936] LR is at lock_acquire+0x1d0/0x29c
[   10.383514] pc : [<c018610c>]    lr : [<c01871e4>]    psr: 200f0093
[   10.390075] sp : dc8a1c98  ip : 00000001  fp : 00000000
[   10.395538] r10: c0a02c76  r9 : 00000001  r8 : 00000000
[   10.401031] r7 : 00000000  r6 : 00000000  r5 : dda5f1c0  r4 : c143806c
[   10.407867] r3 : 00000000  r2 : 62696d04  r1 : 00000000  r0 : 62696c00
[   10.414703] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   10.422271] Control: 10c5387d  Table: 9c8a4019  DAC: 00000051
[   10.428283] Process udevd (pid: 1002, stack limit = 0xdc8a0218)
[   10.434509] Stack: (0xdc8a1c98 to 0xdc8a2000)
[   10.439056] 1c80:                                                       00000000 c01866d4
[   10.447631] 1ca0: 00000000 d8e30efd 00000000 00000000 c0a02c76 00000000 00000000 00000000
[   10.456207] 1cc0: 600f0013 00000001 c0c07568 c01871e4 00000001 00000000 00000000 c0761000
[   10.464782] 1ce0: 00000000 00000000 dda34690 00000003 600f0013 c0a02c66 c0761000 6f6c5f65
[   10.473358] 1d00: 00000000 bf02f070 00000006 00000000 00000000 c07759f8 00000001 00000000
[   10.481933] 1d20: c0761000 bf02f070 00000006 dd8a7e1c c0a02c66 c0761000 dc8a1d58 dc8a1d74
[   10.490509] 1d40: bf00a814 00000000 bf02f070 c076113c 00000000 c04e68f4 dda34680 dd8a7e1c
[   10.499084] 1d60: ddac2c10 ddac2c10 bf02f070 bf00a7ac ddac2c00 dcb8fc10 bf00a78c c04ec8d0
[   10.507659] 1d80: ddac2c10 c1468488 00000000 c04ea9cc 00000000 ddac2c10 ddac2c44 bf02f070
[   10.516235] 1da0: c0c7f480 00000000 bf02f430 c04eabd4 00000000 bf02f070 c04eab4c c04e91e8
[   10.524810] 1dc0: dd89daa4 dda346d0 bf02f070 00000000 dcb9de00 c04ea0b8 bf029143 00000001
[   10.533386] 1de0: 00000000 bf02f070 bf03f07c bf040000 c0c07568 c04ebb78 c04ec3a0 00000000
[   10.541961] 1e00: bf03f07c bf03f0b0 bf02f2c0 bf03f07c dc812140 c0101938 014000c0 0000000c
[   10.550537] 1e20: c01c8518 c018255c 00000001 dc812140 c0ca849a c019cff4 00000000 c026b9ac
[   10.559082] 1e40: 00000000 60000113 dda5f1c0 00000001 c026cab0 bf02f2c0 c0ca82ef c0ca9234
[   10.567657] 1e60: bf02f2c0 c0ca82ef dc812140 c0c07568 bf02f400 c01c8554 bf02f2c0 ffffffff
[   10.576232] 1e80: bf02f2c0 c0ca82ef c0ca9234 c01c732c ffff8000 00007fff bf02f2c0 c01c4394
[   10.584808] 1ea0: c0805c84 00000955 e043d7d4 0006ba00 00275824 00000000 00275824 00000000
[   10.593383] 1ec0: 00000003 c027a94c 00000003 bf026024 00000003 00000000 00000000 00000000
[   10.601959] 1ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.610534] 1f00: 00000000 00000000 7fffffff 00000000 0006ba00 00000007 0000017b c0107204
[   10.619110] 1f20: dc8a0000 00000000 0006bdb0 c01c7704 7fffffff 00000000 00000003 c02426e8
[   10.627685] 1f40: 00000002 e01c8000 00275824 00000000 e01e6b5e e01c8000 00275824 e043cf3c
[   10.636260] 1f60: e0397bb1 e03a134c 00027000 0002f5d0 00000000 00000000 00000000 0000ee00
[   10.644836] 1f80: 00000037 00000038 00000020 00000000 00000014 00000000 00000000 00000000
[   10.653411] 1fa0: 0000000c c0107060 00000000 00000000 00000007 0006ba00 00000000 00000000
[   10.661987] 1fc0: 00000000 00000000 0000000c 0000017b 00020000 00000000 0000000d 0006bdb0
[   10.670562] 1fe0: beb87ee0 beb87ed0 b6decc4b b6ef7a42 600e0030 00000007 06004e46 44900184
[   10.679138] [<c018610c>] (__lock_acquire) from [<c01871e4>] (lock_acquire+0x1d0/0x29c)
[   10.687438] [<c01871e4>] (lock_acquire) from [<c07759f8>] (_raw_spin_lock+0x38/0x48)
[   10.695587] [<c07759f8>] (_raw_spin_lock) from [<c0761000>] (klist_put+0x20/0x80)
[   10.703430] [<c0761000>] (klist_put) from [<c076113c>] (klist_iter_exit+0x20/0x2c)
[   10.711364] [<c076113c>] (klist_iter_exit) from [<c04e68f4>] (device_for_each_child+0x3c/0x78)
[   10.720764] [<c04e68f4>] (device_for_each_child) from [<bf00a7ac>] (dss_probe+0x20/0x40 [omapdss])
[   10.730377] [<bf00a7ac>] (dss_probe [omapdss]) from [<c04ec8d0>] (platform_drv_probe+0x50/0xa0)
[   10.739532] [<c04ec8d0>] (platform_drv_probe) from [<c04ea9cc>] (driver_probe_device+0x150/0x2d0)
[   10.748840] [<c04ea9cc>] (driver_probe_device) from [<c04eabd4>] (__driver_attach+0x88/0xac)
[   10.757690] [<c04eabd4>] (__driver_attach) from [<c04e91e8>] (bus_for_each_dev+0x6c/0x90)
[   10.766265] [<c04e91e8>] (bus_for_each_dev) from [<c04ea0b8>] (bus_add_driver+0xcc/0x1e8)
[   10.774841] [<c04ea0b8>] (bus_add_driver) from [<c04ebb78>] (driver_register+0x9c/0xe0)
[   10.783447] [<c04ebb78>] (driver_register) from [<bf03f0b0>] (omap_dss_init+0x34/0x90 [omapdss])
[   10.792877] [<bf03f0b0>] (omap_dss_init [omapdss]) from [<c0101938>] (do_one_initcall+0xa8/0x150)
[   10.802185] [<c0101938>] (do_one_initcall) from [<c01c8554>] (do_init_module+0x58/0x1d4)
[   10.810668] [<c01c8554>] (do_init_module) from [<c01c732c>] (load_module+0xea8/0x109c)
[   10.819000] [<c01c732c>] (load_module) from [<c01c7704>] (SyS_finit_module+0x88/0x90)
[   10.827209] [<c01c7704>] (SyS_finit_module) from [<c0107060>] (ret_fast_syscall+0x0/0x1c)
[   10.835784] Code: e3500000 0a00001c e2802f41 f5d2f000 (e1921f9f) 
[   10.842193] ---[ end trace 44e490b09ac4ab8b ]---

62696d looks like ASCII... Buffer overflow in udevd? Maybe triggered by a duplicate hsmmc
device?

But as said it is gone if I work around the omap_hsmmc.2 error.

Then I compared some older kernels and it appears as if WiFi and the mmc3 interface is
broken for quite some long time:

4.4.0	no mmc2 sysfs message, WiFi available, DSS works
4.6.0	no mmc2 sysfs message, WiFi available, DSS works
4.7.0	no mmc2 sysfs message, WiFi not available, DSS works
4.8.0	no mmc2 sysfs message, WiFi not available, DSS works
4.12.0	no mmc2 sysfs message, WiFi not available, DSS works
4.13.0	sysfs mmc2 warning, WiFi not available, DSS fails

Any suggestions? Is fixing the omap_hsmmc_done != 1 at least part of a solution?

BR and thanks,
Nikolaus



More information about the Letux-kernel mailing list