direct-io.hg

changeset 10977:f3fb7727cb9a

[XEN] Make tlbflush_time a PER_CPU variable.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Aug 08 11:45:37 2006 +0100 (2006-08-08)
parents 9aac8db168b4
children 7ce412dde1be
files xen/arch/powerpc/setup.c xen/arch/x86/flushtlb.c xen/arch/x86/x86_32/domain_page.c xen/include/asm-powerpc/flushtlb.h xen/include/asm-x86/current.h xen/include/asm-x86/flushtlb.h xen/include/xen/percpu.h
line diff
     1.1 --- a/xen/arch/powerpc/setup.c	Tue Aug 08 11:28:35 2006 +0100
     1.2 +++ b/xen/arch/powerpc/setup.c	Tue Aug 08 11:45:37 2006 +0100
     1.3 @@ -55,7 +55,7 @@ int opt_earlygdb = 0;
     1.4  boolean_param("earlygdb", opt_earlygdb);
     1.5  
     1.6  u32 tlbflush_clock = 1U;
     1.7 -u32 tlbflush_time[NR_CPUS];
     1.8 +DEFINE_PER_CPU(u32, tlbflush_time);
     1.9  
    1.10  unsigned int watchdog_on;
    1.11  unsigned long wait_init_idle;
     2.1 --- a/xen/arch/x86/flushtlb.c	Tue Aug 08 11:28:35 2006 +0100
     2.2 +++ b/xen/arch/x86/flushtlb.c	Tue Aug 08 11:45:37 2006 +0100
     2.3 @@ -20,7 +20,7 @@
     2.4  #endif
     2.5  
     2.6  u32 tlbflush_clock = 1U;
     2.7 -u32 tlbflush_time[NR_CPUS];
     2.8 +DEFINE_PER_CPU(u32, tlbflush_time);
     2.9  
    2.10  void write_cr3(unsigned long cr3)
    2.11  {
    2.12 @@ -71,7 +71,7 @@ void write_cr3(unsigned long cr3)
    2.13       *         case, so really we are being ultra paranoid.
    2.14       */
    2.15  
    2.16 -    tlbflush_time[smp_processor_id()] = t2;
    2.17 +    this_cpu(tlbflush_time) = t2;
    2.18  
    2.19      local_irq_restore(flags);
    2.20  }
     3.1 --- a/xen/arch/x86/x86_32/domain_page.c	Tue Aug 08 11:28:35 2006 +0100
     3.2 +++ b/xen/arch/x86/x86_32/domain_page.c	Tue Aug 08 11:45:37 2006 +0100
     3.3 @@ -73,8 +73,7 @@ void *map_domain_page(unsigned long pfn)
     3.4      if ( unlikely(cache->epoch != cache->shadow_epoch[vcpu]) )
     3.5      {
     3.6          cache->shadow_epoch[vcpu] = cache->epoch;
     3.7 -        if ( NEED_FLUSH(tlbflush_time[smp_processor_id()],
     3.8 -                        cache->tlbflush_timestamp) )
     3.9 +        if ( NEED_FLUSH(this_cpu(tlbflush_time), cache->tlbflush_timestamp) )
    3.10          {
    3.11              perfc_incrc(domain_page_tlb_flush);
    3.12              local_flush_tlb();
     4.1 --- a/xen/include/asm-powerpc/flushtlb.h	Tue Aug 08 11:28:35 2006 +0100
     4.2 +++ b/xen/include/asm-powerpc/flushtlb.h	Tue Aug 08 11:45:37 2006 +0100
     4.3 @@ -22,6 +22,7 @@
     4.4  #define _ASM_FLUSHTLB_H_
     4.5  
     4.6  #include <xen/config.h>
     4.7 +#include <xen/percpu.h>
     4.8  #include <xen/types.h>
     4.9  #include <asm/misc.h>
    4.10  
    4.11 @@ -30,7 +31,7 @@ extern u32 tlbflush_clock;
    4.12  #define tlbflush_current_time() tlbflush_clock
    4.13  
    4.14  /* Time at which each CPU's TLB was last flushed. */
    4.15 -extern u32 tlbflush_time[NR_CPUS];
    4.16 +DECLARE_PER_CPU(u32, tlbflush_time);
    4.17  
    4.18  static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
    4.19  {
    4.20 @@ -44,12 +45,12 @@ static inline int NEED_FLUSH(u32 cpu_sta
    4.21   * Filter the given set of CPUs, removing those that definitely flushed their
    4.22   * TLB since @page_timestamp.
    4.23   */
    4.24 -#define tlbflush_filter(mask, page_timestamp)                   \
    4.25 -do {                                                            \
    4.26 -    unsigned int cpu;                                           \
    4.27 -    for_each_cpu_mask ( cpu, mask )                             \
    4.28 -        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
    4.29 -            cpu_clear(cpu, mask);                               \
    4.30 +#define tlbflush_filter(mask, page_timestamp)                           \
    4.31 +do {                                                                    \
    4.32 +    unsigned int cpu;                                                   \
    4.33 +    for_each_cpu_mask ( cpu, mask )                                     \
    4.34 +        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
    4.35 +            cpu_clear(cpu, mask);                                       \
    4.36  } while ( 0 )
    4.37  
    4.38  
     5.1 --- a/xen/include/asm-x86/current.h	Tue Aug 08 11:28:35 2006 +0100
     5.2 +++ b/xen/include/asm-x86/current.h	Tue Aug 08 11:45:37 2006 +0100
     5.3 @@ -8,6 +8,7 @@
     5.4  #define __X86_CURRENT_H__
     5.5  
     5.6  #include <xen/config.h>
     5.7 +#include <xen/percpu.h>
     5.8  #include <public/xen.h>
     5.9  #include <asm/page.h>
    5.10  
    5.11 @@ -53,7 +54,6 @@ static inline struct cpu_info *get_cpu_i
    5.12  
    5.13  #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu))
    5.14  
    5.15 -#include <xen/percpu.h>
    5.16  /*
    5.17   * Which VCPU's state is currently running on each CPU?
    5.18   * This is not necesasrily the same as 'current' as a CPU may be
     6.1 --- a/xen/include/asm-x86/flushtlb.h	Tue Aug 08 11:28:35 2006 +0100
     6.2 +++ b/xen/include/asm-x86/flushtlb.h	Tue Aug 08 11:45:37 2006 +0100
     6.3 @@ -11,13 +11,15 @@
     6.4  #define __FLUSHTLB_H__
     6.5  
     6.6  #include <xen/config.h>
     6.7 +#include <xen/percpu.h>
     6.8  #include <xen/smp.h>
     6.9 +#include <xen/types.h>
    6.10  
    6.11  /* The current time as shown by the virtual TLB clock. */
    6.12  extern u32 tlbflush_clock;
    6.13  
    6.14  /* Time at which each CPU's TLB was last flushed. */
    6.15 -extern u32 tlbflush_time[NR_CPUS];
    6.16 +DECLARE_PER_CPU(u32, tlbflush_time);
    6.17  
    6.18  #define tlbflush_current_time() tlbflush_clock
    6.19  
    6.20 @@ -47,12 +49,12 @@ static inline int NEED_FLUSH(u32 cpu_sta
    6.21   * Filter the given set of CPUs, removing those that definitely flushed their
    6.22   * TLB since @page_timestamp.
    6.23   */
    6.24 -#define tlbflush_filter(mask, page_timestamp)                   \
    6.25 -do {                                                            \
    6.26 -    unsigned int cpu;                                           \
    6.27 -    for_each_cpu_mask ( cpu, mask )                             \
    6.28 -        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
    6.29 -            cpu_clear(cpu, mask);                               \
    6.30 +#define tlbflush_filter(mask, page_timestamp)                           \
    6.31 +do {                                                                    \
    6.32 +    unsigned int cpu;                                                   \
    6.33 +    for_each_cpu_mask ( cpu, mask )                                     \
    6.34 +        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
    6.35 +            cpu_clear(cpu, mask);                                       \
    6.36  } while ( 0 )
    6.37  
    6.38  extern void new_tlbflush_clock_period(void);
     7.1 --- a/xen/include/xen/percpu.h	Tue Aug 08 11:28:35 2006 +0100
     7.2 +++ b/xen/include/xen/percpu.h	Tue Aug 08 11:45:37 2006 +0100
     7.3 @@ -2,7 +2,6 @@
     7.4  #define __XEN_PERCPU_H__
     7.5  
     7.6  #include <xen/config.h>
     7.7 -#include <xen/smp.h>
     7.8  #include <asm/percpu.h>
     7.9  
    7.10  /* Preferred on Xen. Also see arch-defined per_cpu(). */