From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759231AbdAIK4c (ORCPT ); Mon, 9 Jan 2017 05:56:32 -0500 Received: from terminus.zytor.com ([198.137.202.10]:53740 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759167AbdAIK43 (ORCPT ); Mon, 9 Jan 2017 05:56:29 -0500 Date: Mon, 9 Jan 2017 02:55:35 -0800 From: tip-bot for Frederic Weisbecker Message-ID: Cc: mingo@kernel.org, fweisbec@gmail.com, linux-kernel@vger.kernel.org, bp@alien8.de, wanpeng.li@hotmail.com, viresh.kumar@linaro.org, hpa@zytor.com, tglx@linutronix.de Reply-To: wanpeng.li@hotmail.com, hpa@zytor.com, viresh.kumar@linaro.org, tglx@linutronix.de, mingo@kernel.org, fweisbec@gmail.com, linux-kernel@vger.kernel.org, bp@alien8.de In-Reply-To: <1483029949-6925-1-git-send-email-fweisbec@gmail.com> References: <1483029949-6925-1-git-send-email-fweisbec@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/apic] x86/apic: Implement set_state_oneshot_stopped() callback Git-Commit-ID: 914122c389d091a02f7b5476209af715e77ccb73 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: 914122c389d091a02f7b5476209af715e77ccb73 Gitweb: http://git.kernel.org/tip/914122c389d091a02f7b5476209af715e77ccb73 Author: Frederic Weisbecker AuthorDate: Thu, 29 Dec 2016 17:45:49 +0100 Committer: Thomas Gleixner CommitDate: Mon, 9 Jan 2017 11:48:42 +0100 x86/apic: Implement set_state_oneshot_stopped() callback When clock_event_device::set_state_oneshot_stopped() is not implemented, hrtimer_cancel() can't stop the clock when there is no more timer in the queue. So the ghost of the freshly cancelled hrtimer haunts us back later with an extra interrupt: -0 [002] d..2 2248.557659: hrtimer_cancel: hrtimer=ffff88021fa92d80 -0 [002] d.h1 2249.303659: local_timer_entry: vector=239 So let's implement this missing callback for the lapic clock. This consist in calling its set_state_shutdown() callback. There don't seem to be a lighter way to stop the clock. Simply writing 0 to APIC_TMICT won't be enough to stop the clock and avoid the extra interrupt, as opposed to what is specified in the specs. We must also mask the timer interrupt in the device. Signed-off-by: Frederic Weisbecker Cc: Borislav Petkov Reviewed-by: Wanpeng Li Reviewed-by: Viresh Kumar Link: http://lkml.kernel.org/r/1483029949-6925-1-git-send-email-fweisbec@gmail.com Signed-off-by: Thomas Gleixner --- arch/x86/kernel/apic/apic.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 5c4fdcf..fdb9c46 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -529,18 +529,19 @@ static void lapic_timer_broadcast(const struct cpumask *mask) * The local apic timer can be used for any function which is CPU local. */ static struct clock_event_device lapic_clockevent = { - .name = "lapic", - .features = CLOCK_EVT_FEAT_PERIODIC | - CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP - | CLOCK_EVT_FEAT_DUMMY, - .shift = 32, - .set_state_shutdown = lapic_timer_shutdown, - .set_state_periodic = lapic_timer_set_periodic, - .set_state_oneshot = lapic_timer_set_oneshot, - .set_next_event = lapic_next_event, - .broadcast = lapic_timer_broadcast, - .rating = 100, - .irq = -1, + .name = "lapic", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP + | CLOCK_EVT_FEAT_DUMMY, + .shift = 32, + .set_state_shutdown = lapic_timer_shutdown, + .set_state_periodic = lapic_timer_set_periodic, + .set_state_oneshot = lapic_timer_set_oneshot, + .set_state_oneshot_stopped = lapic_timer_shutdown, + .set_next_event = lapic_next_event, + .broadcast = lapic_timer_broadcast, + .rating = 100, + .irq = -1, }; static DEFINE_PER_CPU(struct clock_event_device, lapic_events);