All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, prarit@redhat.com
Cc: tip-bot for Thomas Gleixner <tipbot@zytor.com>,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:timers/urgent] tick: Cleanup NOHZ per cpu data on cpu down
Date: Sun, 05 May 2013 15:54:25 -0400	[thread overview]
Message-ID: <5186B8F1.9090105@redhat.com> (raw)
In-Reply-To: <tip-ae7868e241c015aadc8632d9fe633a102a5918f6@git.kernel.org>



On 05/05/2013 02:20 AM, tip-bot for Thomas Gleixner wrote:
> Commit-ID:  ae7868e241c015aadc8632d9fe633a102a5918f6
> Gitweb:     http://git.kernel.org/tip/ae7868e241c015aadc8632d9fe633a102a5918f6
> Author:     Thomas Gleixner <tglx@linutronix.de>
> AuthorDate: Fri, 3 May 2013 15:02:50 +0200
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Sun, 5 May 2013 08:15:11 +0200
> 
> tick: Cleanup NOHZ per cpu data on cpu down
> 
> Prarit reported a crash on CPU offline/online. The reason is that on
> CPU down the NOHZ related per cpu data of the dead cpu is not cleaned
> up. If at cpu online an interrupt happens before the per cpu tick
> device is registered the irq_enter() check potentially sees stale data
> and dereferences a NULL pointer.
> 
> Cleanup the data after the cpu is dead.
> 
> Reported-by: Prarit Bhargava <prarit@redhat.com>
> Cc: stable@vger.kernel.org
> Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1305031451561.2886@ionos
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  kernel/time/tick-common.c   | 1 +
>  kernel/time/tick-internal.h | 6 ++++++
>  kernel/time/tick-sched.c    | 7 +++++++
>  3 files changed, 14 insertions(+)

Whoa -- I thought I said I'll test this first.  It doesn't work :( so that means
something else is wrong ... I'm in the middle of debug ATM.

P.

> 
> diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
> index 6176a3e..29b765d 100644
> --- a/kernel/time/tick-common.c
> +++ b/kernel/time/tick-common.c
> @@ -387,6 +387,7 @@ static int tick_notify(struct notifier_block *nb, unsigned long reason,
>  		tick_shutdown_broadcast_oneshot(dev);
>  		tick_shutdown_broadcast(dev);
>  		tick_shutdown(dev);
> +		tick_shutdown_nohz(dev);
>  		break;
>  
>  	case CLOCK_EVT_NOTIFY_SUSPEND:
> diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
> index f0299ea..9644b29 100644
> --- a/kernel/time/tick-internal.h
> +++ b/kernel/time/tick-internal.h
> @@ -144,3 +144,9 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
>  #endif
>  
>  extern void do_timer(unsigned long ticks);
> +
> +#ifdef CONFIG_NO_HZ
> +extern void tick_shutdown_nohz(unsigned int *cpup);
> +#else
> +static inline void tick_shutdown_nohz(unsigned int *cpup) { }
> +#endif
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 225f8bf..e985ccd 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -797,6 +797,13 @@ static inline void tick_check_nohz(int cpu)
>  	}
>  }
>  
> +void tick_shutdown_nohz(unsigned int *cpup)
> +{
> +	struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
> +
> +	memset(ts, 0, sizeof(*ts));
> +}
> +
>  #else
>  
>  static inline void tick_nohz_switch_to_nohz(void) { }

  reply	other threads:[~2013-05-05 19:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 12:36 [PATCH] NOHZ, check to see if tick device is initialized in IRQ handling path Prarit Bhargava
2013-05-02 22:51 ` Tony Luck
2013-05-02 22:56 ` Thomas Gleixner
2013-05-03  8:10   ` Thomas Gleixner
2013-05-03 12:34     ` Prarit Bhargava
2013-05-03 13:02       ` Thomas Gleixner
2013-05-03 13:43         ` Prarit Bhargava
2013-05-05  6:20         ` [tip:timers/urgent] tick: Cleanup NOHZ per cpu data on cpu down tip-bot for Thomas Gleixner
2013-05-05 19:54           ` Prarit Bhargava [this message]
2013-05-06  8:48             ` Thomas Gleixner
2013-05-05 12:48         ` tip-bot for Thomas Gleixner
2013-05-05 14:14         ` tip-bot for Thomas Gleixner
2013-05-12 10:27         ` tip-bot for Thomas Gleixner
2013-05-13 14:51           ` Prarit Bhargava
2013-05-13 19:10             ` Thomas Gleixner
2013-05-14 13:48               ` Prarit Bhargava

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=5186B8F1.9090105@redhat.com \
    --to=prarit@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tipbot@zytor.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.