Re: [PATCH] clk: tegra: Fix bypassing of PLLs

From: Thierry Reding
Date: Tue Nov 24 2015 - 10:11:08 EST


On Mon, Nov 23, 2015 at 03:18:59PM -0800, Tyler Baker wrote:
> Hi Jon,
>
> On 20 November 2015 at 07:11, Jon Hunter <jonathanh@xxxxxxxxxx> wrote:
> > The _clk_disable_pll() function will attempt to place a PLL into bypass
> > if the TEGRA_PLL_BYPASS is specified for the PLL and then disable the PLL
> > by clearing the enable bit. To place the PLL into bypass, the bypass bit
> > needs to be set and not cleared. Fix this by setting the bypass bit and
> > not clearing it.
> >
> > Signed-off-by: Jon Hunter <jonathanh@xxxxxxxxxx>
>
> The kernelci.org bot recently detected a jetson-tk1 boot failure[1][2]
> in the tegra tree. This boot failure has only been observed when
> booting with a multi_v7_defconfig kernel variant. The bot bisected[3]
> this boot failure to this commit, and I confirmed reverting it on top
> of the tegra for-next branch resolves the issue. The ramdisk[4] used
> for booting is loaded with the modules from the build. It appears to
> me that as the modules are being loaded in userspace by eudev the
> jetson-tk1 locks up. I've sifted through the console logs a bit, and
> found this splat to be most interesting[5]. Can you confirm this
> issue on your end?

Let me quote one of your logs for ease of commenting. I've trimmed it
somewhat because it got fragmented in the middle and not everything is
relevant:

[ 9.809636] tegra-emc 7001b000.emc: no timing for rate 4294967295
[ 9.834995] Unable to handle kernel paging request at virtual address 00270300
...
[ 9.836808] [] (__irq_svc) from [] (console_unlock+0x3ec/0x47c)
[ 9.836854] [] (console_unlock) from [] (vprintk_emit+0x1bf/0x348)
[ 9.836905] [] (vprintk_emit) from [] (dev_vprintk_emit+0x9f/0x124)
[ 9.836951] [] (dev_vprintk_emit) from [] (dev_printk_emit+0x15/0x20)
[ 9.836995] [] (dev_printk_emit) from [] (__dev_printk+0x29/0x48)
[ 9.837036] [] (__dev_printk) from [] (dev_err+0x25/0x30)
[ 9.837083] [] (dev_err) from [] (tegra_emc_find_timing+0x3d/0x4c)
[ 9.837125] [] (tegra_emc_find_timing) from [] (tegra_emc_complete_timing_change+0x9/0x130)
[ 9.837162] [] (tegra_emc_complete_timing_change) from [] (emc_set_timing+0xc3/0x158)
[ 9.837190] [] (emc_set_timing) from [] (emc_set_rate+0xdb/0x150)
[ 9.837221] [] (emc_set_rate) from [] (gpmc_calc_timings+0xb5/0x51c)
[ 9.837261] [] (gpmc_calc_timings) from [] (clk_set_rate+0x15/0x20)
[ 9.837307] [] (clk_set_rate) from [] (tegra_devfreq_target+0x40/0x58 [tegra_devfreq])
[ 9.837350] [] (tegra_devfreq_target [tegra_devfreq]) from [] (update_devfreq+0x4b/0x9c)
[ 9.837386] [] (update_devfreq) from [] (actmon_thread_isr+0x12/0x20 [tegra_devfreq])
[ 9.837424] [] (actmon_thread_isr [tegra_devfreq]) from [] (irq_thread_dtor+0x77/0x78)
[ 9.837456] [] (irq_thread_dtor) from [] (irq_thread+0xcf/0x16c)
[ 9.837496] [] (irq_thread) from [] (kthread+0x93/0xac)
[ 9.837541] [] (kthread) from [] (ret_from_fork+0x11/0x20)
[ 9.837563] Code: bad PC value
[ 9.837582] ---[ end trace 586d537b3212336d ]---

The part that's really weird in the above is the call to
gpmc_calc_timings(), because that function is from OMAP:

$ git grep -n gpmc_calc_timings
arch/arm/mach-omap2/gpmc-onenand.c:89: gpmc_calc_timings(t, &onenand_async, &dev_t);
arch/arm/mach-omap2/gpmc-onenand.c:266: gpmc_calc_timings(t, &onenand_sync, &dev_t);
arch/arm/mach-omap2/usb-tusb6010.c:72: gpmc_calc_timings(&t, &tusb_async, &dev_t);
arch/arm/mach-omap2/usb-tusb6010.c:99: gpmc_calc_timings(&t, &tusb_sync, &dev_t);
drivers/memory/omap-gpmc.c:1539:int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
include/linux/omap-gpmc.h:152:extern int gpmc_calc_timings(struct gpmc_timings *gpmc_t,

So I'm not at all surprised that this breaks. While that seems unrelated
it's quite possible that there's some memory corruption going on which
would also explain the hang. It doesn't even have to be memory
corruption, but we've seen similar problems in the past where some
platform was unconditionally registering drivers that it shouldn't have
been registering and which then executed on a device where the device
wasn't there. That could be the case here as well.

Unfortunately I can't come up with any good explanation of why
gpmc_calc_timings() shows up in the call trace above. It's only ever
called as a result of USB or NAND operation, so why it would be called
from clk_set_rate() is beyond me.

Thierry

Attachment: signature.asc
Description: PGP signature