All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Clark Williams <williams@redhat.com>,
	Gregory Haskins <ghaskins@novell.com>,
	Gautham R Shenoy <ego@in.ibm.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH -rt 4/5] rcu: backport RCU cpu hotplug support
Date: Tue, 10 Jun 2008 08:15:44 -0700	[thread overview]
Message-ID: <20080610151544.GC15481@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080610111832.882895861@chello.nl>

On Tue, Jun 10, 2008 at 01:13:03PM +0200, Peter Zijlstra wrote:
> backport the RCU cpu-hotplug support from .26-rc to .24-rt

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> ---
>  kernel/rcupreempt.c |   58 +++++++++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 55 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.24.7.noarch/kernel/rcupreempt.c
> ===================================================================
> --- linux-2.6.24.7.noarch.orig/kernel/rcupreempt.c
> +++ linux-2.6.24.7.noarch/kernel/rcupreempt.c
> @@ -820,6 +820,13 @@ void rcu_offline_cpu_rt(int cpu)
>  		smp_mb();  /* Subsequent RCU read-side critical sections */
>  			   /*  seen -after- acknowledgement. */
>  	}
> +
> +	__get_cpu_var(rcu_flipctr)[0] += per_cpu(rcu_flipctr, cpu)[0];
> +	__get_cpu_var(rcu_flipctr)[1] += per_cpu(rcu_flipctr, cpu)[1];
> +
> +	per_cpu(rcu_flipctr, cpu)[0] = 0;
> +	per_cpu(rcu_flipctr, cpu)[1] = 0;
> +
>  	cpu_clear(cpu, rcu_cpu_online_map);
>  	spin_unlock_irqrestore(&rcu_ctrlblk.fliplock, oldirq);
> 
> @@ -833,8 +840,9 @@ void rcu_offline_cpu_rt(int cpu)
>  	 * fix.
>  	 */
> 
> +	local_irq_save(oldirq);
>  	rdp = RCU_DATA_ME();
> -	spin_lock_irqsave(&rdp->lock, oldirq);
> +	spin_lock(&rdp->lock);
>  	*rdp->nexttail = list;
>  	if (list)
>  		rdp->nexttail = tail;
> @@ -866,9 +874,11 @@ void rcu_process_callbacks_rt(struct sof
>  {
>  	unsigned long flags;
>  	struct rcu_head *next, *list;
> -	struct rcu_data *rdp = RCU_DATA_ME();
> +	struct rcu_data *rdp;
> 
> -	spin_lock_irqsave(&rdp->lock, flags);
> +	local_irq_save(flags);
> +	rdp = RCU_DATA_ME();
> +	spin_lock(&rdp->lock);
>  	list = rdp->donelist;
>  	if (list == NULL) {
>  		spin_unlock_irqrestore(&rdp->lock, flags);
> @@ -951,6 +961,32 @@ int rcu_pending_rt(int cpu)
>  	return 0;
>  }
> 
> +static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
> +                                unsigned long action, void *hcpu)
> +{
> +        long cpu = (long)hcpu;
> +
> +        switch (action) {
> +        case CPU_UP_PREPARE:
> +        case CPU_UP_PREPARE_FROZEN:
> +                rcu_online_cpu_rt(cpu);
> +                break;
> +        case CPU_UP_CANCELED:
> +        case CPU_UP_CANCELED_FROZEN:
> +        case CPU_DEAD:
> +        case CPU_DEAD_FROZEN:
> +                rcu_offline_cpu_rt(cpu);
> +                break;
> +        default:
> +                break;
> +        }
> +        return NOTIFY_OK;
> +}
> +
> +static struct notifier_block __cpuinitdata rcu_nb = {
> +        .notifier_call = rcu_cpu_notify,
> +};
> +
>  void __init rcu_init_rt(void)
>  {
>  	int cpu;
> @@ -972,6 +1008,22 @@ void __init rcu_init_rt(void)
>  		rdp->donetail = &rdp->donelist;
>  	}
>  	rcu_preempt_boost_init();
> +	register_cpu_notifier(&rcu_nb);
> +
> +	/*
> +         * We don't need protection against CPU-Hotplug here
> +         * since
> +         * a) If a CPU comes online while we are iterating over the
> +         *    cpu_online_map below, we would only end up making a
> +         *    duplicate call to rcu_online_cpu() which sets the corresponding
> +         *    CPU's mask in the rcu_cpu_online_map.
> +         *
> +         * b) A CPU cannot go offline at this point in time since the user
> +         *    does not have access to the sysfs interface, nor do we
> +         *    suspend the system.
> +         */
> +        for_each_online_cpu(cpu)
> +                rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, (void *)(long) cpu);
>  }
> 
>  /*
> 
> -- 
> 

  reply	other threads:[~2008-06-10 15:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-10 11:12 [PATCH -rt 0/5] hotplug fixes Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 1/5] cpu-hotplug: vs slab Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 2/5] cpu-hotplug: vs page_alloc Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 3/5] cpu-hotplug: cpu_up vs preempt-rt Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 4/5] rcu: backport RCU cpu hotplug support Peter Zijlstra
2008-06-10 15:15   ` Paul E. McKenney [this message]
2008-06-10 11:13 ` [PATCH -rt 5/5] cpu-hotplug: cpu_down vs preempt-rt Peter Zijlstra
2008-06-10 15:33   ` Paul E. McKenney
2008-06-10 15:51     ` Peter Zijlstra
2008-06-10 16:17       ` Paul E. McKenney
2008-06-11  6:53   ` [PATCH -rt 6/5] " Peter Zijlstra

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=20080610151544.GC15481@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=ego@in.ibm.com \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.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.