From patchwork Wed Oct 28 01:43:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 7506121 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 3ADC0BEEA4 for ; Wed, 28 Oct 2015 01:42:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 484E420855 for ; Wed, 28 Oct 2015 01:42:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12B1C2084D for ; Wed, 28 Oct 2015 01:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754639AbbJ1Bmk (ORCPT ); Tue, 27 Oct 2015 21:42:40 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34240 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753044AbbJ1Bmj (ORCPT ); Tue, 27 Oct 2015 21:42:39 -0400 Received: by padhk11 with SMTP id hk11so239721721pad.1; Tue, 27 Oct 2015 18:42:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=P0IrrpYjn4VjxLa6ZCb1jLO6J6mnqyEpUr8vnqv9Fjw=; b=sHYe4YFV0Y8TnVT6cpXoNfk3CYRkKQByQ/0zsoSWgQWT63cg3op18SnapLzkQXgR5Q 7vcN49fAOBntWaZ+GbJEYdsK7gIlHtn3T9ko9Sfla4Qldm5S118NnIugFlR4Xc06mitJ Y6bBzehGaDSdl9u6zXXsrKFQ4v87l+zXL7Ia65Vo8CZMZucmlCyDzcj9dRRIjHyz/NuH zEroTk7JqELRAKLZtYnDpZhppP/TQH4Oksd/WZbWPxPCMpNqv61RPZk4QiuFhIMrES/e QRmKlRWnbJnoXQuNdY+Ggdi9PC/NmquGCm0ZPMRi9AVAGlb7D49XUJqBULegXk4WtB8q T7LA== X-Received: by 10.68.224.132 with SMTP id rc4mr5834070pbc.11.1445996559250; Tue, 27 Oct 2015 18:42:39 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id d2sm26960490pat.24.2015.10.27.18.42.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2015 18:42:37 -0700 (PDT) From: Magnus Damm To: daniel.lezcano@linaro.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, linux-sh@vger.kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org, chris.brandt@renesas.com, horms+renesas@verge.net.au, Magnus Damm , tglx@linutronix.de Date: Wed, 28 Oct 2015 10:43:23 +0900 Message-Id: <20151028014323.29894.70699.sendpatchset@little-apple> Subject: [PATCH] clocksource: sh_mtu2: Fix multiple shutdown call issue 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Magnus Damm On the r7s72100 Genmai board the MTU2 driver currently triggers a common clock framework WARN_ON(enable_count) when disabling the clock due to the MTU2 driver after recent callback rework may call ->set_state_shutdown() multiple times. A similar issue was spotted for the TMU driver and fixed in: 452b132 clocksource/drivers/sh_tmu: Fix traceback spotted in -next On r7s72100 Genmai v4.3-rc7 built with shmobile_defconfig spits out the following during boot: sh_mtu2 fcff0000.timer: ch0: used for clock events ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:675 clk_core_disable+0x2c/0x6c() CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-rc7 #1 Hardware name: Generic R7S72100 (Flattened Device Tree) Backtrace: [] (dump_backtrace) from [] (show_stack+0x18/0x1c) r6:c0621fde r5:00000009 r4:00000000 r3:00200040 [] (show_stack) from [] (dump_stack+0x74/0x90) [] (dump_stack) from [] (warn_slowpath_common+0x88/0xb4) r4:00000000 r3:00000000 [] (warn_slowpath_common) from [] (warn_slowpath_null+0x24/0x2c) r8:c78c0400 r7:c7ee8df8 r6:00000000 r5:600001d3 r4:c7806480 [] (warn_slowpath_null) from [] (clk_core_disable+0x2c/0x6c) [] (clk_core_disable) from [] (clk_disable+0x40/0x4c) r4:c791be40 r3:00000000 [] (clk_disable) from [] (sh_mtu2_disable+0x24/0x50) r5:00000001 r4:c7963c00 [] (sh_mtu2_disable) from [] (sh_mtu2_clock_event_shutdown+0x14/0x1c) r4:c7963c40 r3:c0395d58 [] (sh_mtu2_clock_event_shutdown) from [] (clockevents_switch_state+0xc8/0x114) [] (clockevents_switch_state) from [] (clockevents_shutdown+0x18/0x28) r5:c7963c40 r4:c7963c40 [] (clockevents_shutdown) from [] (clockevents_exchange_device+0x70/0x78) r4:00000000 r3:00000000 [] (clockevents_exchange_device) from [] (tick_check_new_device+0x88/0xe0) r5:00000000 r4:c7963c40 [] (tick_check_new_device) from [] (clockevents_register_device+0xac/0x120) r7:00000000 r6:a0000153 r5:c06ffe98 r4:c7963c40 [] (clockevents_register_device) from [] (sh_mtu2_probe+0x230/0x350) r6:00000000 r5:c7963c00 r4:c791b040 r3:c06ff134 [] (sh_mtu2_probe) from [] (platform_drv_probe+0x50/0x98) Reported-by: Chris Brandt Fixes: 19a9ffb ("clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface") Cc: Viresh Kumar Cc: Laurent Pinchart Signed-off-by: Magnus Damm Reviewed-by: Viresh Kumar - Acked-by: Laurent Pinchart --- drivers/clocksource/sh_mtu2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/clocksource/sh_mtu2.c +++ work/drivers/clocksource/sh_mtu2.c 2015-10-27 16:20:07.350513000 +0900 @@ -280,7 +280,9 @@ static int sh_mtu2_clock_event_shutdown( { struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced); - sh_mtu2_disable(ch); + if (clockevent_state_periodic(ced)) + sh_mtu2_disable(ch); + return 0; }