]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: sclp: consider "mem=" kernel parameter for standby memory | |
3 | References: bnc#477666,LTC#51741 | |
4 | ||
5 | Symptom: zfcpdump exits with "panic: out of memory" | |
6 | Problem: Standby memory detected with the sclp interface always gets | |
7 | registered with add_memory calls without considering the | |
8 | limitations that the "mem=" kernel paramater imply. | |
9 | zfcpdump uses "mem=32M". In case there is approximately 2GB of | |
10 | standby memory present all usable memory will be used for | |
11 | struct pages needed for standby memory. This in turn leads | |
12 | to an early out of memory situation and a panic. | |
13 | Solution: Only register standby memory that is below the address specified | |
14 | with the "mem=" kernel parameter. | |
15 | ||
16 | Acked-by: John Jolly <jjolly@suse.de> | |
17 | --- | |
18 | arch/s390/include/asm/setup.h | 2 ++ | |
19 | arch/s390/kernel/setup.c | 9 +++++++-- | |
20 | drivers/s390/char/sclp_cmd.c | 5 +++++ | |
21 | 3 files changed, 14 insertions(+), 2 deletions(-) | |
22 | ||
23 | Index: linux-sles11/arch/s390/include/asm/setup.h | |
24 | =================================================================== | |
25 | --- linux-sles11.orig/arch/s390/include/asm/setup.h | |
26 | +++ linux-sles11/arch/s390/include/asm/setup.h | |
27 | @@ -43,6 +43,8 @@ struct mem_chunk { | |
28 | ||
29 | extern struct mem_chunk memory_chunk[]; | |
30 | extern unsigned long real_memory_size; | |
31 | +extern int memory_end_set; | |
32 | +extern unsigned long memory_end; | |
33 | ||
34 | void detect_memory_layout(struct mem_chunk chunk[]); | |
35 | ||
36 | Index: linux-sles11/arch/s390/kernel/setup.c | |
37 | =================================================================== | |
38 | --- linux-sles11.orig/arch/s390/kernel/setup.c | |
39 | +++ linux-sles11/arch/s390/kernel/setup.c | |
40 | @@ -81,7 +81,9 @@ char elf_platform[ELF_PLATFORM_SIZE]; | |
41 | ||
42 | struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; | |
43 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ | |
44 | -static unsigned long __initdata memory_end; | |
45 | + | |
46 | +int __initdata memory_end_set; | |
47 | +unsigned long __initdata memory_end; | |
48 | ||
49 | /* | |
50 | * This is set up by the setup-routine at boot-time | |
51 | @@ -280,6 +282,7 @@ void (*pm_power_off)(void) = machine_pow | |
52 | static int __init early_parse_mem(char *p) | |
53 | { | |
54 | memory_end = memparse(p, &p); | |
55 | + memory_end_set = 1; | |
56 | return 0; | |
57 | } | |
58 | early_param("mem", early_parse_mem); | |
59 | @@ -501,8 +504,10 @@ static void __init setup_memory_end(void | |
60 | int i; | |
61 | ||
62 | #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) | |
63 | - if (ipl_info.type == IPL_TYPE_FCP_DUMP) | |
64 | + if (ipl_info.type == IPL_TYPE_FCP_DUMP) { | |
65 | memory_end = ZFCPDUMP_HSA_SIZE; | |
66 | + memory_end_set = 1; | |
67 | + } | |
68 | #endif | |
69 | memory_size = 0; | |
70 | memory_end &= PAGE_MASK; | |
71 | Index: linux-sles11/drivers/s390/char/sclp_cmd.c | |
72 | =================================================================== | |
73 | --- linux-sles11.orig/drivers/s390/char/sclp_cmd.c | |
74 | +++ linux-sles11/drivers/s390/char/sclp_cmd.c | |
75 | @@ -18,6 +18,7 @@ | |
76 | #include <linux/memory.h> | |
77 | #include <asm/chpid.h> | |
78 | #include <asm/sclp.h> | |
79 | +#include <asm/setup.h> | |
80 | ||
81 | #include "sclp.h" | |
82 | ||
83 | @@ -470,6 +471,10 @@ static void __init add_memory_merged(u16 | |
84 | goto skip_add; | |
85 | if (start + size > VMEM_MAX_PHYS) | |
86 | size = VMEM_MAX_PHYS - start; | |
87 | + if (memory_end_set && (start >= memory_end)) | |
88 | + goto skip_add; | |
89 | + if (memory_end_set && (start + size > memory_end)) | |
90 | + size = memory_end - start; | |
91 | add_memory(0, start, size); | |
92 | skip_add: | |
93 | first_rn = rn; |