From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932736AbbGGRPz (ORCPT ); Tue, 7 Jul 2015 13:15:55 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36466 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932198AbbGGRPt (ORCPT ); Tue, 7 Jul 2015 13:15:49 -0400 Date: Tue, 7 Jul 2015 10:15:13 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, avg@FreeBSD.org, preeti@linux.vnet.ibm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, peterz@infradead.org Reply-To: hpa@zytor.com, tglx@linutronix.de, preeti@linux.vnet.ibm.com, avg@FreeBSD.org, mingo@kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, peterz@infradead.org In-Reply-To: <20150705205221.802094647@linutronix.de> References: <20150705205221.802094647@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] tick/broadcast: Handle spurious interrupts gracefully Git-Commit-ID: c4288334818c81c946acb23d2319881f58c3d497 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c4288334818c81c946acb23d2319881f58c3d497 Gitweb: http://git.kernel.org/tip/c4288334818c81c946acb23d2319881f58c3d497 Author: Thomas Gleixner AuthorDate: Sun, 5 Jul 2015 20:53:17 +0000 Committer: Thomas Gleixner CommitDate: Tue, 7 Jul 2015 18:46:48 +0200 tick/broadcast: Handle spurious interrupts gracefully Andriy reported that on a virtual machine the warning about negative expiry time in the clock events programming code triggered: hpet: hpet0 irq 40 for MSI hpet: hpet1 irq 41 for MSI Switching to clocksource hpet WARNING: at kernel/time/clockevents.c:239 [] clockevents_program_event+0xdb/0xf0 [] tick_handle_periodic_broadcast+0x41/0x50 [] timer_interrupt+0x15/0x20 When the second hpet is installed as a per cpu timer the broadcast event is not longer required and stopped, which sets the next_evt of the broadcast device to KTIME_MAX. If after that a spurious interrupt happens on the broadcast device, then the current code blindly handles it and tries to reprogram the broadcast device afterwards, which adds the period to next_evt. KTIME_MAX + period results in a negative expiry value causing the WARN_ON in the clockevents code to trigger. Add a proper check for the state of the broadcast device into the interrupt handler and return if the interrupt is spurious. [ Folded in pointer fix from Sudeep ] Reported-by: Andriy Gapon Signed-off-by: Thomas Gleixner Cc: Sudeep Holla Cc: Peter Zijlstra Cc: Preeti U Murthy Link: http://lkml.kernel.org/r/20150705205221.802094647@linutronix.de --- kernel/time/tick-broadcast.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index c8d731a..ee3cf94 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -316,6 +316,13 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev) bool bc_local; raw_spin_lock(&tick_broadcast_lock); + + /* Handle spurious interrupts gracefully */ + if (clockevent_state_shutdown(tick_broadcast_device.evtdev)) { + raw_spin_unlock(&tick_broadcast_lock); + return; + } + bc_local = tick_do_periodic_broadcast(); if (clockevent_state_oneshot(dev)) {