[Crash-utility] [PATCH] CONFIG_SPARSEMEM for s390(x)
Dave Anderson
anderson at redhat.com
Fri Sep 5 11:06:55 UTC 2008
Michael Holzheu wrote:
> Hi Dave,
>
> Am Donnerstag, den 04.09.2008, 11:19 -0400 schrieb Dave Anderson:
>
> [snip]
>
>
>>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.
>>
>
>
> Right. Looks like we should check for NULL pointer instead of using
> IS_KVADDR(). Since the mem_sec array is static, it is initialized with
> zeroes. When I change the check, everything works fine.
Great -- the patch looks fine. Queued for the next release.
Thanks Michael,
Dave
>
> What about the following patch...
>
> ---
> 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/memory.c crash-4.0-7.1-sparse-mem-s390/memory.c
> --- crash-4.0-7.1/memory.c 2008-08-19 17:10:51.000000000 +0200
> +++ crash-4.0-7.1-sparse-mem-s390/memory.c 2008-09-05 14:48:10.000000000 +0200
> @@ -12653,7 +12653,7 @@ sparse_mem_init(void)
> char *
> read_mem_section(ulong addr)
> {
> - if (!IS_KVADDR(addr))
> + if (addr == 0)
> return 0;
>
> readmem(addr, KVADDR, vt->mem_section, SIZE(mem_section),
> @@ -12668,7 +12668,7 @@ nr_to_section(ulong nr)
> ulong addr;
> ulong *mem_sec = vt->mem_sec;
>
> - if (!IS_KVADDR(mem_sec[SECTION_NR_TO_ROOT(nr)]))
> + if (mem_sec[SECTION_NR_TO_ROOT(nr)] == 0)
> return 0;
>
> if (IS_SPARSEMEM_EX())
> 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-05 14:49:25.000000000 +0200
> @@ -130,6 +130,8 @@ 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:
> 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