direct-io.hg

changeset 13648:32fd32bbf78d

Add RCU support to Xen.
Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
author kaf24@localhost.localdomain
date Fri Jan 26 18:34:36 2007 +0000 (2007-01-26)
parents 19a600376688
children 271ffb1c12eb
files xen/arch/x86/setup.c xen/common/Makefile xen/common/rcupdate.c xen/common/softirq.c xen/include/xen/rcupdate.h xen/include/xen/softirq.h
line diff
     1.1 --- a/xen/arch/x86/setup.c	Fri Jan 26 17:33:58 2007 +0000
     1.2 +++ b/xen/arch/x86/setup.c	Fri Jan 26 18:34:36 2007 +0000
     1.3 @@ -17,6 +17,7 @@
     1.4  #include <xen/hypercall.h>
     1.5  #include <xen/keyhandler.h>
     1.6  #include <xen/numa.h>
     1.7 +#include <xen/rcupdate.h>
     1.8  #include <public/version.h>
     1.9  #ifdef CONFIG_COMPAT
    1.10  #include <compat/platform.h>
    1.11 @@ -658,6 +659,8 @@ void __init __start_xen(multiboot_info_t
    1.12  
    1.13      trap_init();
    1.14  
    1.15 +    rcu_init();
    1.16 +    
    1.17      timer_init();
    1.18  
    1.19      early_time_init();
    1.20 @@ -694,7 +697,10 @@ void __init __start_xen(multiboot_info_t
    1.21          if ( num_online_cpus() >= max_cpus )
    1.22              break;
    1.23          if ( !cpu_online(i) )
    1.24 +        {
    1.25 +            rcu_online_cpu(i);
    1.26              __cpu_up(i);
    1.27 +        }
    1.28  
    1.29          /* Set up cpu_to_node[]. */
    1.30          srat_detect_node(i);
     2.1 --- a/xen/common/Makefile	Fri Jan 26 17:33:58 2007 +0000
     2.2 +++ b/xen/common/Makefile	Fri Jan 26 18:34:36 2007 +0000
     2.3 @@ -26,6 +26,7 @@ obj-y += trace.o
     2.4  obj-y += version.o
     2.5  obj-y += vsprintf.o
     2.6  obj-y += xmalloc.o
     2.7 +obj-y += rcupdate.o
     2.8  
     2.9  obj-$(perfc)       += perfc.o
    2.10  obj-$(crash_debug) += gdbstub.o
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/common/rcupdate.c	Fri Jan 26 18:34:36 2007 +0000
     3.3 @@ -0,0 +1,348 @@
     3.4 +/*
     3.5 + * Read-Copy Update mechanism for mutual exclusion
     3.6 + *
     3.7 + * This program is free software; you can redistribute it and/or modify
     3.8 + * it under the terms of the GNU General Public License as published by
     3.9 + * the Free Software Foundation; either version 2 of the License, or
    3.10 + * (at your option) any later version.
    3.11 + *
    3.12 + * This program is distributed in the hope that it will be useful,
    3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 + * GNU General Public License for more details.
    3.16 + *
    3.17 + * You should have received a copy of the GNU General Public License
    3.18 + * along with this program; if not, write to the Free Software
    3.19 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    3.20 + *
    3.21 + * Copyright (C) IBM Corporation, 2001
    3.22 + *
    3.23 + * Authors: Dipankar Sarma <dipankar@in.ibm.com>
    3.24 + *          Manfred Spraul <manfred@colorfullife.com>
    3.25 + * 
    3.26 + * Modifications for Xen: Jose Renato Santos
    3.27 + * Copyright (C) Hewlett-Packard, 2006
    3.28 + *
    3.29 + * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
    3.30 + * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
    3.31 + * Papers:
    3.32 + * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
    3.33 + * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
    3.34 + *
    3.35 + * For detailed explanation of Read-Copy Update mechanism see -
    3.36 + * http://lse.sourceforge.net/locking/rcupdate.html
    3.37 + */
    3.38 +#include <xen/types.h>
    3.39 +#include <xen/kernel.h>
    3.40 +#include <xen/init.h>
    3.41 +#include <xen/spinlock.h>
    3.42 +#include <xen/smp.h>
    3.43 +#include <xen/rcupdate.h>
    3.44 +#include <xen/sched.h>
    3.45 +#include <asm/atomic.h>
    3.46 +#include <xen/bitops.h>
    3.47 +#include <xen/percpu.h>
    3.48 +#include <xen/softirq.h>
    3.49 +
    3.50 +/* Definition for rcupdate control block. */
    3.51 +struct rcu_ctrlblk rcu_ctrlblk = {
    3.52 +    .cur = -300,
    3.53 +    .completed = -300,
    3.54 +    .lock = SPIN_LOCK_UNLOCKED,
    3.55 +    .cpumask = CPU_MASK_NONE,
    3.56 +};
    3.57 +
    3.58 +DEFINE_PER_CPU(struct rcu_data, rcu_data) = { 0L };
    3.59 +
    3.60 +static int blimit = 10;
    3.61 +static int qhimark = 10000;
    3.62 +static int qlowmark = 100;
    3.63 +static int rsinterval = 1000;
    3.64 +
    3.65 +static void force_quiescent_state(struct rcu_data *rdp,
    3.66 +                                  struct rcu_ctrlblk *rcp)
    3.67 +{
    3.68 +    cpumask_t cpumask;
    3.69 +    raise_softirq(SCHEDULE_SOFTIRQ);
    3.70 +    if (unlikely(rdp->qlen - rdp->last_rs_qlen > rsinterval)) {
    3.71 +        rdp->last_rs_qlen = rdp->qlen;
    3.72 +        /*
    3.73 +         * Don't send IPI to itself. With irqs disabled,
    3.74 +         * rdp->cpu is the current cpu.
    3.75 +         */
    3.76 +        cpumask = rcp->cpumask;
    3.77 +        cpu_clear(rdp->cpu, cpumask);
    3.78 +        cpumask_raise_softirq(cpumask, SCHEDULE_SOFTIRQ);
    3.79 +    }
    3.80 +}
    3.81 +
    3.82 +/**
    3.83 + * call_rcu - Queue an RCU callback for invocation after a grace period.
    3.84 + * @head: structure to be used for queueing the RCU updates.
    3.85 + * @func: actual update function to be invoked after the grace period
    3.86 + *
    3.87 + * The update function will be invoked some time after a full grace
    3.88 + * period elapses, in other words after all currently executing RCU
    3.89 + * read-side critical sections have completed.  RCU read-side critical
    3.90 + * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
    3.91 + * and may be nested.
    3.92 + */
    3.93 +void fastcall call_rcu(struct rcu_head *head,
    3.94 +                       void (*func)(struct rcu_head *rcu))
    3.95 +{
    3.96 +    unsigned long flags;
    3.97 +    struct rcu_data *rdp;
    3.98 +
    3.99 +    head->func = func;
   3.100 +    head->next = NULL;
   3.101 +    local_irq_save(flags);
   3.102 +    rdp = &__get_cpu_var(rcu_data);
   3.103 +    *rdp->nxttail = head;
   3.104 +    rdp->nxttail = &head->next;
   3.105 +    if (unlikely(++rdp->qlen > qhimark)) {
   3.106 +        rdp->blimit = INT_MAX;
   3.107 +        force_quiescent_state(rdp, &rcu_ctrlblk);
   3.108 +    }
   3.109 +    local_irq_restore(flags);
   3.110 +}
   3.111 +
   3.112 +/*
   3.113 + * Invoke the completed RCU callbacks. They are expected to be in
   3.114 + * a per-cpu list.
   3.115 + */
   3.116 +static void rcu_do_batch(struct rcu_data *rdp)
   3.117 +{
   3.118 +    struct rcu_head *next, *list;
   3.119 +    int count = 0;
   3.120 +
   3.121 +    list = rdp->donelist;
   3.122 +    while (list) {
   3.123 +        next = rdp->donelist = list->next;
   3.124 +        list->func(list);
   3.125 +        list = next;
   3.126 +        rdp->qlen--;
   3.127 +        if (++count >= rdp->blimit)
   3.128 +            break;
   3.129 +    }
   3.130 +    if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark)
   3.131 +        rdp->blimit = blimit;
   3.132 +    if (!rdp->donelist)
   3.133 +        rdp->donetail = &rdp->donelist;
   3.134 +    else
   3.135 +        raise_softirq(RCU_SOFTIRQ);
   3.136 +}
   3.137 +
   3.138 +/*
   3.139 + * Grace period handling:
   3.140 + * The grace period handling consists out of two steps:
   3.141 + * - A new grace period is started.
   3.142 + *   This is done by rcu_start_batch. The start is not broadcasted to
   3.143 + *   all cpus, they must pick this up by comparing rcp->cur with
   3.144 + *   rdp->quiescbatch. All cpus are recorded  in the
   3.145 + *   rcu_ctrlblk.cpumask bitmap.
   3.146 + * - All cpus must go through a quiescent state.
   3.147 + *   Since the start of the grace period is not broadcasted, at least two
   3.148 + *   calls to rcu_check_quiescent_state are required:
   3.149 + *   The first call just notices that a new grace period is running. The
   3.150 + *   following calls check if there was a quiescent state since the beginning
   3.151 + *   of the grace period. If so, it updates rcu_ctrlblk.cpumask. If
   3.152 + *   the bitmap is empty, then the grace period is completed.
   3.153 + *   rcu_check_quiescent_state calls rcu_start_batch(0) to start the next grace
   3.154 + *   period (if necessary).
   3.155 + */
   3.156 +/*
   3.157 + * Register a new batch of callbacks, and start it up if there is currently no
   3.158 + * active batch and the batch to be registered has not already occurred.
   3.159 + * Caller must hold rcu_ctrlblk.lock.
   3.160 + */
   3.161 +static void rcu_start_batch(struct rcu_ctrlblk *rcp)
   3.162 +{
   3.163 +    if (rcp->next_pending &&
   3.164 +        rcp->completed == rcp->cur) {
   3.165 +        rcp->next_pending = 0;
   3.166 +        /*
   3.167 +         * next_pending == 0 must be visible in
   3.168 +         * __rcu_process_callbacks() before it can see new value of cur.
   3.169 +         */
   3.170 +        smp_wmb();
   3.171 +        rcp->cur++;
   3.172 +
   3.173 +        rcp->cpumask = cpu_online_map;
   3.174 +    }
   3.175 +}
   3.176 +
   3.177 +/*
   3.178 + * cpu went through a quiescent state since the beginning of the grace period.
   3.179 + * Clear it from the cpu mask and complete the grace period if it was the last
   3.180 + * cpu. Start another grace period if someone has further entries pending
   3.181 + */
   3.182 +static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp)
   3.183 +{
   3.184 +    cpu_clear(cpu, rcp->cpumask);
   3.185 +    if (cpus_empty(rcp->cpumask)) {
   3.186 +        /* batch completed ! */
   3.187 +        rcp->completed = rcp->cur;
   3.188 +        rcu_start_batch(rcp);
   3.189 +    }
   3.190 +}
   3.191 +
   3.192 +/*
   3.193 + * Check if the cpu has gone through a quiescent state (say context
   3.194 + * switch). If so and if it already hasn't done so in this RCU
   3.195 + * quiescent cycle, then indicate that it has done so.
   3.196 + */
   3.197 +static void rcu_check_quiescent_state(struct rcu_ctrlblk *rcp,
   3.198 +                                      struct rcu_data *rdp)
   3.199 +{
   3.200 +    if (rdp->quiescbatch != rcp->cur) {
   3.201 +        /* start new grace period: */
   3.202 +        rdp->qs_pending = 1;
   3.203 +        rdp->quiescbatch = rcp->cur;
   3.204 +        return;
   3.205 +    }
   3.206 +
   3.207 +    /* Grace period already completed for this cpu?
   3.208 +     * qs_pending is checked instead of the actual bitmap to avoid
   3.209 +     * cacheline trashing.
   3.210 +     */
   3.211 +    if (!rdp->qs_pending)
   3.212 +        return;
   3.213 +
   3.214 +    rdp->qs_pending = 0;
   3.215 +
   3.216 +    spin_lock(&rcp->lock);
   3.217 +    /*
   3.218 +     * rdp->quiescbatch/rcp->cur and the cpu bitmap can come out of sync
   3.219 +     * during cpu startup. Ignore the quiescent state.
   3.220 +     */
   3.221 +    if (likely(rdp->quiescbatch == rcp->cur))
   3.222 +        cpu_quiet(rdp->cpu, rcp);
   3.223 +
   3.224 +    spin_unlock(&rcp->lock);
   3.225 +}
   3.226 +
   3.227 +
   3.228 +/*
   3.229 + * This does the RCU processing work from softirq context. 
   3.230 + */
   3.231 +static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp,
   3.232 +                                    struct rcu_data *rdp)
   3.233 +{
   3.234 +    if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch)) {
   3.235 +        *rdp->donetail = rdp->curlist;
   3.236 +        rdp->donetail = rdp->curtail;
   3.237 +        rdp->curlist = NULL;
   3.238 +        rdp->curtail = &rdp->curlist;
   3.239 +    }
   3.240 +
   3.241 +    local_irq_disable();
   3.242 +    if (rdp->nxtlist && !rdp->curlist) {
   3.243 +        rdp->curlist = rdp->nxtlist;
   3.244 +        rdp->curtail = rdp->nxttail;
   3.245 +        rdp->nxtlist = NULL;
   3.246 +        rdp->nxttail = &rdp->nxtlist;
   3.247 +        local_irq_enable();
   3.248 +
   3.249 +        /*
   3.250 +         * start the next batch of callbacks
   3.251 +         */
   3.252 +
   3.253 +        /* determine batch number */
   3.254 +        rdp->batch = rcp->cur + 1;
   3.255 +        /* see the comment and corresponding wmb() in
   3.256 +         * the rcu_start_batch()
   3.257 +         */
   3.258 +        smp_rmb();
   3.259 +
   3.260 +        if (!rcp->next_pending) {
   3.261 +            /* and start it/schedule start if it's a new batch */
   3.262 +            spin_lock(&rcp->lock);
   3.263 +            rcp->next_pending = 1;
   3.264 +            rcu_start_batch(rcp);
   3.265 +            spin_unlock(&rcp->lock);
   3.266 +        }
   3.267 +    } else {
   3.268 +        local_irq_enable();
   3.269 +    }
   3.270 +    rcu_check_quiescent_state(rcp, rdp);
   3.271 +    if (rdp->donelist)
   3.272 +        rcu_do_batch(rdp);
   3.273 +}
   3.274 +
   3.275 +static void rcu_process_callbacks(void)
   3.276 +{
   3.277 +    __rcu_process_callbacks(&rcu_ctrlblk, &__get_cpu_var(rcu_data));
   3.278 +}
   3.279 +
   3.280 +static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp)
   3.281 +{
   3.282 +    /* This cpu has pending rcu entries and the grace period
   3.283 +     * for them has completed.
   3.284 +     */
   3.285 +    if (rdp->curlist && !rcu_batch_before(rcp->completed, rdp->batch))
   3.286 +        return 1;
   3.287 +
   3.288 +    /* This cpu has no pending entries, but there are new entries */
   3.289 +    if (!rdp->curlist && rdp->nxtlist)
   3.290 +        return 1;
   3.291 +
   3.292 +    /* This cpu has finished callbacks to invoke */
   3.293 +    if (rdp->donelist)
   3.294 +        return 1;
   3.295 +
   3.296 +    /* The rcu core waits for a quiescent state from the cpu */
   3.297 +    if (rdp->quiescbatch != rcp->cur || rdp->qs_pending)
   3.298 +        return 1;
   3.299 +
   3.300 +    /* nothing to do */
   3.301 +    return 0;
   3.302 +}
   3.303 +
   3.304 +int rcu_pending(int cpu)
   3.305 +{
   3.306 +    return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu));
   3.307 +}
   3.308 +
   3.309 +/*
   3.310 + * Check to see if any future RCU-related work will need to be done
   3.311 + * by the current CPU, even if none need be done immediately, returning
   3.312 + * 1 if so.  This function is part of the RCU implementation; it is -not-
   3.313 + * an exported member of the RCU API.
   3.314 + */
   3.315 +int rcu_needs_cpu(int cpu)
   3.316 +{
   3.317 +    struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
   3.318 +
   3.319 +    return (!!rdp->curlist || rcu_pending(cpu));
   3.320 +}
   3.321 +
   3.322 +void rcu_check_callbacks(int cpu)
   3.323 +{
   3.324 +    raise_softirq(RCU_SOFTIRQ);
   3.325 +}
   3.326 +
   3.327 +static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
   3.328 +                                 struct rcu_data *rdp)
   3.329 +{
   3.330 +    memset(rdp, 0, sizeof(*rdp));
   3.331 +    rdp->curtail = &rdp->curlist;
   3.332 +    rdp->nxttail = &rdp->nxtlist;
   3.333 +    rdp->donetail = &rdp->donelist;
   3.334 +    rdp->quiescbatch = rcp->completed;
   3.335 +    rdp->qs_pending = 0;
   3.336 +    rdp->cpu = cpu;
   3.337 +    rdp->blimit = blimit;
   3.338 +}
   3.339 +
   3.340 +void __devinit rcu_online_cpu(int cpu)
   3.341 +{
   3.342 +    struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
   3.343 +
   3.344 +    rcu_init_percpu_data(cpu, &rcu_ctrlblk, rdp);
   3.345 +}
   3.346 +
   3.347 +void rcu_init(void)
   3.348 +{
   3.349 +    rcu_online_cpu(smp_processor_id());
   3.350 +    open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
   3.351 +}
     4.1 --- a/xen/common/softirq.c	Fri Jan 26 17:33:58 2007 +0000
     4.2 +++ b/xen/common/softirq.c	Fri Jan 26 18:34:36 2007 +0000
     4.3 @@ -13,6 +13,7 @@
     4.4  #include <xen/init.h>
     4.5  #include <xen/mm.h>
     4.6  #include <xen/sched.h>
     4.7 +#include <xen/rcupdate.h>
     4.8  #include <xen/softirq.h>
     4.9  
    4.10  #ifndef __ARCH_IRQ_STAT
    4.11 @@ -33,6 +34,10 @@ asmlinkage void do_softirq(void)
    4.12           * us to another processor.
    4.13           */
    4.14          cpu = smp_processor_id();
    4.15 +
    4.16 +        if ( rcu_pending(cpu) )
    4.17 +            rcu_check_callbacks(cpu);
    4.18 +
    4.19          if ( (pending = softirq_pending(cpu)) == 0 )
    4.20              break;
    4.21  
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/xen/include/xen/rcupdate.h	Fri Jan 26 18:34:36 2007 +0000
     5.3 @@ -0,0 +1,147 @@
     5.4 +/*
     5.5 + * Read-Copy Update mechanism for mutual exclusion 
     5.6 + *
     5.7 + * This program is free software; you can redistribute it and/or modify
     5.8 + * it under the terms of the GNU General Public License as published by
     5.9 + * the Free Software Foundation; either version 2 of the License, or
    5.10 + * (at your option) any later version.
    5.11 + *
    5.12 + * This program is distributed in the hope that it will be useful,
    5.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5.15 + * GNU General Public License for more details.
    5.16 + *
    5.17 + * You should have received a copy of the GNU General Public License
    5.18 + * along with this program; if not, write to the Free Software
    5.19 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    5.20 + *
    5.21 + * Copyright (C) IBM Corporation, 2001
    5.22 + *
    5.23 + * Author: Dipankar Sarma <dipankar@in.ibm.com>
    5.24 + * 
    5.25 + * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
    5.26 + * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
    5.27 + * Papers:
    5.28 + * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
    5.29 + * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
    5.30 + *
    5.31 + * For detailed explanation of Read-Copy Update mechanism see -
    5.32 + * http://lse.sourceforge.net/locking/rcupdate.html
    5.33 + */
    5.34 +
    5.35 +#ifndef __XEN_RCUPDATE_H
    5.36 +#define __XEN_RCUPDATE_H
    5.37 +
    5.38 +#include <xen/cache.h>
    5.39 +#include <xen/spinlock.h>
    5.40 +#include <xen/percpu.h>
    5.41 +#include <xen/cpumask.h>
    5.42 +
    5.43 +/**
    5.44 + * struct rcu_head - callback structure for use with RCU
    5.45 + * @next: next update requests in a list
    5.46 + * @func: actual update function to call after the grace period.
    5.47 + */
    5.48 +struct rcu_head {
    5.49 +    struct rcu_head *next;
    5.50 +    void (*func)(struct rcu_head *head);
    5.51 +};
    5.52 +
    5.53 +#define RCU_HEAD_INIT   { .next = NULL, .func = NULL }
    5.54 +#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
    5.55 +#define INIT_RCU_HEAD(ptr) do { \
    5.56 +       (ptr)->next = NULL; (ptr)->func = NULL; \
    5.57 +} while (0)
    5.58 +
    5.59 +
    5.60 +
    5.61 +/* Global control variables for rcupdate callback mechanism. */
    5.62 +struct rcu_ctrlblk {
    5.63 +    long cur;           /* Current batch number.                      */
    5.64 +    long completed;     /* Number of the last completed batch         */
    5.65 +    int  next_pending;  /* Is the next batch already waiting?         */
    5.66 +
    5.67 +    spinlock_t  lock __cacheline_aligned;
    5.68 +    cpumask_t   cpumask; /* CPUs that need to switch in order    */
    5.69 +    /* for current batch to proceed.        */
    5.70 +} __cacheline_aligned;
    5.71 +
    5.72 +/* Is batch a before batch b ? */
    5.73 +static inline int rcu_batch_before(long a, long b)
    5.74 +{
    5.75 +    return (a - b) < 0;
    5.76 +}
    5.77 +
    5.78 +/* Is batch a after batch b ? */
    5.79 +static inline int rcu_batch_after(long a, long b)
    5.80 +{
    5.81 +    return (a - b) > 0;
    5.82 +}
    5.83 +
    5.84 +/*
    5.85 + * Per-CPU data for Read-Copy Update.
    5.86 + * nxtlist - new callbacks are added here
    5.87 + * curlist - current batch for which quiescent cycle started if any
    5.88 + */
    5.89 +struct rcu_data {
    5.90 +    /* 1) quiescent state handling : */
    5.91 +    long quiescbatch;    /* Batch # for grace period */
    5.92 +    int  qs_pending;     /* core waits for quiesc state */
    5.93 +
    5.94 +    /* 2) batch handling */
    5.95 +    long            batch;            /* Batch # for current RCU batch */
    5.96 +    struct rcu_head *nxtlist;
    5.97 +    struct rcu_head **nxttail;
    5.98 +    long            qlen;             /* # of queued callbacks */
    5.99 +    struct rcu_head *curlist;
   5.100 +    struct rcu_head **curtail;
   5.101 +    struct rcu_head *donelist;
   5.102 +    struct rcu_head **donetail;
   5.103 +    long            blimit;           /* Upper limit on a processed batch */
   5.104 +    int cpu;
   5.105 +    struct rcu_head barrier;
   5.106 +#ifdef CONFIG_SMP
   5.107 +    long            last_rs_qlen;     /* qlen during the last resched */
   5.108 +#endif
   5.109 +};
   5.110 +
   5.111 +DECLARE_PER_CPU(struct rcu_data, rcu_data);
   5.112 +extern struct rcu_ctrlblk rcu_ctrlblk;
   5.113 +
   5.114 +int rcu_pending(int cpu);
   5.115 +int rcu_needs_cpu(int cpu);
   5.116 +
   5.117 +/**
   5.118 + * rcu_dereference - fetch an RCU-protected pointer in an
   5.119 + * RCU read-side critical section.  This pointer may later
   5.120 + * be safely dereferenced.
   5.121 + *
   5.122 + * Inserts memory barriers on architectures that require them
   5.123 + * (currently only the Alpha), and, more importantly, documents
   5.124 + * exactly which pointers are protected by RCU.
   5.125 + */
   5.126 +#define rcu_dereference(p)     (p)
   5.127 +
   5.128 +/**
   5.129 + * rcu_assign_pointer - assign (publicize) a pointer to a newly
   5.130 + * initialized structure that will be dereferenced by RCU read-side
   5.131 + * critical sections.  Returns the value assigned.
   5.132 + *
   5.133 + * Inserts memory barriers on architectures that require them
   5.134 + * (pretty much all of them other than x86), and also prevents
   5.135 + * the compiler from reordering the code that initializes the
   5.136 + * structure after the pointer assignment.  More importantly, this
   5.137 + * call documents which pointers will be dereferenced by RCU read-side
   5.138 + * code.
   5.139 + */
   5.140 +#define rcu_assign_pointer(p, v) ({ smp_wmb(); (p) = (v); })
   5.141 +
   5.142 +void rcu_init(void);
   5.143 +void __devinit rcu_online_cpu(int cpu);
   5.144 +void rcu_check_callbacks(int cpu);
   5.145 +
   5.146 +/* Exported interfaces */
   5.147 +void fastcall call_rcu(struct rcu_head *head, 
   5.148 +                       void (*func)(struct rcu_head *head));
   5.149 +
   5.150 +#endif /* __XEN_RCUPDATE_H */
     6.1 --- a/xen/include/xen/softirq.h	Fri Jan 26 17:33:58 2007 +0000
     6.2 +++ b/xen/include/xen/softirq.h	Fri Jan 26 18:34:36 2007 +0000
     6.3 @@ -9,8 +9,9 @@
     6.4  #define NMI_SOFTIRQ                       4
     6.5  #define PAGE_SCRUB_SOFTIRQ                5
     6.6  #define TRACE_SOFTIRQ                     6
     6.7 +#define RCU_SOFTIRQ                       7
     6.8  
     6.9 -#define NR_COMMON_SOFTIRQS                7
    6.10 +#define NR_COMMON_SOFTIRQS                8
    6.11  
    6.12  #include <asm/softirq.h>
    6.13