Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   x86/xen: Read variables from dynamically allocated per_cpu data (http://www.linux-archive.org/crash-utility/680428-x86-xen-read-variables-dynamically-allocated-per_cpu-data.html)

Daniel Kiper 07-05-2012 03:02 PM

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@oracle.com>

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.
");
}
}
-#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) ?

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Daniel Kiper 08-10-2012 01:26 PM

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@oracle.com>

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.
");
}
}
-#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) ?

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility


All times are GMT. The time now is 05:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.