[Crash-utility] Re: [PATCH] Support cpu_map/cpu_mask changes in 2.6.29 & module debuginfo search

Michael Holzheu holzheu at linux.vnet.ibm.com
Thu Apr 30 15:51:07 UTC 2009


Hi Dave,

Am Mittwoch, den 29.04.2009, 14:04 -0400 schrieb Dave Anderson:
> Hi Michael,
> 
> I made a few other changes to your cpu map/mask patch:
> 
> - cpu_map_size() has been changed to use the symbol-name-creation
>    scheme as cpu_map_addr() in order to absolutely maintain the
>    backwards-compatibility issue brought up by Robin.  So if the
>    old symbol names still exist, the code does exactly the same
>    thing that it used to.

fine.

> - Your changes to get_cpus_present() and get_cpus_possible() were
>    incomplete because they were still using the hardwired "cpus_present_map"
>    and "cpus_possible_map" symbols.
> 
> - I didn't change the s390.c and s390x.c s390[x]_get_smp_cpus()
>    functions beyond what you did, but I think they should be
>    changed to use get_cpus_online() instead of the way they
>    are doing it now.  As it is now, they are restricting themselves
>    to the number of cpu bits in a per-arch long.  If the
>    s390 CONFIG_NR_CPUS can exceed 32, or the s390x CONFIG_NR_CPUS
>    can exceed 64, then those two functions are incorrect.
>    If the architecture limits them to 32/64, then I suppose the
>    way it's done now is OK.  That's your call...

Right.

Index: crash-4.0-8.9/s390.c
===================================================================
--- crash-4.0-8.9.orig/s390.c
+++ crash-4.0-8.9/s390.c
@@ -999,16 +999,7 @@ s390_dis_filter(ulong vaddr, char *inbuf
 int
 s390_get_smp_cpus(void)
 {
-	unsigned long map = 0, addr;
-	int i, cpu_num = 0;
-	addr=symbol_value("cpu_online_map");
-	readmem(addr, KVADDR, &map,sizeof(long), "cpu_online_map",FAULT_ON_ERROR);
-	for(i = 0; i < sizeof(map)*8;i++){
-		if(map & 0x1UL)
-			cpu_num += 1;
-		map >>= 1;
-	}
-	return cpu_num;
+	return get_cpus_online();
 }
 
 /*
Index: crash-4.0-8.9/s390x.c
===================================================================
--- crash-4.0-8.9.orig/s390x.c
+++ crash-4.0-8.9/s390x.c
@@ -1029,16 +1029,7 @@ s390x_dis_filter(ulong vaddr, char *inbu
 int
 s390x_get_smp_cpus(void)
 {
-	unsigned long map = 0, addr;
-	int i, cpu_num = 0;
-	addr=symbol_value("cpu_online_map");
-	readmem(addr, KVADDR, &map,sizeof(long), "cpu_online_map",FAULT_ON_ERROR);
-	for(i = 0; i < sizeof(map)*8;i++){
-		if(map & 0x1UL)
-			cpu_num += 1;
-		map >>= 1;
-	}
-	return cpu_num;
+	return get_cpus_online();
 }
 
 /*

> Also, the attached patch contains the changes for searching
> for kernel module debuginfo files in the same directory tree
> specified with "mod -S <directory>".  Alternatively there
> is a new "crash --mod <directory>" command line option, such
> that "mod -S" with no directory argument will default to
> searching the command-line specified directory.

Works fine, thanks!

> Anyway, I've only tested this on older kernels that still have
> the  "cpu_xxxx_map" symbols.  Can you test the patch on new
> kernels?

I did some successful tests on 2.6.29 kernels (s390x).

> And also let me know whether the s390[x] functions
> should be updated.

Yes, please update the s390(x) functions accordingly.

Michael

PS: I noticed some whitespace issues in your patch (blanks instead of
tabs). Maybe you could change that.




More information about the Crash-utility mailing list