diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/crash_dump.c | 11 | ||||
| -rw-r--r-- | kernel/kexec.c | 41 | ||||
| -rw-r--r-- | kernel/sysctl.c | 8 |
3 files changed, 40 insertions, 20 deletions
diff --git a/kernel/crash_dump.c b/kernel/crash_dump.c index 5f85690285d4..69ebf3380bac 100644 --- a/kernel/crash_dump.c +++ b/kernel/crash_dump.c | |||
| @@ -20,8 +20,15 @@ unsigned long saved_max_pfn; | |||
| 20 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | 20 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; |
| 21 | 21 | ||
| 22 | /* | 22 | /* |
| 23 | * stores the size of elf header of crash image | ||
| 24 | */ | ||
| 25 | unsigned long long elfcorehdr_size; | ||
| 26 | |||
| 27 | /* | ||
| 23 | * elfcorehdr= specifies the location of elf core header stored by the crashed | 28 | * elfcorehdr= specifies the location of elf core header stored by the crashed |
| 24 | * kernel. This option will be passed by kexec loader to the capture kernel. | 29 | * kernel. This option will be passed by kexec loader to the capture kernel. |
| 30 | * | ||
| 31 | * Syntax: elfcorehdr=[size[KMG]@]offset[KMG] | ||
| 25 | */ | 32 | */ |
| 26 | static int __init setup_elfcorehdr(char *arg) | 33 | static int __init setup_elfcorehdr(char *arg) |
| 27 | { | 34 | { |
| @@ -29,6 +36,10 @@ static int __init setup_elfcorehdr(char *arg) | |||
| 29 | if (!arg) | 36 | if (!arg) |
| 30 | return -EINVAL; | 37 | return -EINVAL; |
| 31 | elfcorehdr_addr = memparse(arg, &end); | 38 | elfcorehdr_addr = memparse(arg, &end); |
| 39 | if (*end == '@') { | ||
| 40 | elfcorehdr_size = elfcorehdr_addr; | ||
| 41 | elfcorehdr_addr = memparse(end + 1, &end); | ||
| 42 | } | ||
| 32 | return end > arg ? 0 : -EINVAL; | 43 | return end > arg ? 0 : -EINVAL; |
| 33 | } | 44 | } |
| 34 | early_param("elfcorehdr", setup_elfcorehdr); | 45 | early_param("elfcorehdr", setup_elfcorehdr); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 296fbc84d659..dc7bc0829286 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -498,7 +498,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, | |||
| 498 | while (hole_end <= crashk_res.end) { | 498 | while (hole_end <= crashk_res.end) { |
| 499 | unsigned long i; | 499 | unsigned long i; |
| 500 | 500 | ||
| 501 | if (hole_end > KEXEC_CONTROL_MEMORY_LIMIT) | 501 | if (hole_end > KEXEC_CRASH_CONTROL_MEMORY_LIMIT) |
| 502 | break; | 502 | break; |
| 503 | if (hole_end > crashk_res.end) | 503 | if (hole_end > crashk_res.end) |
| 504 | break; | 504 | break; |
| @@ -999,6 +999,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, | |||
| 999 | kimage_free(xchg(&kexec_crash_image, NULL)); | 999 | kimage_free(xchg(&kexec_crash_image, NULL)); |
| 1000 | result = kimage_crash_alloc(&image, entry, | 1000 | result = kimage_crash_alloc(&image, entry, |
| 1001 | nr_segments, segments); | 1001 | nr_segments, segments); |
| 1002 | crash_map_reserved_pages(); | ||
| 1002 | } | 1003 | } |
| 1003 | if (result) | 1004 | if (result) |
| 1004 | goto out; | 1005 | goto out; |
| @@ -1015,6 +1016,8 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, | |||
| 1015 | goto out; | 1016 | goto out; |
| 1016 | } | 1017 | } |
| 1017 | kimage_terminate(image); | 1018 | kimage_terminate(image); |
| 1019 | if (flags & KEXEC_ON_CRASH) | ||
| 1020 | crash_unmap_reserved_pages(); | ||
| 1018 | } | 1021 | } |
| 1019 | /* Install the new kernel, and Uninstall the old */ | 1022 | /* Install the new kernel, and Uninstall the old */ |
| 1020 | image = xchg(dest_image, image); | 1023 | image = xchg(dest_image, image); |
| @@ -1026,6 +1029,18 @@ out: | |||
| 1026 | return result; | 1029 | return result; |
| 1027 | } | 1030 | } |
| 1028 | 1031 | ||
| 1032 | /* | ||
| 1033 | * Add and remove page tables for crashkernel memory | ||
| 1034 | * | ||
| 1035 | * Provide an empty default implementation here -- architecture | ||
| 1036 | * code may override this | ||
| 1037 | */ | ||
| 1038 | void __weak crash_map_reserved_pages(void) | ||
| 1039 | {} | ||
| 1040 | |||
| 1041 | void __weak crash_unmap_reserved_pages(void) | ||
| 1042 | {} | ||
| 1043 | |||
| 1029 | #ifdef CONFIG_COMPAT | 1044 | #ifdef CONFIG_COMPAT |
| 1030 | asmlinkage long compat_sys_kexec_load(unsigned long entry, | 1045 | asmlinkage long compat_sys_kexec_load(unsigned long entry, |
| 1031 | unsigned long nr_segments, | 1046 | unsigned long nr_segments, |
| @@ -1134,14 +1149,16 @@ int crash_shrink_memory(unsigned long new_size) | |||
| 1134 | goto unlock; | 1149 | goto unlock; |
| 1135 | } | 1150 | } |
| 1136 | 1151 | ||
| 1137 | start = roundup(start, PAGE_SIZE); | 1152 | start = roundup(start, KEXEC_CRASH_MEM_ALIGN); |
| 1138 | end = roundup(start + new_size, PAGE_SIZE); | 1153 | end = roundup(start + new_size, KEXEC_CRASH_MEM_ALIGN); |
| 1139 | 1154 | ||
| 1155 | crash_map_reserved_pages(); | ||
| 1140 | crash_free_reserved_phys_range(end, crashk_res.end); | 1156 | crash_free_reserved_phys_range(end, crashk_res.end); |
| 1141 | 1157 | ||
| 1142 | if ((start == end) && (crashk_res.parent != NULL)) | 1158 | if ((start == end) && (crashk_res.parent != NULL)) |
| 1143 | release_resource(&crashk_res); | 1159 | release_resource(&crashk_res); |
| 1144 | crashk_res.end = end - 1; | 1160 | crashk_res.end = end - 1; |
| 1161 | crash_unmap_reserved_pages(); | ||
| 1145 | 1162 | ||
| 1146 | unlock: | 1163 | unlock: |
| 1147 | mutex_unlock(&kexec_mutex); | 1164 | mutex_unlock(&kexec_mutex); |
| @@ -1380,24 +1397,23 @@ int __init parse_crashkernel(char *cmdline, | |||
| 1380 | } | 1397 | } |
| 1381 | 1398 | ||
| 1382 | 1399 | ||
| 1383 | 1400 | static void update_vmcoreinfo_note(void) | |
| 1384 | void crash_save_vmcoreinfo(void) | ||
| 1385 | { | 1401 | { |
| 1386 | u32 *buf; | 1402 | u32 *buf = vmcoreinfo_note; |
| 1387 | 1403 | ||
| 1388 | if (!vmcoreinfo_size) | 1404 | if (!vmcoreinfo_size) |
| 1389 | return; | 1405 | return; |
| 1390 | |||
| 1391 | vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); | ||
| 1392 | |||
| 1393 | buf = (u32 *)vmcoreinfo_note; | ||
| 1394 | |||
| 1395 | buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data, | 1406 | buf = append_elf_note(buf, VMCOREINFO_NOTE_NAME, 0, vmcoreinfo_data, |
| 1396 | vmcoreinfo_size); | 1407 | vmcoreinfo_size); |
| 1397 | |||
| 1398 | final_note(buf); | 1408 | final_note(buf); |
| 1399 | } | 1409 | } |
| 1400 | 1410 | ||
| 1411 | void crash_save_vmcoreinfo(void) | ||
| 1412 | { | ||
| 1413 | vmcoreinfo_append_str("CRASHTIME=%ld", get_seconds()); | ||
| 1414 | update_vmcoreinfo_note(); | ||
| 1415 | } | ||
| 1416 | |||
| 1401 | void vmcoreinfo_append_str(const char *fmt, ...) | 1417 | void vmcoreinfo_append_str(const char *fmt, ...) |
| 1402 | { | 1418 | { |
| 1403 | va_list args; | 1419 | va_list args; |
| @@ -1483,6 +1499,7 @@ static int __init crash_save_vmcoreinfo_init(void) | |||
| 1483 | VMCOREINFO_NUMBER(PG_swapcache); | 1499 | VMCOREINFO_NUMBER(PG_swapcache); |
| 1484 | 1500 | ||
| 1485 | arch_crash_save_vmcoreinfo(); | 1501 | arch_crash_save_vmcoreinfo(); |
| 1502 | update_vmcoreinfo_note(); | ||
| 1486 | 1503 | ||
| 1487 | return 0; | 1504 | return 0; |
| 1488 | } | 1505 | } |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index c49d66658ec0..ae2719643854 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -153,14 +153,6 @@ extern int pwrsw_enabled; | |||
| 153 | extern int unaligned_enabled; | 153 | extern int unaligned_enabled; |
| 154 | #endif | 154 | #endif |
| 155 | 155 | ||
| 156 | #ifdef CONFIG_S390 | ||
| 157 | #ifdef CONFIG_MATHEMU | ||
| 158 | extern int sysctl_ieee_emulation_warnings; | ||
| 159 | #endif | ||
| 160 | extern int sysctl_userprocess_debug; | ||
| 161 | extern int spin_retry; | ||
| 162 | #endif | ||
| 163 | |||
| 164 | #ifdef CONFIG_IA64 | 156 | #ifdef CONFIG_IA64 |
| 165 | extern int no_unaligned_warning; | 157 | extern int no_unaligned_warning; |
| 166 | extern int unaligned_dump_stack; | 158 | extern int unaligned_dump_stack; |
