[Crash-utility] [PATCH] Support cpu_map/cpu_mask changes in 2.6.29

Dave Anderson anderson at redhat.com
Wed Apr 29 12:53:38 UTC 2009


----- "Michael Holzheu" <holzheu at linux.vnet.ibm.com> wrote:

> Hi Dave,
>
> I tested my patch and it worked. But it only worked by chance. I read
> the address using readmem(cpu_mask_size) in combination with ULONG(),
> which is nonsense.
> 
> So the correct (and tested) version would be something like:
> 
> static ulong
> get_cpu_map_addr_from_mask(const char *type)
> {
>         char cpu_mask_symbol[32];
>         ulong cpu_map_addr;
> 
>         sprintf(cpu_mask_symbol, "cpu_%s_mask", type);
> 
>         if (!symbol_exists(cpu_mask_symbol))
>                 return 0;
> 
>         get_symbol_data(cpu_mask_symbol, sizeof(ulong), &cpu_map_addr);
>         return cpu_map_addr;
> }

OK good -- I'll probably just fold the above into cpu_map_addr().

Also, this change, although it doesn't break things, doesn't make
sense because this instance of "cpu_online_map" is a symbol in the
xen hypervisor binary, i.e., not the one in the vmlinux code:

--- crash-4.0-8.9.orig/xen_hyper.c
+++ crash-4.0-8.9/xen_hyper.c
@@ -1815,7 +1815,7 @@ xen_hyper_get_cpu_info(void)
                error(FATAL, "cannot malloc cpumask space.\n");
        }
        /* kakuma: It may be better to use cpu_present_map. */
-       addr = symbol_value("cpu_online_map");
+       addr = cpu_map_addr("online");
        if (!readmem(addr, KVADDR, xht->cpumask,
                XEN_HYPER_SIZE(cpumask_t), "cpu_online_map", RETURN_ON_ERROR)) {
                error(FATAL, "cannot read cpu_online_map.\n");

Thanks,
  Dave




More information about the Crash-utility mailing list