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

[Xen-devel] [PATCH 3/5] x86/xen: Read variables from dynamically allocated per_cpu data



per_cpu data is dynamically allocated since 21416 changeset (x86: Dynamically
allocate percpu data area when a CPU comes online). Take into account that
and read variables from correct address.

Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>

diff -Npru crash-6.0.8.orig/xen_hyper.c crash-6.0.8/xen_hyper.c
--- crash-6.0.8.orig/xen_hyper.c        2012-07-05 15:47:09.000000000 +0200
+++ crash-6.0.8/xen_hyper.c     2012-07-05 15:50:19.000000000 +0200
@@ -64,7 +64,6 @@ xen_hyper_init(void)
        machdep->get_smp_cpus();
        machdep->memory_size();
 
-#ifdef IA64
        if (symbol_exists("__per_cpu_offset")) {
                xht->flags |= XEN_HYPER_SMP;
                if((xht->__per_cpu_offset = malloc(sizeof(ulong) * 
XEN_HYPER_MAX_CPUS())) == NULL) {
@@ -76,7 +75,6 @@ xen_hyper_init(void)
                        error(FATAL, "cannot read __per_cpu_offset.\n");
                }
        }
-#endif
 
 #if defined(X86) || defined(X86_64)
        if (symbol_exists("__per_cpu_shift")) {
diff -Npru crash-6.0.8.orig/xen_hyper_defs.h crash-6.0.8/xen_hyper_defs.h
--- crash-6.0.8.orig/xen_hyper_defs.h   2012-06-29 16:59:18.000000000 +0200
+++ crash-6.0.8/xen_hyper_defs.h        2012-07-05 15:50:19.000000000 +0200
@@ -136,7 +136,13 @@ typedef uint32_t   Elf_Word;
 
 #if defined(X86) || defined(X86_64)
 #define xen_hyper_per_cpu(var, cpu)  \
-       ((ulong)(var) + (((ulong)(cpu))<<xht->percpu_shift))
+       ({ ulong __var_addr; \
+          if (xht->__per_cpu_offset) \
+               __var_addr = (xht->flags & XEN_HYPER_SMP) ? \
+                       ((ulong)(var) + xht->__per_cpu_offset[cpu]) : 
(ulong)(var); \
+          else \
+               __var_addr = (ulong)(var) + ((ulong)(cpu) << 
xht->percpu_shift); \
+          __var_addr; })
 #elif defined(IA64)
 #define xen_hyper_per_cpu(var, cpu)  \
        ((xht->flags & XEN_HYPER_SMP) ? \

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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