From mboxrd@z Thu Jan 1 00:00:00 1970 From: LW@KARO-electronics.de (=?iso-8859-15?Q?Lothar_Wa=DFmann?=) Date: Fri, 26 Nov 2010 13:53:40 +0100 Subject: [PATCH 03/15] ARM: mxs: Add reset routines In-Reply-To: <20101126113255.GC27637@pengutronix.de> References: <1290754154-9428-1-git-send-email-shawn.guo@freescale.com> <1290754154-9428-4-git-send-email-shawn.guo@freescale.com> <19695.32386.279224.624305@ipc1.ka-ro> <20101126095733.GA27637@pengutronix.de> <19695.36407.793411.550458@ipc1.ka-ro> <20101126113255.GC27637@pengutronix.de> Message-ID: <19695.44500.496696.448899@ipc1.ka-ro> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, Uwe Kleine-K?nig writes: > Hello Lothar, > > On Fri, Nov 26, 2010 at 11:38:47AM +0100, Lothar Wa?mann wrote: > > Uwe Kleine-K?nig writes: > > > On Fri, Nov 26, 2010 at 10:31:46AM +0100, Lothar Wa?mann wrote: > > > > Since arch_reset() may be called from interrupt context (e.g. due to > > > > SYSRQ-B) it must not call any functions that may sleep like clk_get*() > > > > or clk_enable(). The clock should be acquired and enabled in the init > > > > routine. > > > This is a problem that also exist in arch/arm/plat-mxc/system.c's > > > arch_reset. > > > > > > Did you already verify that this is indeed a problem? I guess there are > > > more architectures that use clk_get in arch_reset, aren't there? > > > > > If you consider this a problem: > > BUG: sleeping function called from invalid context at /usr/local/src/arm-linux/kernel/mutex.c: > > 280 > > in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper > > 2 locks held by swapper/0: > > #0: (&port_lock_key){-.-...}, at: [] imx_rxint+0x24/0x20c > > #1: (sysrq_key_table_lock){-.....}, at: [] __handle_sysrq+0x20/0x170 > > irq event stamp: 130658 > > hardirqs last enabled at (130657): [] default_idle+0x2c/0x3c > > hardirqs last disabled at (130658): [] __irq_svc+0x34/0xa8 > > softirqs last enabled at (130648): [] __do_softirq+0x144/0x164 > > softirqs last disabled at (130637): [] irq_exit+0x60/0xb4 > > Backtrace: > > [] (dump_backtrace+0x0/0x114) from [] (dump_stack+0x18/0x1c) > > r7:00000000 r6:c0326000 r5:00000000 r4:c0326000 > > [] (dump_stack+0x0/0x1c) from [] (__might_sleep+0x11c/0x13c) > > [] (__might_sleep+0x0/0x13c) from [] (mutex_lock_nested+0x34/0x31c) > > r4:c032afd4 > > [] (mutex_lock_nested+0x0/0x31c) from [] (clk_get_sys+0x30/0xe8) > > [] (clk_get_sys+0x0/0xe8) from [] (arch_reset+0x18/0x8c) > > [] (arch_reset+0x0/0x8c) from [] (arm_machine_restart+0x2c/0x5c) > > r5:00000000 r4:00000068 > > [] (arm_machine_restart+0x0/0x5c) from [] (machine_restart+0x20/0x28) > > r5:d186b9c0 r4:00000062 > > [] (machine_restart+0x0/0x28) from [] (emergency_restart+0x14/0x18) > > [] (emergency_restart+0x0/0x18) from [] (sysrq_handle_reboot+0x24/0x28) > > [] (sysrq_handle_reboot+0x0/0x28) from [] (__handle_sysrq+0xc0/0x170) > > [] (__handle_sysrq+0x0/0x170) from [] (handle_sysrq+0x34/0x40) > > [] (handle_sysrq+0x0/0x40) from [] (imx_rxint+0xec/0x20c) > > [] (imx_rxint+0x0/0x20c) from [] (imx_int+0x28/0x68) > > [] (imx_int+0x0/0x68) from [] (handle_IRQ_event+0x2c/0x100) > > r7:0000002d r6:00000000 r5:00000000 r4:d1eab800 > > [] (handle_IRQ_event+0x0/0x100) from [] (handle_level_irq+0xbc/0x120) > > r7:d1eab800 r6:c03340b8 r5:0000002d r4:c033407c > > [] (handle_level_irq+0x0/0x120) from [] (_text+0x70/0x8c) > > r7:00000002 r6:002d0000 r5:00000000 r4:0000002d > > [] (_text+0x0/0x8c) from [] (__irq_svc+0x54/0xa8) > > Exception stack(0xc0327f48 to 0xc0327f90) > > 7f40: 00000001 0016e240 20000093 20000013 c0326000 c032aaa8 > > 7f60: c03541e4 c032aaa0 8001ecc4 41069264 8001ec90 c0327f9c c0327f68 c0327f90 > > 7f80: c006c620 c0027f8c 20000013 ffffffff > > r5:fc400000 r4:0000001f > > [] (default_idle+0x0/0x3c) from [] (cpu_idle+0x70/0xcc) > > [] (cpu_idle+0x0/0xcc) from [] (rest_init+0x70/0x84) > > r7:c032aaa0 r6:c0020e14 r5:c0020e18 r4:c0853ad8 > > [] (rest_init+0x0/0x84) from [] (start_kernel+0x280/0x2d8) > > [] (start_kernel+0x0/0x2d8) from [<80008034>] (0x80008034) > > r5:c0354284 r4:00053175 > > ------------[ cut here ]------------ > > WARNING: at /usr/local/src/arm-linux/kernel/mutex.c:207 mutex_lock_nested+0xb4/0x31c() > > Modules linked in: > > Backtrace: > > [] (dump_backtrace+0x0/0x114) from [] (dump_stack+0x18/0x1c) > > r7:c02e09d3 r6:000000cf r5:c026189c r4:00000000 > > [] (dump_stack+0x0/0x1c) from [] (warn_slowpath_common+0x50/0x68) > > [] (warn_slowpath_common+0x0/0x68) from [] (warn_slowpath_null+0x18/0x1c) > > r7:00000000 r6:c0326000 r5:c0329868 r4:c032afd4 > > [] (warn_slowpath_null+0x0/0x1c) from [] (mutex_lock_nested+0xb4/0x31c) > > [] (mutex_lock_nested+0x0/0x31c) from [] (clk_get_sys+0x30/0xe8) > > [] (clk_get_sys+0x0/0xe8) from [] (arch_reset+0x18/0x8c) > > [] (arch_reset+0x0/0x8c) from [] (arm_machine_restart+0x2c/0x5c) > > r5:00000000 r4:00000068 > > [] (arm_machine_restart+0x0/0x5c) from [] (machine_restart+0x20/0x28) > > r5:d186b9c0 r4:00000062 > > [] (machine_restart+0x0/0x28) from [] (emergency_restart+0x14/0x18) > > [] (emergency_restart+0x0/0x18) from [] (sysrq_handle_reboot+0x24/0x28) > > [] (sysrq_handle_reboot+0x0/0x28) from [] (__handle_sysrq+0xc0/0x170) > > [] (__handle_sysrq+0x0/0x170) from [] (handle_sysrq+0x34/0x40) > > [] (handle_sysrq+0x0/0x40) from [] (imx_rxint+0xec/0x20c) > > [] (imx_rxint+0x0/0x20c) from [] (imx_int+0x28/0x68) > > [] (imx_int+0x0/0x68) from [] (handle_IRQ_event+0x2c/0x100) > > r7:0000002d r6:00000000 r5:00000000 r4:d1eab800 > > [] (handle_IRQ_event+0x0/0x100) from [] (handle_level_irq+0xbc/0x120) > > r7:d1eab800 r6:c03340b8 r5:0000002d r4:c033407c > > [] (handle_level_irq+0x0/0x120) from [] (_text+0x70/0x8c) > > r7:00000002 r6:002d0000 r5:00000000 r4:0000002d > > [] (_text+0x0/0x8c) from [] (__irq_svc+0x54/0xa8) > > Exception stack(0xc0327f48 to 0xc0327f90) > > 7f40: 00000001 0016e240 20000093 20000013 c0326000 c032aaa8 > > 7f60: c03541e4 c032aaa0 8001ecc4 41069264 8001ec90 c0327f9c c0327f68 c0327f90 > > 7f80: c006c620 c0027f8c 20000013 ffffffff > > r5:fc400000 r4:0000001f > > [] (default_idle+0x0/0x3c) from [] (cpu_idle+0x70/0xcc) > > [] (cpu_idle+0x0/0xcc) from [] (rest_init+0x70/0x84) > > r7:c032aaa0 r6:c0020e14 r5:c0020e18 r4:c0853ad8 > > [] (rest_init+0x0/0x84) from [] (start_kernel+0x280/0x2d8) > > [] (start_kernel+0x0/0x2d8) from [<80008034>] (0x80008034) > > r5:c0354284 r4:00053175 > > ---[ end trace b484fc13651ee6f1 ]--- > do you care enough to send a patch? If not I can set it on my agenda. > I have it on my to-do list for quite some time. I'll finally try to get it out soon. Lothar Wa?mann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Gesch?ftsf?hrer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | info at karo-electronics.de ___________________________________________________________