Michael Holzheu wrote:
 Hi Dave,
 
 When starting crash on s390(x) with CONFIG_SPARSEMEM enabled we get the
 following error message:
 
 crash: CONFIG_SPARSEMEM kernels not supported for this architecture
 
 The following patch fixes this problem, but I am not sure, if I set
 _MAX_PHYSMEM_BITS to the correct value (I used 31 for s390 and 64 for
 s390x). Could you please explain the meaning of _MAX_PHSYSMEM_BITS?
 --- 
Hi Michael,
Actually, the originator of CONFIG_SPARSEMENT support is your IBM compatriot,
and can probably answer this best:
   4.0-2.22 - Incorporated initial patch-set to implement support for kernels built
              with CONFIG_SPARSEMEM.  (dwilder(a)us.ibm.com)
             ...
Dave is still listed as a member of this mailing list.
Anyway, as I understand it, the _MAX_PHYSMEM_BITS() macro for each architecture
is a clone of the kernel's per-arch MAX_PHYSMEM_BITS #define.  For the s390
arch, it's found in "include/asm-s390/sparsemem.h":
   #ifndef _ASM_S390_SPARSEMEM_H
   #define _ASM_S390_SPARSEMEM_H
   #define SECTION_SIZE_BITS       25
   #ifdef CONFIG_64BIT
   #define MAX_PHYSADDR_BITS       42
   #define MAX_PHYSMEM_BITS        42
   #else
   #define MAX_PHYSADDR_BITS       31
   #define MAX_PHYSMEM_BITS        31
   #endif /* CONFIG_64BIT */
   #endif /* _ASM_S390_SPARSEMEM_H */
And it -- along with SECTION_SIZE_BITS -- fits into the math for the SECTIONS_SHIFT value
in "include/linux/mmzone.h":
   SECTIONS_SHIFT     839 #define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
And so the crash utility follows its lead:
   #define SECTION_SIZE_BITS()     (machdep->section_size_bits)
   #define MAX_PHYSMEM_BITS()      (machdep->max_physmem_bits)
   #define SECTIONS_SHIFT()        (MAX_PHYSMEM_BITS() - SECTION_SIZE_BITS())
and also using the arch-specific SECTION_SIZE_BITS() in the same manner.
So I'm surprised that your patch "works"?  It would seem that it would need
to:
(1) to use "42" for the s390x _MAX_PHYSMEM_BITS, and
(2) you would also need to #define a _SECTION_SIZE_BITS value for the two
     architectures as well.
Dave
 
 diff -Naurp crash-4.0-6.3/defs.h crash-4.0-6.3-config-sparse/defs.h
 --- crash-4.0-6.3/defs.h	2008-04-29 19:39:17.000000000 +0200
 +++ crash-4.0-6.3-config-sparse/defs.h	2008-08-12 17:03:54.000000000 +0200
 @@ -2634,6 +2634,8 @@ struct efi_memory_desc_t {
  
  #define TIF_SIGPENDING (2)
  
 +#define _MAX_PHYSMEM_BITS	31
 +
  #endif  /* S390 */
  
  #ifdef S390X
 @@ -2656,6 +2658,8 @@ struct efi_memory_desc_t {
  
  #define TIF_SIGPENDING (2)
  
 +#define _MAX_PHYSMEM_BITS	64
 +
  #endif  /* S390X */
  
  #ifdef PLATFORM
 diff -Naurp crash-4.0-6.3/s390.c crash-4.0-6.3-config-sparse/s390.c
 --- crash-4.0-6.3/s390.c	2008-04-29 19:39:17.000000000 +0200
 +++ crash-4.0-6.3-config-sparse/s390.c	2008-08-12 17:04:03.000000000 +0200
 @@ -130,6 +130,7 @@ s390_init(int when)
  		machdep->dump_irq = s390_dump_irq;
  		if (!machdep->hz)
  			machdep->hz = HZ;
 +		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
  		break;
  
  	case POST_INIT:
 diff -Naurp crash-4.0-6.3/s390x.c crash-4.0-6.3-config-sparse/s390x.c
 --- crash-4.0-6.3/s390x.c	2008-04-29 19:39:16.000000000 +0200
 +++ crash-4.0-6.3-config-sparse/s390x.c	2008-08-12 17:04:01.000000000 +0200
 @@ -128,6 +128,7 @@ s390x_init(int when)
  		machdep->dump_irq = s390x_dump_irq;
  		if (!machdep->hz)
  			machdep->hz = HZ;
 +		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
  		break;
  
  	case POST_INIT: