From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756210AbbDOPy0 (ORCPT ); Wed, 15 Apr 2015 11:54:26 -0400 Received: from www.linutronix.de ([62.245.132.108]:40955 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755795AbbDOPyT (ORCPT ); Wed, 15 Apr 2015 11:54:19 -0400 Date: Wed, 15 Apr 2015 17:54:34 +0200 (CEST) From: Thomas Gleixner To: Viresh Kumar cc: Ingo Molnar , Peter Zijlstra , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Steven Miao Subject: Re: [PATCH 1/2] timer: Avoid waking up an idle-core by migrate running timer In-Reply-To: <80182e47a7103608d2ddab7f62c0c3dffc99fdcc.1427782893.git.viresh.kumar@linaro.org> Message-ID: References: <80182e47a7103608d2ddab7f62c0c3dffc99fdcc.1427782893.git.viresh.kumar@linaro.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 31 Mar 2015, Viresh Kumar wrote: > @@ -1213,6 +1249,25 @@ static inline void __run_timers(struct tvec_base *base) > call_timer_fn(timer, fn, data); > spin_lock_irq(&base->lock); > } > + > + /* > + * Handler running on this base, re-queued itself on > + * another base ? > + */ > + if (unlikely(timer->base != base)) { > + unsigned long flags; > + struct tvec_base *tbase; > + > + spin_unlock(&base->lock); > + > + tbase = lock_timer_base(timer, &flags); > + timer_clear_running(timer); > + spin_unlock(&tbase->lock); > + > + spin_lock(&base->lock); > + } else { > + timer_clear_running(timer); > + } And just for the record: Dereferencing timer _AFTER_ the callback function is a big NONO. The callback function is allowed to free the timer. See the comment in call_timer_fn() Oh well, tglx