fadump.c (664b0bae0b87f69bc9deb098f5e0158b9cf18e04) | fadump.c (b71a693d3db3abd1ddf7d29be967a1180c3ebb22) |
---|---|
1/* 2 * Firmware Assisted dump: A robust mechanism to get reliable kernel crash 3 * dump with assistance from firmware. This approach does not use kexec, 4 * instead firmware assists in booting the kdump kernel while preserving 5 * memory contents. The most of the code implementation has been adapted 6 * from phyp assisted dump implementation written by Linas Vepstas and 7 * Manish Ahuja 8 * --- 321 unchanged lines hidden (view full) --- 330 size += sizeof(struct elf_phdr); /* place holder for cpu notes */ 331 /* Program headers for crash memory regions. */ 332 size += sizeof(struct elf_phdr) * (memblock_num_regions(memory) + 2); 333 334 size = PAGE_ALIGN(size); 335 return size; 336} 337 | 1/* 2 * Firmware Assisted dump: A robust mechanism to get reliable kernel crash 3 * dump with assistance from firmware. This approach does not use kexec, 4 * instead firmware assists in booting the kdump kernel while preserving 5 * memory contents. The most of the code implementation has been adapted 6 * from phyp assisted dump implementation written by Linas Vepstas and 7 * Manish Ahuja 8 * --- 321 unchanged lines hidden (view full) --- 330 size += sizeof(struct elf_phdr); /* place holder for cpu notes */ 331 /* Program headers for crash memory regions. */ 332 size += sizeof(struct elf_phdr) * (memblock_num_regions(memory) + 2); 333 334 size = PAGE_ALIGN(size); 335 return size; 336} 337 |
338static void __init fadump_reserve_crash_area(unsigned long base, 339 unsigned long size) 340{ 341 struct memblock_region *reg; 342 unsigned long mstart, mend, msize; 343 344 for_each_memblock(memory, reg) { 345 mstart = max_t(unsigned long, base, reg->base); 346 mend = reg->base + reg->size; 347 mend = min(base + size, mend); 348 349 if (mstart < mend) { 350 msize = mend - mstart; 351 memblock_reserve(mstart, msize); 352 pr_info("Reserved %ldMB of memory at %#016lx for saving crash dump\n", 353 (msize >> 20), mstart); 354 } 355 } 356} 357 |
|
338int __init fadump_reserve_mem(void) 339{ 340 unsigned long base, size, memory_boundary; 341 342 if (!fw_dump.fadump_enabled) 343 return 0; 344 345 if (!fw_dump.fadump_supported) { --- 29 unchanged lines hidden (view full) --- 375 " dump, now %#016llx\n", memory_limit); 376 } 377 if (memory_limit) 378 memory_boundary = memory_limit; 379 else 380 memory_boundary = memblock_end_of_DRAM(); 381 382 if (fw_dump.dump_active) { | 358int __init fadump_reserve_mem(void) 359{ 360 unsigned long base, size, memory_boundary; 361 362 if (!fw_dump.fadump_enabled) 363 return 0; 364 365 if (!fw_dump.fadump_supported) { --- 29 unchanged lines hidden (view full) --- 395 " dump, now %#016llx\n", memory_limit); 396 } 397 if (memory_limit) 398 memory_boundary = memory_limit; 399 else 400 memory_boundary = memblock_end_of_DRAM(); 401 402 if (fw_dump.dump_active) { |
383 printk(KERN_INFO "Firmware-assisted dump is active.\n"); | 403 pr_info("Firmware-assisted dump is active.\n"); 404 |
384 /* 385 * If last boot has crashed then reserve all the memory 386 * above boot_memory_size so that we don't touch it until 387 * dump is written to disk by userspace tool. This memory 388 * will be released for general use once the dump is saved. 389 */ 390 base = fw_dump.boot_memory_size; 391 size = memory_boundary - base; | 405 /* 406 * If last boot has crashed then reserve all the memory 407 * above boot_memory_size so that we don't touch it until 408 * dump is written to disk by userspace tool. This memory 409 * will be released for general use once the dump is saved. 410 */ 411 base = fw_dump.boot_memory_size; 412 size = memory_boundary - base; |
392 memblock_reserve(base, size); 393 printk(KERN_INFO "Reserved %ldMB of memory at %ldMB " 394 "for saving crash dump\n", 395 (unsigned long)(size >> 20), 396 (unsigned long)(base >> 20)); | 413 fadump_reserve_crash_area(base, size); |
397 398 fw_dump.fadumphdr_addr = 399 be64_to_cpu(fdm_active->rmr_region.destination_address) + 400 be64_to_cpu(fdm_active->rmr_region.source_len); 401 pr_debug("fadumphdr_addr = %p\n", 402 (void *) fw_dump.fadumphdr_addr); 403 } else { 404 size = get_fadump_area_size(); --- 1095 unchanged lines hidden --- | 414 415 fw_dump.fadumphdr_addr = 416 be64_to_cpu(fdm_active->rmr_region.destination_address) + 417 be64_to_cpu(fdm_active->rmr_region.source_len); 418 pr_debug("fadumphdr_addr = %p\n", 419 (void *) fw_dump.fadumphdr_addr); 420 } else { 421 size = get_fadump_area_size(); --- 1095 unchanged lines hidden --- |