From patchwork Fri Dec 4 15:59:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 7769561 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CDE6F9F54E for ; Fri, 4 Dec 2015 15:59:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 917182049E for ; Fri, 4 Dec 2015 15:59:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC59A20453 for ; Fri, 4 Dec 2015 15:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753476AbbLDP7k (ORCPT ); Fri, 4 Dec 2015 10:59:40 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:34936 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753374AbbLDP7j (ORCPT ); Fri, 4 Dec 2015 10:59:39 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id tB4FxWg0012904; Fri, 4 Dec 2015 09:59:32 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id tB4FxWbr025313; Fri, 4 Dec 2015 09:59:32 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Fri, 4 Dec 2015 09:59:32 -0600 Received: from [172.22.234.224] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id tB4FxUCT010225; Fri, 4 Dec 2015 09:59:31 -0600 Subject: Re: [PATCH 2/2] pinctrl: single: remove misuse of IRQF_NO_SUSPEND flag To: Tony Lindgren References: <1448644860-29323-1-git-send-email-sudeep.holla@arm.com> <1448644860-29323-2-git-send-email-sudeep.holla@arm.com> <20151203181337.GV23396@atomide.com> <56608B72.1040101@ti.com> <20151203213715.GA23396@atomide.com> <56616E74.9000604@ti.com> <20151204153504.GF23396@atomide.com> CC: Linus Walleij , Sudeep Holla , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , From: Grygorii Strashko Message-ID: <5661B861.7010203@ti.com> Date: Fri, 4 Dec 2015 17:59:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151204153504.GF23396@atomide.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/04/2015 05:35 PM, Tony Lindgren wrote: > * Grygorii Strashko [151204 02:45]: >> On 12/03/2015 11:37 PM, Tony Lindgren wrote: >>> * Grygorii Strashko [151203 10:36]: >>>> >>>> I think, this patch should not break our wake-up functionality. >>>> It will just change the moment when pcs_irq_handler() will be called: >>>> >>>> before this change: >>>> - suspend_enter() >>>> .... >>>> - arch_suspend_enable_irqs(); >>>> - ^ right here >>>> >>>> after this change: >>>> - suspend_enter() >>>> .... >>>> dpm_resume_noirq() >>>> - resume_device_irqs() >>>> ^ here >>>> >>>> Correct? And as for me this is more safe. >>> >>> I think there's more to it though. With both applied, it produces this on >>> coming back up from suspend: >>> >>> PM: noirq resume of devices complete after 18.127 msecs >>> ------------[ cut here ]------------ >>> WARNING: CPU: 0 PID: 123 at kernel/irq/manage.c:605 irq_set_irq_wake+0xbc/0xfc() >>> Unbalanced IRQ 375 wake disable >>> Modules linked in: ledtrig_default_on leds_gpio led_class rtc_twl twl4030_wdt >>> CPU: 0 PID: 123 Comm: bash Tainted: G W 4.4.0-rc3-dirty #2682 >>> Hardware name: Generic OMAP36xx (Flattened Device Tree) >>> [] (unwind_backtrace) from [] (show_stack+0x10/0x14) >>> ] (show_stack) from [] (dump_stack+0x84/0x9c) >>> [] (dump_stack) from [] (warn_slowpath_common+0x7c/0xb8) >>> [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) >>> [] (warn_slowpath_fmt) from [] (irq_set_irq_wake+0xbc/0xfc) >>> [] (irq_set_irq_wake) from [] (device_wakeup_disarm_wake_irqs+0x70/0x12c) >>> [] (device_wakeup_disarm_wake_irqs) from [] (dpm_resume_noirq+0x20c/0x2e4) >>> [] (dpm_resume_noirq) from [] (suspend_devices_and_enter+0x1e4/0x6bc) >>> [] (suspend_devices_and_enter) from [] (pm_suspend+0x358/0x4b8) >>> [] (pm_suspend) from [] (state_store+0x64/0xb8) >>> [] (state_store) from [] (kobj_attr_store+0x14/0x20) >>> [] (kobj_attr_store) from [] (sysfs_kf_write+0x4c/0x50) >>> [] (sysfs_kf_write) from [] (kernfs_fop_write+0xbc/0x1cc) >>> [] (kernfs_fop_write) from [] (__vfs_write+0x24/0xd8) >>> [] (__vfs_write) from [] (vfs_write+0x94/0x154) >>> [] (vfs_write) from [] (SyS_write+0x40/0x94) >>> [] (SyS_write) from [] (ret_fast_syscall+0x0/0x1c) >>> ---[ end trace 321b51565e161bee ]--- >>> >>> And these both need to be applied together when we have a fix for the above >>> as otherwise we'll get the lock recursion Sudeep mentioned in patch 2/2. >>> >> >> Most probably below diff will fix above issue: >> >> diff --git a/arch/arm/mach-omap2/prm_common.c >> b/arch/arm/mach-omap2/prm_common.c >> index 3fc2cbe..69cde67 100644 >> --- a/arch/arm/mach-omap2/prm_common.c >> +++ b/arch/arm/mach-omap2/prm_common.c >> @@ -338,6 +338,7 @@ int omap_prcm_register_chain_handler(struct >> omap_prcm_irq_setup *irq_setup) >> ct->chip.irq_ack = irq_gc_ack_set_bit; >> ct->chip.irq_mask = irq_gc_mask_clr_bit; >> ct->chip.irq_unmask = irq_gc_mask_set_bit; >> + ct->chip.flags = IRQCHIP_SKIP_SET_WAKE; >> >> ct->regs.ack = irq_setup->ack + i * 4; >> ct->regs.mask = irq_setup->mask + i * 4; >> >> > > That fixes the warning on resume, but adds a new one during init: > > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 1 at kernel/irq/pm.c:51 irq_pm_install_action+0x9c/0xec() > Modules linked in: > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.0-rc3-00001-g6a5e5ec #2694 > Hardware name: Generic OMAP36xx (Flattened Device Tree) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0x84/0x9c) > [] (dump_stack) from [] (warn_slowpath_common+0x7c/0xb8) > [] (warn_slowpath_common) from [] (warn_slowpath_null+0x1c/0x24) > [] (warn_slowpath_null) from [] (irq_pm_install_action+0x9c/0xec) > [] (irq_pm_install_action) from [] (__setup_irq+0x434/0x5e0) > [] (__setup_irq) from [] (request_threaded_irq+0xc4/0x15c) > [] (request_threaded_irq) from [] (omap3_pm_init+0x10c/0x400) > [] (omap3_pm_init) from [] (omap3_init_late+0xc/0x14) > [] (omap3_init_late) from [] (init_machine_late+0x1c/0x90) > [] (init_machine_late) from [] (do_one_initcall+0x80/0x1e0) > [] (do_one_initcall) from [] (kernel_init_freeable+0x218/0x2e8) > [] (kernel_init_freeable) from [] (kernel_init+0x8/0xec) > [] (kernel_init) from [] (ret_from_fork+0x14/0x24) > ---[ end trace 81093452bf564522 ]--- > Sorry, I can't test it right now :( Potential fix below: diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 2dbd378..4e56fd9 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -481,7 +481,7 @@ int __init omap3_pm_init(void) /* IO interrupt is shared with mux code */ ret = request_irq(omap_prcm_event_to_irq("io"), - _prcm_int_handle_io, IRQF_SHARED | IRQF_NO_SUSPEND, "pm_io", + _prcm_int_handle_io, IRQF_SHARED, "pm_io", omap3_pm_init); enable_irq(omap_prcm_event_to_irq("io")); @@ -489,6 +489,7 @@ int __init omap3_pm_init(void) pr_err("pm: Failed to request pm_io irq\n"); goto err2; } + enable_irq_wake(omap_prcm_event_to_irq("io")); ret = pwrdm_for_each(pwrdms_setup, NULL); if (ret) {