Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757422Ab3FGUvd (ORCPT ); Fri, 7 Jun 2013 16:51:33 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:55665 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757242Ab3FGUvb (ORCPT ); Fri, 7 Jun 2013 16:51:31 -0400 From: Kevin Hilman To: Grygorii Strashko Cc: Wolfram Sang , Tony Lindgren , , , , Nishanth Menon Subject: Re: [PATCH 1/5] i2c: omap: fix spurious IRQs: disable/enable IRQ at INTC when idle References: <1370630768-4077-1-git-send-email-grygorii.strashko@ti.com> <1370630768-4077-2-git-send-email-grygorii.strashko@ti.com> Date: Fri, 07 Jun 2013 13:51:27 -0700 In-Reply-To: <1370630768-4077-2-git-send-email-grygorii.strashko@ti.com> (Grygorii Strashko's message of "Fri, 7 Jun 2013 21:46:04 +0300") Message-ID: <87li6llk4w.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5033 Lines: 90 Grygorii Strashko writes: > From: Kevin Hilman > > Currently, runtime PM is used to keep the device enabled only during > active transfers and for a configurable runtime PM autosuspend timout > after an xfer. > > In addition to idling the device, driver's ->runtime_suspend() method > currently disables device interrupts when idle. However, on some SoCs > (notably OMAP4+), the I2C hardware may shared with other coprocessors. > This means that the MPU will still recieve interrupts if a coprocessor > is using the I2C device. To avoid this, also disable interrupts at > the MPU INTC when idling the device in ->runtime_suspend() (and > re-enable them in ->runtime_resume().) This part based on an original > patch from Shubhrajyoti Datta. NOTE: for proper sharing the I2C with > a coprocessor, this driver still needs hwspinlock support added. > > More over, this patch fixes the kernel boot failure which happens when > CONFIG_SENSORS_LM75=y: > > [ 2.251220] WARNING: at drivers/bus/omap_l3_noc.c:113 l3_interrupt_handler+0x140/0x184() > [ 2.257781] L3 custom error: MASTER:MPU TARGET:L4 PER2 > [ 2.264373] Modules linked in: > [ 2.268463] CPU: 0 PID: 2 Comm: kthreadd Not tainted 3.10.0-rc4-00034-g042dd60-dirty #64 > [ 2.270385] [] (unwind_backtrace+0x0/0xf0) from [] (show_stack+0x10/0x14) > [ 2.286102] [] (show_stack+0x10/0x14) from [] (warn_slowpath_common+0x4c/0x68) > [ 2.295593] [] (warn_slowpath_common+0x4c/0x68) from [] (warn_slowpath_fmt+0x30/0x40) > [ 2.299987] [] (warn_slowpath_fmt+0x30/0x40) from [] (l3_interrupt_handler+0x140/0x184) > [ 2.315582] [] (l3_interrupt_handler+0x140/0x184) from [] (handle_irq_event_percpu+0x58/0x258) > [ 2.323364] [] (handle_irq_event_percpu+0x58/0x258) from [] (handle_irq_event+0x3c/0x5c) > [ 2.327819] [] (handle_irq_event+0x3c/0x5c) from [] (handle_fasteoi_irq+0xbc/0x164) > [ 2.337829] [] (handle_fasteoi_irq+0xbc/0x164) from [] (generic_handle_irq+0x20/0x30) > [ 2.357513] [] (generic_handle_irq+0x20/0x30) from [] (handle_IRQ+0x4c/0xac) > [ 2.366821] [] (handle_IRQ+0x4c/0xac) from [] (gic_handle_irq+0x28/0x5c) > [ 2.375762] [] (gic_handle_irq+0x28/0x5c) from [] (__irq_svc+0x44/0x5c) > [ 2.379821] Exception stack(0xdb085ec0 to 0xdb085f08) > [ 2.389953] 5ec0: 00000001 00000001 00000000 db07ea00 40000113 db2317a8 db084000 000002f1 > [ 2.389953] 5ee0: db07ea00 00000000 00000000 00000000 c04fd990 db085f08 c009170c c04f03e8 > [ 2.405609] 5f00: 20000113 ffffffff > [ 2.408355] [] (__irq_svc+0x44/0x5c) from [] (_raw_spin_unlock_irqrestore+0x34/0x44) > [ 2.418304] [] (_raw_spin_unlock_irqrestore+0x34/0x44) from [] (do_fork+0xa4/0x2d4) > [ 2.427795] [] (do_fork+0xa4/0x2d4) from [] (kernel_thread+0x30/0x38) > [ 2.437805] [] (kernel_thread+0x30/0x38) from [] (kthreadd+0xd4/0x13c) > [ 2.448364] [] (kthreadd+0xd4/0x13c) from [] (ret_from_fork+0x14/0x2c) > [ 2.448364] ---[ end trace da8cf92c433d1616 ]--- > > The root casue of crash is race between omap_i2c_runtime_suspend() > and omap_i2c_isr_thread() If there's a race here, then it's not the same problem which is described above, unless the CPU2 IRQ is happening because of a shared user of I2C, in which case it doesn't need any additional explanation. > > CPU1: CPU2: > |-omap_i2c_xfer | > |- pm_runtime_put_autosuspend() | > |-timeout |-omap_i2c_isr() > |-return IRQ_WAKE_THREAD; > |-omap_i2c_runtime_suspend() | > |-omap_i2c_isr_thread() > |- oops is here - I2C module is in idle state If this is happening, I don't think it's related to $SUBJECT patch (but is probably hidden by it.) Instead, what probably needs to happen in this is case is that omap_i2c_isr() should be doing a "mark last busy" to reset the autosuspend timeout. And, that should be done in a separate patch. > Cc: Nishanth Menon > Signed-off-by: Kevin Hilman Both the From: and Signed-off should be from my TI address since the work was done while I was working for TI. Also, if you change the original patch/changelog, you should add a line here like: [grygorii.strashko@ti.com]: updated changlog > Signed-off-by: Grygorii Strashko Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/