From patchwork Mon Jul 6 15:13:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 6725391 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6FCA6C05AC for ; Mon, 6 Jul 2015 15:14:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FBAD206AD for ; Mon, 6 Jul 2015 15:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2916F20619 for ; Mon, 6 Jul 2015 15:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753533AbbGFPN4 (ORCPT ); Mon, 6 Jul 2015 11:13:56 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:52160 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbbGFPNy (ORCPT ); Mon, 6 Jul 2015 11:13:54 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t66FDeRJ008560; Mon, 6 Jul 2015 10:13:40 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t66FDeUv011201; Mon, 6 Jul 2015 10:13:40 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Mon, 6 Jul 2015 10:13:28 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t66FDdnj032236; Mon, 6 Jul 2015 10:13:39 -0500 From: Grygorii Strashko To: Linus Walleij CC: , , , Grygorii Strashko , Tony Lindgren , Sebastian Andrzej Siewior Subject: [PATCH] pinctrl: single: ensure pcs irq will not be forced threaded Date: Mon, 6 Jul 2015 18:13:37 +0300 Message-ID: <1436195617-24003-1-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.4.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The PSC IRQ is requested using request_irq() API and as result it can be forced to be threaded IRQ in RT-Kernel if PCS_QUIRK_HAS_SHARED_IRQ is enabled for pinctrl domain. As result, following 'possible irq lock inversion dependency' report can be seen: Acked-by: Tony Lindgren ========================================================= [ INFO: possible irq lock inversion dependency detected ] 3.14.43-rt42-00360-g96ff499-dirty #24 Not tainted --------------------------------------------------------- irq/369-pinctrl/927 just changed the state of lock: (&pcs->lock){+.....}, at: [] pcs_irq_handle+0x48/0x9c but this lock was taken by another, HARDIRQ-safe lock in the past: (&irq_desc_lock_class){-.....} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&pcs->lock); local_irq_disable(); lock(&irq_desc_lock_class); lock(&pcs->lock); lock(&irq_desc_lock_class); *** DEADLOCK *** no locks held by irq/369-pinctrl/927. the shortest dependencies between 2nd lock and 1st lock: -> (&irq_desc_lock_class){-.....} ops: 58724 { IN-HARDIRQ-W at: [] lock_acquire+0x9c/0x158 [] _raw_spin_lock+0x48/0x58 [] handle_fasteoi_irq+0x24/0x15c [] generic_handle_irq+0x3c/0x4c [] handle_IRQ+0x50/0xa0 [] gic_handle_irq+0x3c/0x6c [] __irq_svc+0x44/0x8c [] arch_cpu_idle+0x40/0x4c [] cpu_startup_entry+0x270/0x2e0 [] rest_init+0xd4/0xe4 [] start_kernel+0x3d0/0x3dc [<80008084>] 0x80008084 INITIAL USE at: [] lock_acquire+0x9c/0x158 [] _raw_spin_lock_irqsave+0x54/0x68 [] __irq_get_desc_lock+0x64/0xa4 [] irq_set_chip+0x30/0x78 [] irq_set_chip_and_handler_name+0x24/0x3c [] gic_irq_domain_map+0x48/0xb4 [] irq_domain_associate+0x84/0x1d4 [] irq_create_mapping+0x80/0x11c [] irq_create_of_mapping+0x80/0x120 [] irq_of_parse_and_map+0x34/0x3c [] omap_dm_timer_init_one+0x90/0x30c [] omap5_realtime_timer_init+0x8c/0x48c [] time_init+0x28/0x38 [] start_kernel+0x240/0x3dc [<80008084>] 0x80008084 } ... key at: [] irq_desc_lock_class+0x0/0x8 ... acquired at: [] _raw_spin_lock+0x48/0x58 [] pcs_irq_unmask+0x58/0xa0 [] irq_enable+0x38/0x48 [] irq_startup+0x78/0x7c [] __setup_irq+0x4a8/0x4f4 [] request_threaded_irq+0xb8/0x138 [] omap_8250_startup+0x4c/0x148 [] serial8250_startup+0x24/0x30 [] uart_startup.part.9+0x5c/0x1b4 [] uart_open+0xf4/0x16c [] tty_open+0x170/0x61c [] chrdev_open+0xbc/0x1b4 [] do_dentry_open+0x1e8/0x2bc [] finish_open+0x44/0x5c [] do_last.isra.47+0x710/0xca0 [] path_openat+0xc4/0x640 [] do_filp_open+0x3c/0x98 [] do_sys_open+0x114/0x1d8 [] SyS_open+0x28/0x2c [] kernel_init_freeable+0x168/0x1e4 [] kernel_init+0x1c/0xf8 [] ret_from_fork+0x14/0x20 -> (&pcs->lock){+.....} ops: 65 { HARDIRQ-ON-W at: [] lock_acquire+0x9c/0x158 [] _raw_spin_lock+0x48/0x58 [] pcs_irq_handle+0x48/0x9c [] pcs_irq_handler+0x1c/0x28 [] irq_forced_thread_fn+0x30/0x74 [] irq_thread+0x158/0x1c4 [] kthread+0xd4/0xe8 [] ret_from_fork+0x14/0x20 INITIAL USE at: [] lock_acquire+0x9c/0x158 [] _raw_spin_lock_irqsave+0x54/0x68 [] pcs_enable+0x7c/0xe8 [] pinmux_enable_setting+0x178/0x220 [] pinctrl_select_state+0x110/0x194 [] pinctrl_bind_pins+0x7c/0x108 [] driver_probe_device+0x70/0x254 [] __driver_attach+0x9c/0xa0 [] bus_for_each_dev+0x78/0xac [] driver_attach+0x2c/0x30 [] bus_add_driver+0x15c/0x204 [] driver_register+0x88/0x108 [] __platform_driver_register+0x64/0x6c [] omap_hsmmc_driver_init+0x1c/0x20 [] do_one_initcall+0x110/0x170 [] kernel_init_freeable+0x140/0x1e4 [] kernel_init+0x1c/0xf8 [] ret_from_fork+0x14/0x20 } ... key at: [] __key.18572+0x0/0x8 ... acquired at: [] mark_lock+0x388/0x76c [] __lock_acquire+0x6d0/0x1f98 [] lock_acquire+0x9c/0x158 [] _raw_spin_lock+0x48/0x58 [] pcs_irq_handle+0x48/0x9c [] pcs_irq_handler+0x1c/0x28 [] irq_forced_thread_fn+0x30/0x74 [] irq_thread+0x158/0x1c4 [] kthread+0xd4/0xe8 [] ret_from_fork+0x14/0x20 stack backtrace: CPU: 1 PID: 927 Comm: irq/369-pinctrl Not tainted 3.14.43-rt42-00360-g96ff499-dirty #24 [] (unwind_backtrace) from [] (show_stack+0x20/0x24) [] (show_stack) from [] (dump_stack+0x84/0xd0) [] (dump_stack) from [] (print_irq_inversion_bug+0x1d0/0x21c) [] (print_irq_inversion_bug) from [] (check_usage_backwards+0xb4/0x11c) [] (check_usage_backwards) from [] (mark_lock+0x388/0x76c) [] (mark_lock) from [] (__lock_acquire+0x6d0/0x1f98) [] (__lock_acquire) from [] (lock_acquire+0x9c/0x158) [] (lock_acquire) from [] (_raw_spin_lock+0x48/0x58) [] (_raw_spin_lock) from [] (pcs_irq_handle+0x48/0x9c) [] (pcs_irq_handle) from [] (pcs_irq_handler+0x1c/0x28) [] (pcs_irq_handler) from [] (irq_forced_thread_fn+0x30/0x74) [] (irq_forced_thread_fn) from [] (irq_thread+0x158/0x1c4) [] (irq_thread) from [] (kthread+0xd4/0xe8) [] (kthread) from [] (ret_from_fork+0x14/0x20) To fix it use IRQF_NO_THREAD to ensure that pcs irq will not be forced threaded. Cc: Tony Lindgren Cc: Sebastian Andrzej Siewior Signed-off-by: Grygorii Strashko --- drivers/pinctrl/pinctrl-single.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index b2de09d..0b8d480 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -1760,7 +1760,8 @@ static int pcs_irq_init_chained_handler(struct pcs_device *pcs, int res; res = request_irq(pcs_soc->irq, pcs_irq_handler, - IRQF_SHARED | IRQF_NO_SUSPEND, + IRQF_SHARED | IRQF_NO_SUSPEND | + IRQF_NO_THREAD, name, pcs_soc); if (res) { pcs_soc->irq = -1;