debuggers.hg

changeset 22802:bb0d0141ebf7

rcupdate: Implement rcu_barrier() to synchronously flush RCU work.

Signed-off-by: Keir Fraser <keir@xen.org>
author Keir Fraser <keir@xen.org>
date Fri Jan 14 14:16:42 2011 +0000 (2011-01-14)
parents 2d4fe1a048cd
children 0e693052c791
files xen/common/rcupdate.c xen/include/xen/rcupdate.h
line diff
     1.1 --- a/xen/common/rcupdate.c	Fri Jan 14 14:16:04 2011 +0000
     1.2 +++ b/xen/common/rcupdate.c	Fri Jan 14 14:16:42 2011 +0000
     1.3 @@ -44,6 +44,7 @@
     1.4  #include <xen/percpu.h>
     1.5  #include <xen/softirq.h>
     1.6  #include <xen/cpu.h>
     1.7 +#include <xen/stop_machine.h>
     1.8  
     1.9  /* Definition for rcupdate control block. */
    1.10  struct rcu_ctrlblk rcu_ctrlblk = {
    1.11 @@ -60,6 +61,30 @@ static int qhimark = 10000;
    1.12  static int qlowmark = 100;
    1.13  static int rsinterval = 1000;
    1.14  
    1.15 +static int rcu_barrier_action(void *unused)
    1.16 +{
    1.17 +    unsigned int cpu = smp_processor_id();
    1.18 +
    1.19 +    ASSERT(!local_irq_is_enabled());
    1.20 +    local_irq_enable();
    1.21 +
    1.22 +    while ( rcu_needs_cpu(cpu) )
    1.23 +    {
    1.24 +        rcu_check_callbacks(cpu);
    1.25 +        process_pending_softirqs();
    1.26 +        cpu_relax();
    1.27 +    }
    1.28 +
    1.29 +    local_irq_disable();
    1.30 +
    1.31 +    return 0;
    1.32 +}
    1.33 +
    1.34 +int rcu_barrier(void)
    1.35 +{
    1.36 +    return stop_machine_run(rcu_barrier_action, NULL, NR_CPUS);
    1.37 +}
    1.38 +
    1.39  static void force_quiescent_state(struct rcu_data *rdp,
    1.40                                    struct rcu_ctrlblk *rcp)
    1.41  {
     2.1 --- a/xen/include/xen/rcupdate.h	Fri Jan 14 14:16:04 2011 +0000
     2.2 +++ b/xen/include/xen/rcupdate.h	Fri Jan 14 14:16:42 2011 +0000
     2.3 @@ -197,4 +197,6 @@ void rcu_check_callbacks(int cpu);
     2.4  void fastcall call_rcu(struct rcu_head *head, 
     2.5                         void (*func)(struct rcu_head *head));
     2.6  
     2.7 +int rcu_barrier(void);
     2.8 +
     2.9  #endif /* __XEN_RCUPDATE_H */