[Crash-utility] [PATCH] ARM: don't read __per_cpu_offset table again

Per Fransson per.xx.fransson at stericsson.com
Wed Jan 18 15:19:13 UTC 2012


Hi Dave/Mika/Jan and other Crash users,

Here's some code that can be thrown away. The __per_cpu_offset table is read in
arm.c:arm_get_crash_notes() even though it's already available.

Regards,
Per


diff --git a/arm.c b/arm.c
index 5eb5649..36a26cc 100644
--- a/arm.c
+++ b/arm.c
@@ -497,8 +497,6 @@ arm_get_crash_notes(void)
        ulong offset;
        char *buf, *p;
        ulong *notes_ptrs;
-       ulong per_cpu_offsets_addr;
-       ulong *per_cpu_offsets;
        ulong i;
 
        if (!symbol_exists("crash_notes"))
@@ -521,24 +519,9 @@ arm_get_crash_notes(void)
        }
 
        if (symbol_exists("__per_cpu_offset")) {
-
-               /* Get the __per_cpu_offset array */
-               per_cpu_offsets_addr = symbol_value("__per_cpu_offset");
-               
-               per_cpu_offsets = (ulong *)GETBUF(kt->cpus*sizeof(*per_cpu_offsets));
-               
-               if (!readmem(per_cpu_offsets_addr, KVADDR, per_cpu_offsets, 
-                   kt->cpus*sizeof(*per_cpu_offsets), "per_cpu_offsets",
-                            RETURN_ON_ERROR)) {
-                       error(WARNING, "cannot read per_cpu_offsets\n");
-                       FREEBUF(per_cpu_offsets);
-                       return FALSE;
-               }
-
                /* Add __per_cpu_offset for each cpu to form the pointer to the notes */
                for (i = 0; i<kt->cpus; i++)
-                       notes_ptrs[i] = notes_ptrs[kt->cpus-1] + per_cpu_offsets[i];
-               FREEBUF(per_cpu_offsets);
+                       notes_ptrs[i] = notes_ptrs[kt->cpus-1] + kt->__per_cpu_offset[i];
        }
 
        buf = GETBUF(SIZE(note_buf));




More information about the Crash-utility mailing list