|
14 | 14 | #include <asm/sections.h> |
15 | 15 |
|
16 | 16 | /* vmcoreinfo stuff */ |
17 | | -static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES]; |
18 | | -u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; |
| 17 | +static unsigned char *vmcoreinfo_data; |
19 | 18 | size_t vmcoreinfo_size; |
20 | | -size_t vmcoreinfo_max_size = sizeof(vmcoreinfo_data); |
| 19 | +size_t vmcoreinfo_max_size = VMCOREINFO_BYTES; |
| 20 | +u32 *vmcoreinfo_note; |
21 | 21 |
|
22 | 22 | /* |
23 | 23 | * parsing the "crashkernel" commandline |
@@ -326,6 +326,9 @@ static void update_vmcoreinfo_note(void) |
326 | 326 |
|
327 | 327 | void crash_save_vmcoreinfo(void) |
328 | 328 | { |
| 329 | + if (!vmcoreinfo_note) |
| 330 | + return; |
| 331 | + |
329 | 332 | vmcoreinfo_append_str("CRASHTIME=%ld\n", get_seconds()); |
330 | 333 | update_vmcoreinfo_note(); |
331 | 334 | } |
@@ -356,11 +359,26 @@ void __weak arch_crash_save_vmcoreinfo(void) |
356 | 359 |
|
357 | 360 | phys_addr_t __weak paddr_vmcoreinfo_note(void) |
358 | 361 | { |
359 | | - return __pa_symbol((unsigned long)(char *)&vmcoreinfo_note); |
| 362 | + return __pa(vmcoreinfo_note); |
360 | 363 | } |
361 | 364 |
|
362 | 365 | static int __init crash_save_vmcoreinfo_init(void) |
363 | 366 | { |
| 367 | + vmcoreinfo_data = (unsigned char *)get_zeroed_page(GFP_KERNEL); |
| 368 | + if (!vmcoreinfo_data) { |
| 369 | + pr_warn("Memory allocation for vmcoreinfo_data failed\n"); |
| 370 | + return -ENOMEM; |
| 371 | + } |
| 372 | + |
| 373 | + vmcoreinfo_note = alloc_pages_exact(VMCOREINFO_NOTE_SIZE, |
| 374 | + GFP_KERNEL | __GFP_ZERO); |
| 375 | + if (!vmcoreinfo_note) { |
| 376 | + free_page((unsigned long)vmcoreinfo_data); |
| 377 | + vmcoreinfo_data = NULL; |
| 378 | + pr_warn("Memory allocation for vmcoreinfo_note failed\n"); |
| 379 | + return -ENOMEM; |
| 380 | + } |
| 381 | + |
364 | 382 | VMCOREINFO_OSRELEASE(init_uts_ns.name.release); |
365 | 383 | VMCOREINFO_PAGESIZE(PAGE_SIZE); |
366 | 384 |
|
|
0 commit comments