Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965095AbbKDAHE (ORCPT ); Tue, 3 Nov 2015 19:07:04 -0500 Received: from mail-yk0-f169.google.com ([209.85.160.169]:34374 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753692AbbKDAHB (ORCPT ); Tue, 3 Nov 2015 19:07:01 -0500 Date: Tue, 3 Nov 2015 19:06:58 -0500 From: Tejun Heo To: Jeff Layton Cc: Chris Worley , linux-kernel@vger.kernel.org, bfields@fieldses.org, Michael Skralivetsky , Trond Myklebust , Shaohua Li Subject: Re: timer code oops when calling mod_delayed_work Message-ID: <20151104000658.GH5749@mtj.duckdns.org> References: <20151029135836.02ad9000@synchrony.poochiereds.net> <20151031020012.GH3582@mtj.duckdns.org> <20151031073400.2cf05d77@tlielax.poochiereds.net> <20151031213107.GA23841@mtj.duckdns.org> <20151031175404.3c57a17a@tlielax.poochiereds.net> <20151102145633.5329f3da@tlielax.poochiereds.net> <20151102203339.7ed8f2bb@synchrony.poochiereds.net> <20151103125504.6649138f@tlielax.poochiereds.net> <20151103225405.GG5749@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151103225405.GG5749@mtj.duckdns.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1210 Lines: 39 Hello, Jeff. Can you please verify whether the following patch fixes the issue? Thanks. diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 84190f0..566a282 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -970,12 +970,21 @@ EXPORT_SYMBOL(add_timer); */ void add_timer_on(struct timer_list *timer, int cpu) { - struct tvec_base *base = per_cpu_ptr(&tvec_bases, cpu); + struct tvec_base *new_base = per_cpu_ptr(&tvec_bases, cpu); + struct tvec_base *base; unsigned long flags; timer_stats_timer_set_start_info(timer); BUG_ON(timer_pending(timer) || !timer->function); - spin_lock_irqsave(&base->lock, flags); + + base = lock_timer_base(timer, &flags); + if (base != new_base) { + timer->flags |= TIMER_MIGRATING; + spin_unlock(&base->lock); + base = new_base; + spin_lock(&base->lock); + } + timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu; debug_activate(timer, timer->expires); internal_add_timer(base, timer); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/