[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Make tlbflush_time a PER_CPU variable.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f3fb7727cb9afdc0dc99637b6c680ed29454f513
# Parent  9aac8db168b4566450008437d49d1e1040f8d98a
[XEN] Make tlbflush_time a PER_CPU variable.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/powerpc/setup.c           |    2 +-
 xen/arch/x86/flushtlb.c            |    4 ++--
 xen/arch/x86/x86_32/domain_page.c  |    3 +--
 xen/include/asm-powerpc/flushtlb.h |   15 ++++++++-------
 xen/include/asm-x86/current.h      |    2 +-
 xen/include/asm-x86/flushtlb.h     |   16 +++++++++-------
 xen/include/xen/percpu.h           |    1 -
 7 files changed, 22 insertions(+), 21 deletions(-)

diff -r 9aac8db168b4 -r f3fb7727cb9a xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/arch/powerpc/setup.c  Tue Aug 08 11:45:37 2006 +0100
@@ -55,7 +55,7 @@ boolean_param("earlygdb", opt_earlygdb);
 boolean_param("earlygdb", opt_earlygdb);
 
 u32 tlbflush_clock = 1U;
-u32 tlbflush_time[NR_CPUS];
+DEFINE_PER_CPU(u32, tlbflush_time);
 
 unsigned int watchdog_on;
 unsigned long wait_init_idle;
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/arch/x86/flushtlb.c
--- a/xen/arch/x86/flushtlb.c   Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/arch/x86/flushtlb.c   Tue Aug 08 11:45:37 2006 +0100
@@ -20,7 +20,7 @@
 #endif
 
 u32 tlbflush_clock = 1U;
-u32 tlbflush_time[NR_CPUS];
+DEFINE_PER_CPU(u32, tlbflush_time);
 
 void write_cr3(unsigned long cr3)
 {
@@ -71,7 +71,7 @@ void write_cr3(unsigned long cr3)
      *         case, so really we are being ultra paranoid.
      */
 
-    tlbflush_time[smp_processor_id()] = t2;
+    this_cpu(tlbflush_time) = t2;
 
     local_irq_restore(flags);
 }
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/arch/x86/x86_32/domain_page.c
--- a/xen/arch/x86/x86_32/domain_page.c Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/arch/x86/x86_32/domain_page.c Tue Aug 08 11:45:37 2006 +0100
@@ -73,8 +73,7 @@ void *map_domain_page(unsigned long pfn)
     if ( unlikely(cache->epoch != cache->shadow_epoch[vcpu]) )
     {
         cache->shadow_epoch[vcpu] = cache->epoch;
-        if ( NEED_FLUSH(tlbflush_time[smp_processor_id()],
-                        cache->tlbflush_timestamp) )
+        if ( NEED_FLUSH(this_cpu(tlbflush_time), cache->tlbflush_timestamp) )
         {
             perfc_incrc(domain_page_tlb_flush);
             local_flush_tlb();
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/include/asm-powerpc/flushtlb.h
--- a/xen/include/asm-powerpc/flushtlb.h        Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/include/asm-powerpc/flushtlb.h        Tue Aug 08 11:45:37 2006 +0100
@@ -22,6 +22,7 @@
 #define _ASM_FLUSHTLB_H_
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <xen/types.h>
 #include <asm/misc.h>
 
@@ -30,7 +31,7 @@ extern u32 tlbflush_clock;
 #define tlbflush_current_time() tlbflush_clock
 
 /* Time at which each CPU's TLB was last flushed. */
-extern u32 tlbflush_time[NR_CPUS];
+DECLARE_PER_CPU(u32, tlbflush_time);
 
 static inline int NEED_FLUSH(u32 cpu_stamp, u32 lastuse_stamp)
 {
@@ -44,12 +45,12 @@ static inline int NEED_FLUSH(u32 cpu_sta
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
  */
-#define tlbflush_filter(mask, page_timestamp)                   \
-do {                                                            \
-    unsigned int cpu;                                           \
-    for_each_cpu_mask ( cpu, mask )                             \
-        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
-            cpu_clear(cpu, mask);                               \
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+    unsigned int cpu;                                                   \
+    for_each_cpu_mask ( cpu, mask )                                     \
+        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
+            cpu_clear(cpu, mask);                                       \
 } while ( 0 )
 
 
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/include/asm-x86/current.h
--- a/xen/include/asm-x86/current.h     Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/include/asm-x86/current.h     Tue Aug 08 11:45:37 2006 +0100
@@ -8,6 +8,7 @@
 #define __X86_CURRENT_H__
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <public/xen.h>
 #include <asm/page.h>
 
@@ -53,7 +54,6 @@ static inline struct cpu_info *get_cpu_i
 
 #define schedule_tail(vcpu) (((vcpu)->arch.schedule_tail)(vcpu))
 
-#include <xen/percpu.h>
 /*
  * Which VCPU's state is currently running on each CPU?
  * This is not necesasrily the same as 'current' as a CPU may be
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/include/asm-x86/flushtlb.h
--- a/xen/include/asm-x86/flushtlb.h    Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/include/asm-x86/flushtlb.h    Tue Aug 08 11:45:37 2006 +0100
@@ -11,13 +11,15 @@
 #define __FLUSHTLB_H__
 
 #include <xen/config.h>
+#include <xen/percpu.h>
 #include <xen/smp.h>
+#include <xen/types.h>
 
 /* The current time as shown by the virtual TLB clock. */
 extern u32 tlbflush_clock;
 
 /* Time at which each CPU's TLB was last flushed. */
-extern u32 tlbflush_time[NR_CPUS];
+DECLARE_PER_CPU(u32, tlbflush_time);
 
 #define tlbflush_current_time() tlbflush_clock
 
@@ -47,12 +49,12 @@ static inline int NEED_FLUSH(u32 cpu_sta
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
  */
-#define tlbflush_filter(mask, page_timestamp)                   \
-do {                                                            \
-    unsigned int cpu;                                           \
-    for_each_cpu_mask ( cpu, mask )                             \
-        if ( !NEED_FLUSH(tlbflush_time[cpu], page_timestamp) )  \
-            cpu_clear(cpu, mask);                               \
+#define tlbflush_filter(mask, page_timestamp)                           \
+do {                                                                    \
+    unsigned int cpu;                                                   \
+    for_each_cpu_mask ( cpu, mask )                                     \
+        if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
+            cpu_clear(cpu, mask);                                       \
 } while ( 0 )
 
 extern void new_tlbflush_clock_period(void);
diff -r 9aac8db168b4 -r f3fb7727cb9a xen/include/xen/percpu.h
--- a/xen/include/xen/percpu.h  Tue Aug 08 11:28:35 2006 +0100
+++ b/xen/include/xen/percpu.h  Tue Aug 08 11:45:37 2006 +0100
@@ -2,7 +2,6 @@
 #define __XEN_PERCPU_H__
 
 #include <xen/config.h>
-#include <xen/smp.h>
 #include <asm/percpu.h>
 
 /* Preferred on Xen. Also see arch-defined per_cpu(). */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.