From patchwork Wed Sep 25 14:49:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 2942571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 01F279F2B8 for ; Wed, 25 Sep 2013 14:50:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C10F2034E for ; Wed, 25 Sep 2013 14:50:34 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D2D32034D for ; Wed, 25 Sep 2013 14:50:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOqQ8-0000fD-W6; Wed, 25 Sep 2013 14:50:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOqQ6-000354-Gp; Wed, 25 Sep 2013 14:50:26 +0000 Received: from mail-pb0-x236.google.com ([2607:f8b0:400e:c01::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VOqQ3-00033N-2I for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2013 14:50:24 +0000 Received: by mail-pb0-f54.google.com with SMTP id ro12so6102529pbb.13 for ; Wed, 25 Sep 2013 07:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=tfI8VQSjBm4StPtd6l3s36YTaD/gwH8xROsHi4TUbQI=; b=BCgWI/q1hsuOY3zP9pwYQISxWZQLMlo/o0/qFb4deLGcv4NzTs4Vlcm0GKGmvO2Stz UIcSs5ZV+ZGhUbaCX0HoYTEZHcdq/zjaG6hDXScfG7Nu+SSy1shzyFTizKZaxps3GEQ7 KI/WAFvsBZHn6c+QFhw9MJvfBwtWxWeKwkhIqX0KGcRi6gJ05NBtBGuSCncy8Qv9PyYw Lnfu3BXZbZ25dzsZmeETbNLykgwv62+CTxG12pEuDnevqp+98tAsxHDZ5YTeKlzVxIqP aUtalkvTcSMQzP59ndRc7ee1ewEio8q2cYohECDBIhYVDVqUz6OuZ8o67tr/vMs3twkG 5M1Q== X-Received: by 10.68.196.227 with SMTP id ip3mr12473613pbc.163.1380120600904; Wed, 25 Sep 2013 07:50:00 -0700 (PDT) Received: from localhost ([183.49.45.123]) by mx.google.com with ESMTPSA id om2sm48149464pbc.30.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 25 Sep 2013 07:50:00 -0700 (PDT) From: Ming Lei To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] clockevent: exynos_mct: fix lockdep warning Date: Wed, 25 Sep 2013 22:49:38 +0800 Message-Id: <1380120578-17458-1-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130925_105023_223677_021B4C0B X-CRM114-Status: GOOD ( 14.80 ) X-Spam-Score: -2.0 (--) Cc: Ming Lei , Thomas Gleixner , Daniel Lezcano , Kukjin Kim , linux-samsung-soc@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 This patch moves request_irq() out of cpu notifier callback to fix below lockdep warning: [ 0.249513] ------------[ cut here ]------------ [ 0.249525] WARNING: CPU: 1 PID: 0 at kernel/lockdep.c:2740 lockdep_trace_alloc+0xc8/0x10c() [ 0.249534] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) [ 0.249538] Modules linked in: [ 0.249548] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.12.0-rc1-next-20130923+ #338 [ 0.249564] [] (unwind_backtrace+0x0/0xec) from [] (show_stack+0x20/0x24) [ 0.249577] [] (show_stack+0x20/0x24) from [] (dump_stack+0x74/0xb4) [ 0.249591] [] (dump_stack+0x74/0xb4) from [] (warn_slowpath_common+0x78/0x9c) [ 0.249604] [] (warn_slowpath_common+0x78/0x9c) from [] (warn_slowpath_fmt+0x40/0x48) [ 0.249615] [] (warn_slowpath_fmt+0x40/0x48) from [] (lockdep_trace_alloc+0xc8/0x10c) [ 0.249626] [] (lockdep_trace_alloc+0xc8/0x10c) from [] (kmem_cache_alloc_trace+0x38/0x2 24) [ 0.249638] [] (kmem_cache_alloc_trace+0x38/0x224) from [] (request_threaded_irq+0x90/0x130) [ 0.249651] [] (request_threaded_irq+0x90/0x130) from [] (exynos4_local_timer_setup+0xdc/0x140) [ 0.249663] [] (exynos4_local_timer_setup+0xdc/0x140) from [] (exynos4_mct_cpu_notify+0x40/0xb0) [ 0.249675] [] (exynos4_mct_cpu_notify+0x40/0xb0) from [] (notifier_call_chain+0x48/0x78) [ 0.249688] [] (notifier_call_chain+0x48/0x78) from [] (__raw_notifier_call_chain+0x24/0x2c) [ 0.249700] [] (__raw_notifier_call_chain+0x24/0x2c) from [] (__cpu_notify+0x3c/0x58) [ 0.249713] [] (__cpu_notify+0x3c/0x58) from [] (cpu_notify+0x20/0x24) [ 0.249725] [] (cpu_notify+0x20/0x24) from [] (notify_cpu_starting+0x58/0x60) [ 0.249737] [] (notify_cpu_starting+0x58/0x60) from [] (secondary_start_kernel+0xec/0x13 8) [ 0.249748] [] (secondary_start_kernel+0xec/0x138) from [<40008664>] (0x40008664) [ 0.249767] ---[ end trace 3406ff24bd97382e ]--- Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Kukjin Kim Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Signed-off-by: Ming Lei --- drivers/clocksource/exynos_mct.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 5b34768..94b35aa 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -419,19 +419,10 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); - if (mct_int_type == MCT_INT_SPI) { - evt->irq = mct_irqs[MCT_L0_IRQ + cpu]; - if (request_irq(evt->irq, exynos4_mct_tick_isr, - IRQF_TIMER | IRQF_NOBALANCING, - evt->name, mevt)) { - pr_err("exynos-mct: cannot register IRQ %d\n", - evt->irq); - return -EIO; - } - irq_set_affinity(evt->irq, cpumask_of(cpu)); - } else { + if (mct_int_type == MCT_INT_PPI) enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); - } + else + enable_irq(evt->irq); return 0; } @@ -440,7 +431,7 @@ static void exynos4_local_timer_stop(struct clock_event_device *evt) { evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); if (mct_int_type == MCT_INT_SPI) - free_irq(evt->irq, this_cpu_ptr(&percpu_mct_tick)); + disable_irq(evt->irq); else disable_percpu_irq(mct_irqs[MCT_L0_IRQ]); } @@ -500,6 +491,23 @@ static void __init exynos4_timer_resources(struct device_node *np, void __iomem &percpu_mct_tick); WARN(err, "MCT: can't request IRQ %d (%d)\n", mct_irqs[MCT_L0_IRQ], err); + } else { + int cpu; + + for_each_possible_cpu(cpu) { + struct mct_clock_event_device *mevt = + &per_cpu(percpu_mct_tick, cpu); + + mevt->evt.irq = mct_irqs[MCT_L0_IRQ + cpu]; + if (request_irq(mevt->evt.irq, exynos4_mct_tick_isr, + IRQF_TIMER | IRQF_NOBALANCING, + mevt->evt.name, mevt)) { + WARN(1, "exynos-mct: cannot register IRQ %d\n", + mevt->evt.irq); + } + irq_set_affinity(mevt->evt.irq, cpumask_of(cpu)); + disable_irq(mevt->evt.irq); + } } err = register_cpu_notifier(&exynos4_mct_cpu_nb);