From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Lezcano Subject: Re: [PATCH 1/7] clocksource: mediatek: Don't run event_handler if it is NULL Date: Mon, 04 May 2015 10:44:18 +0200 Message-ID: <55473162.5010608@linaro.org> References: <1430466210-22963-1-git-send-email-yingjoe.chen@mediatek.com> <1430466210-22963-2-git-send-email-yingjoe.chen@mediatek.com> <55472A80.9020904@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Matthias Brugger Cc: Yingjoe Chen , Mark Rutland , Thomas Gleixner , Arnd Bergmann , Olof Johansson , Rob Herring , Pawel Moll , Ian Campbell , Russell King , Jason Cooper , Catalin Marinas , Marc Carino , Lorenzo Pieralisi , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, srv_heupstream , Sascha Hauer List-Id: linux-mediatek@lists.infradead.org On 05/04/2015 10:34 AM, Matthias Brugger wrote: > 2015-05-04 10:14 GMT+02:00 Daniel Lezcano = : >> On 05/01/2015 09:43 AM, Yingjoe Chen wrote: >>> >>> Spurious timer interrupt is noticed in mtk timer and cause kernel >>> crash. In mtk_timer_interrupt(), only run event_handler if it is >>> not NULL. >>> >>> Signed-off-by: Yingjoe Chen >>> --- >>> drivers/clocksource/mtk_timer.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clocksource/mtk_timer.c >>> b/drivers/clocksource/mtk_timer.c >>> index 68ab423..85e0ab5 100644 >>> --- a/drivers/clocksource/mtk_timer.c >>> +++ b/drivers/clocksource/mtk_timer.c >>> @@ -143,7 +143,8 @@ static irqreturn_t mtk_timer_interrupt(int irq,= void >>> *dev_id) >>> >>> /* Acknowledge timer0 irq */ >>> writel(GPT_IRQ_ACK(GPT_CLK_EVT), evt->gpt_base + GPT_IRQ_A= CK_REG); >>> - evt->dev.event_handler(&evt->dev); >>> + if (evt->dev.event_handler) >>> + evt->dev.event_handler(&evt->dev); >>> >>> return IRQ_HANDLED; >>> } >>> >> >> This fix does not look good. >> >> Could you try by requesting the irq *after* clockevents_config_and_r= egister >> in the init sequence [1] ? >> > > From my understanding [1] should already fix this. > > [1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.= git/commit/drivers/clocksource/mtk_timer.c?id=3Dd4a19eb3b15a4ba98f62718= 2f48d5bc0cffae670 Indeed it seems to fix it. But I think request_irq should be done after= =20 clockevents_config_and_register in any case. Yingjoe, are the spurious interrupts occurring with the fix Matthias=20 mentions ? --=20 Linaro.org =E2=94=82 Open source software fo= r ARM SoCs =46ollow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe devicetree" i= n the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: daniel.lezcano@linaro.org (Daniel Lezcano) Date: Mon, 04 May 2015 10:44:18 +0200 Subject: [PATCH 1/7] clocksource: mediatek: Don't run event_handler if it is NULL In-Reply-To: References: <1430466210-22963-1-git-send-email-yingjoe.chen@mediatek.com> <1430466210-22963-2-git-send-email-yingjoe.chen@mediatek.com> <55472A80.9020904@linaro.org> Message-ID: <55473162.5010608@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 05/04/2015 10:34 AM, Matthias Brugger wrote: > 2015-05-04 10:14 GMT+02:00 Daniel Lezcano : >> On 05/01/2015 09:43 AM, Yingjoe Chen wrote: >>> >>> Spurious timer interrupt is noticed in mtk timer and cause kernel >>> crash. In mtk_timer_interrupt(), only run event_handler if it is >>> not NULL. >>> >>> Signed-off-by: Yingjoe Chen >>> --- >>> drivers/clocksource/mtk_timer.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clocksource/mtk_timer.c >>> b/drivers/clocksource/mtk_timer.c >>> index 68ab423..85e0ab5 100644 >>> --- a/drivers/clocksource/mtk_timer.c >>> +++ b/drivers/clocksource/mtk_timer.c >>> @@ -143,7 +143,8 @@ static irqreturn_t mtk_timer_interrupt(int irq, void >>> *dev_id) >>> >>> /* Acknowledge timer0 irq */ >>> writel(GPT_IRQ_ACK(GPT_CLK_EVT), evt->gpt_base + GPT_IRQ_ACK_REG); >>> - evt->dev.event_handler(&evt->dev); >>> + if (evt->dev.event_handler) >>> + evt->dev.event_handler(&evt->dev); >>> >>> return IRQ_HANDLED; >>> } >>> >> >> This fix does not look good. >> >> Could you try by requesting the irq *after* clockevents_config_and_register >> in the init sequence [1] ? >> > > From my understanding [1] should already fix this. > > [1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/drivers/clocksource/mtk_timer.c?id=d4a19eb3b15a4ba98f627182f48d5bc0cffae670 Indeed it seems to fix it. But I think request_irq should be done after clockevents_config_and_register in any case. Yingjoe, are the spurious interrupts occurring with the fix Matthias mentions ? -- Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752260AbbEDIob (ORCPT ); Mon, 4 May 2015 04:44:31 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:33522 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751530AbbEDIoW (ORCPT ); Mon, 4 May 2015 04:44:22 -0400 Message-ID: <55473162.5010608@linaro.org> Date: Mon, 04 May 2015 10:44:18 +0200 From: Daniel Lezcano User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Matthias Brugger CC: Yingjoe Chen , Mark Rutland , Thomas Gleixner , Arnd Bergmann , Olof Johansson , Rob Herring , Pawel Moll , Ian Campbell , Russell King , Jason Cooper , Catalin Marinas , Marc Carino , Lorenzo Pieralisi , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , linux-mediatek@lists.infradead.org, srv_heupstream , Sascha Hauer Subject: Re: [PATCH 1/7] clocksource: mediatek: Don't run event_handler if it is NULL References: <1430466210-22963-1-git-send-email-yingjoe.chen@mediatek.com> <1430466210-22963-2-git-send-email-yingjoe.chen@mediatek.com> <55472A80.9020904@linaro.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/04/2015 10:34 AM, Matthias Brugger wrote: > 2015-05-04 10:14 GMT+02:00 Daniel Lezcano : >> On 05/01/2015 09:43 AM, Yingjoe Chen wrote: >>> >>> Spurious timer interrupt is noticed in mtk timer and cause kernel >>> crash. In mtk_timer_interrupt(), only run event_handler if it is >>> not NULL. >>> >>> Signed-off-by: Yingjoe Chen >>> --- >>> drivers/clocksource/mtk_timer.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/clocksource/mtk_timer.c >>> b/drivers/clocksource/mtk_timer.c >>> index 68ab423..85e0ab5 100644 >>> --- a/drivers/clocksource/mtk_timer.c >>> +++ b/drivers/clocksource/mtk_timer.c >>> @@ -143,7 +143,8 @@ static irqreturn_t mtk_timer_interrupt(int irq, void >>> *dev_id) >>> >>> /* Acknowledge timer0 irq */ >>> writel(GPT_IRQ_ACK(GPT_CLK_EVT), evt->gpt_base + GPT_IRQ_ACK_REG); >>> - evt->dev.event_handler(&evt->dev); >>> + if (evt->dev.event_handler) >>> + evt->dev.event_handler(&evt->dev); >>> >>> return IRQ_HANDLED; >>> } >>> >> >> This fix does not look good. >> >> Could you try by requesting the irq *after* clockevents_config_and_register >> in the init sequence [1] ? >> > > From my understanding [1] should already fix this. > > [1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/drivers/clocksource/mtk_timer.c?id=d4a19eb3b15a4ba98f627182f48d5bc0cffae670 Indeed it seems to fix it. But I think request_irq should be done after clockevents_config_and_register in any case. Yingjoe, are the spurious interrupts occurring with the fix Matthias mentions ? -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog