LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yong Zhang <yong.zhang0@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>, Tejun Heo <tj@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>,
	Faisal Latif <faisal.latif@intel.com>,
	Roland Dreier <roland@kernel.org>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Alessandro Rubini <rubini@cvml.unipv.it>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
	"David S. Miller" <davem@davemloft.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH 1/4] lockdep, timer: Fix del_timer_sync() annotation
Date: Fri, 4 Feb 2011 11:28:34 +0800	[thread overview]
Message-ID: <20110204032834.GA2791@zhy> (raw)
In-Reply-To: <20110203141548.039540914@chello.nl>

On Thu, Feb 03, 2011 at 03:09:41PM +0100, Peter Zijlstra wrote:
> Calling local_bh_enable() will want to actually start processing
> softirqs, which isn't a good idea since this can get called with IRQs
> disabled.
> 
> Cure this by using _local_bh_enable() which doesn't start processing
> softirqs, and use raw_local_irq_save() to avoid any softirqs from
> happending without letting lockdep think IRQs are in fact disabled.
> 
> Reported-by: Nick Bowler <nbowler@elliptictech.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> LKML-Reference: <new-submission>
> ---
>  kernel/timer.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/kernel/timer.c
> ===================================================================
> --- linux-2.6.orig/kernel/timer.c
> +++ linux-2.6/kernel/timer.c
> @@ -969,10 +969,14 @@ EXPORT_SYMBOL(try_to_del_timer_sync);
>  int del_timer_sync(struct timer_list *timer)
>  {
>  #ifdef CONFIG_LOCKDEP
> +	unsigned long flags;
> +
> +	raw_local_irq_save(flags);
>  	local_bh_disable();
>  	lock_map_acquire(&timer->lockdep_map);
>  	lock_map_release(&timer->lockdep_map);
> -	local_bh_enable();
> +	_local_bh_enable();
> +	raw_local_irq_restore(flags);

This is more cheap than what I have done ;)
I think it will cure the issue reported by Nick.
Thanks you anyway.

Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>

  parent reply	other threads:[~2011-02-04  3:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 14:09 [PATCH 0/4] del_timer_sync() and queue_delayed_work() Peter Zijlstra
2011-02-03 14:09 ` [PATCH 1/4] lockdep, timer: Fix del_timer_sync() annotation Peter Zijlstra
2011-02-03 15:35   ` Thomas Gleixner
2011-02-05  1:07     ` Nick Bowler
2011-02-04  3:28   ` Yong Zhang [this message]
2011-02-04  9:34   ` [tip:timers/urgent] " tip-bot for Peter Zijlstra
2011-02-03 14:09 ` [PATCH 2/4] timer: Provide mod_timer_on() Peter Zijlstra
2011-02-03 14:09 ` [PATCH 3/4] workqueue: Use mod_timer for queue_delayed_work() Peter Zijlstra
2011-02-03 14:09 ` [PATCH 4/4] workqueue: Remove now superfluous cancel_delayed_work() calls Peter Zijlstra
2011-02-03 16:19   ` Tejun Heo
2011-02-03 16:45     ` Dmitry Torokhov
2011-02-03 17:45     ` Peter Zijlstra
2011-02-04 11:13       ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110204032834.GA2791@zhy \
    --to=yong.zhang0@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=faisal.latif@intel.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mfasheh@suse.com \
    --cc=roland@kernel.org \
    --cc=rubini@cvml.unipv.it \
    --cc=sean.hefty@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --subject='Re: [PATCH 1/4] lockdep, timer: Fix del_timer_sync() annotation' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).