From patchwork Wed Sep 9 11:42:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 7145981 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 CCBC89F32B for ; Wed, 9 Sep 2015 11:44:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E308120977 for ; Wed, 9 Sep 2015 11:44:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F137C204D8 for ; Wed, 9 Sep 2015 11:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754956AbbIILn2 (ORCPT ); Wed, 9 Sep 2015 07:43:28 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:44016 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753424AbbIILmy (ORCPT ); Wed, 9 Sep 2015 07:42:54 -0400 Received: from ayla.of.borg ([84.195.106.123]) by baptiste.telenet-ops.be with bizsmtp id Ezis1r0042fm56U01zis8g; Wed, 09 Sep 2015 13:42:52 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1ZZdm7-00081E-R0; Wed, 09 Sep 2015 13:42:52 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1ZZdmC-0006hU-M5; Wed, 09 Sep 2015 13:42:56 +0200 From: Geert Uytterhoeven To: Thomas Gleixner , Jason Cooper Cc: Grygorii Strashko , Magnus Damm , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] irqchip: renesas-irqc: Use a separate lockdep class Date: Wed, 9 Sep 2015 13:42:53 +0200 Message-Id: <1441798974-25716-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441798974-25716-1-git-send-email-geert+renesas@glider.be> References: <1441798974-25716-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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 The renesas-irqc interrupt controller is cascaded to the GIC. Hence when propagating wake-up settings to its parent interrupt controller, the following lockdep warning is printed: ============================================= [ INFO: possible recursive locking detected ] 4.2.0-ape6evm-10725-g50fcd7643c034198 #280 Not tainted --------------------------------------------- s2ram/1072 is trying to acquire lock: (&irq_desc_lock_class){-.-...}, at: [] __irq_get_desc_lock+0x58/0x98 but task is already holding lock: (&irq_desc_lock_class){-.-...}, at: [] __irq_get_desc_lock+0x58/0x98 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&irq_desc_lock_class); lock(&irq_desc_lock_class); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by s2ram/1072: #0: (sb_writers#7){.+.+.+}, at: [] __sb_start_write+0xa0/0xa8 #1: (&of->mutex){+.+.+.}, at: [] kernfs_fop_write+0x4c/0x1bc #2: (s_active#24){.+.+.+}, at: [] kernfs_fop_write+0x54/0x1bc #3: (pm_mutex){+.+.+.}, at: [] pm_suspend+0x10c/0x510 #4: (&dev->mutex){......}, at: [] __device_suspend+0xdc/0x2cc #5: (&irq_desc_lock_class){-.-...}, at: [] __irq_get_desc_lock+0x58/0x98 stack backtrace: CPU: 0 PID: 1072 Comm: s2ram Not tainted 4.2.0-ape6evm-10725-g50fcd7643c034198 #280 Hardware name: Generic R8A73A4 (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x88/0x98) [] (dump_stack) from [] (__lock_acquire+0x15cc/0x20e4) [] (__lock_acquire) from [] (lock_acquire+0xac/0x12c) [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x40/0x54) [] (_raw_spin_lock_irqsave) from [] (__irq_get_desc_lock+0x58/0x98) [] (__irq_get_desc_lock) from [] (irq_set_irq_wake+0x20/0xf8) [] (irq_set_irq_wake) from [] (irqc_irq_set_wake+0x20/0x4c) [] (irqc_irq_set_wake) from [] (irq_set_irq_wake+0x8c/0xf8) [] (irq_set_irq_wake) from [] (gpio_keys_suspend+0x74/0xc0) [] (gpio_keys_suspend) from [] (dpm_run_callback+0x54/0x124) Avoid this false positive by using a separate lockdep class for IRQC interrupts. Signed-off-by: Geert Uytterhoeven --- drivers/irqchip/irq-renesas-irqc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/irqchip/irq-renesas-irqc.c b/drivers/irqchip/irq-renesas-irqc.c index 49f6c41d94f91d4d..35bf97ba4a3d196d 100644 --- a/drivers/irqchip/irq-renesas-irqc.c +++ b/drivers/irqchip/irq-renesas-irqc.c @@ -153,6 +153,12 @@ static irqreturn_t irqc_irq_handler(int irq, void *dev_id) return IRQ_NONE; } +/* + * This lock class tells lockdep that IRQC irqs are in a different + * category than their parents, so it won't report false recursion. + */ +static struct lock_class_key irqc_irq_lock_class; + static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq, irq_hw_number_t hw) { @@ -160,6 +166,7 @@ static int irqc_irq_domain_map(struct irq_domain *h, unsigned int virq, irqc_dbg(&p->irq[hw], "map"); irq_set_chip_data(virq, h->host_data); + irq_set_lockdep_class(virq, &irqc_irq_lock_class); irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); return 0; }