[Crash-utility] [PATCH] CONFIG_SPARSEMEM for s390(x)

Dave Anderson anderson at redhat.com
Thu Sep 4 15:19:00 UTC 2008


Michael Holzheu wrote:
> Hi Dave,
> 
> Here the new patch.
> Unfortunately kmem -n reports an error...
> 
> crash> kmem -n
> NODE    SIZE      PGLIST_DATA       BOOTMEM_DATA       NODE_ZONES   
>   0    131071        4c9100            90c158            4c9100     
>                                                          4cd800
>                                                          4d1f00
>     MEM_MAP       START_PADDR  START_MAPNR
>   3e040000000          0            0     
> 
> ZONE  NAME         SIZE       MEM_MAP      START_PADDR  START_MAPNR
>   0   DMA        131071       3e040000000            0            0
>   1   Normal          0                 0            0            0
>   2   Movable         0                 0            0            0
> 
> -------------------------------------------------------------------
> 
> NR      SECTION        CODED_MEM_MAP        MEM_MAP       PFN
>  0       a3a800          3e040000000       3e040000000
> 0               
>  1       a3a810          3e040000000       3e040580000
> 65536           
> kmem: read error: kernel virtual address: 0  type: "memory section"

My guess is that it might have something to do with the zero-based kernel
virtual address space on s390/s390x.

I also guess that the trail would have been:

  cmd_kmem
   dump_memory_nodes
    dump_mem_sections
     section_mem_map_addr
       read_mem_section

where read_mem_section() can legitimately return if the addr
passed is not kernel virtual address of a mem_section structure:

   char *
   read_mem_section(ulong addr)
   {
           if (!IS_KVADDR(addr))
                   return 0;

           readmem(addr, KVADDR, vt->mem_section, SIZE(mem_section),
                   "memory section", FAULT_ON_ERROR);

           return vt->mem_section;
   }

But the s390/s390x implementation of IS_KVADDR() accepts a kernel
virtual address of zero.  It tries to read it and craps out.

I note that the kernel has this:

static inline int valid_section(struct mem_section *section)
{
         return (section && (section->section_mem_map & SECTION_MARKED_PRESENT));
}

which requires a non-zero section address for all arches.  I'm thinking that
if you make read_mem_section() above return 0 if addr is zero, then it might
fix it?

Dave



> 
> ---
> diff -Naurp crash-4.0-7.1/defs.h crash-4.0-7.1-sparse-mem-s390/defs.h
> --- crash-4.0-7.1/defs.h	2008-08-19 17:10:51.000000000 +0200
> +++ crash-4.0-7.1-sparse-mem-s390/defs.h	2008-09-04 18:24:10.000000000 +0200
> @@ -2636,6 +2636,9 @@ struct efi_memory_desc_t {
>  
>  #define TIF_SIGPENDING (2)
>  
> +#define _SECTION_SIZE_BITS	25
> +#define _MAX_PHYSMEM_BITS	31
> +
>  #endif  /* S390 */
>  
>  #ifdef S390X
> @@ -2658,6 +2661,9 @@ struct efi_memory_desc_t {
>  
>  #define TIF_SIGPENDING (2)
>  
> +#define _SECTION_SIZE_BITS	28
> +#define _MAX_PHYSMEM_BITS	42
> +
>  #endif  /* S390X */
>  
>  #ifdef PLATFORM
> diff -Naurp crash-4.0-7.1/s390.c crash-4.0-7.1-sparse-mem-s390/s390.c
> --- crash-4.0-7.1/s390.c	2008-08-19 17:10:51.000000000 +0200
> +++ crash-4.0-7.1-sparse-mem-s390/s390.c	2008-09-04 18:24:27.000000000 +0200
> @@ -130,11 +130,14 @@ s390_init(int when)
>  		machdep->dump_irq = s390_dump_irq;
>  		if (!machdep->hz)
>  			machdep->hz = HZ;
> +		machdep->section_size_bits = _SECTION_SIZE_BITS;
> +		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
>  		break;
>  
>  	case POST_INIT:
>  		break;
>  	}
> +
>  }
>  
>  /*
> diff -Naurp crash-4.0-7.1/s390x.c crash-4.0-7.1-sparse-mem-s390/s390x.c
> --- crash-4.0-7.1/s390x.c	2008-08-19 17:10:51.000000000 +0200
> +++ crash-4.0-7.1-sparse-mem-s390/s390x.c	2008-09-04 18:24:24.000000000 +0200
> @@ -128,6 +128,8 @@ s390x_init(int when)
>  		machdep->dump_irq = s390x_dump_irq;
>  		if (!machdep->hz)
>  			machdep->hz = HZ;
> +		machdep->section_size_bits = _SECTION_SIZE_BITS;
> +		machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
>  		break;
>  
>  	case POST_INIT:
> 
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list