From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751978AbdJPJav (ORCPT ); Mon, 16 Oct 2017 05:30:51 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50280 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751358AbdJPJau (ORCPT ); Mon, 16 Oct 2017 05:30:50 -0400 Date: Mon, 16 Oct 2017 11:30:47 +0200 (CEST) From: Thomas Gleixner To: David Kozub cc: Daniel Lezcano , linux-kernel@vger.kernel.org Subject: Re: PROBLEM: Kernel BUG in mfgpt_tick (cs5535-clockevt.c) on ALIX 2c3 - null call In-Reply-To: Message-ID: References: <8de07c60-8d37-802a-837c-a6cf356d1535@linaro.org> <29c0b5e6-3285-a307-4045-6b2b9f9747d6@linaro.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 12 Oct 2017, David Kozub wrote: > On Thu, 12 Oct 2017, Thomas Gleixner wrote: > > On Thu, 12 Oct 2017, Daniel Lezcano wrote: > > The real question is why > > > > /* Set the clock scale and enable the event mode for CMP2 */ > > val = MFGPT_SCALE | (3 << 8); > > > > cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, val); > > > > is in the setup code at all. > > > > The obvious place for this is in mfgpt_set_periodic() which gets called > > when the clock event and the handler is set up in the core code. Up to that > > point the interrupt handler is protected against shared interrupts via the > > is_shutdown() check. > > It is, but only after clockevents_config_and_register. But mfgpt_tick is > called before that (just after setup_irq). Right, but the protection against the spurious interrupt there is not sufficient. See patch below. Thanks, tglx 8<------------------- --- a/drivers/clocksource/cs5535-clockevt.c +++ b/drivers/clocksource/cs5535-clockevt.c @@ -117,7 +117,8 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) /* Turn off the clock (and clear the event) */ disable_timer(cs5535_event_clock); - if (clockevent_state_shutdown(&cs5535_clockevent)) + if (clockevent_state_detached(&cs5535_clockevent) || + clockevent_state_shutdown(&cs5535_clockevent)) return IRQ_HANDLED; /* Clear the counter */