Commit 162573937679ff36c9acd54268c047199dab564e
Committed by
Benjamin Herrenschmidt
1 parent
d34c5f26cf
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
fadump: Introduce cleanup routine to invalidate /proc/vmcore.
With the firmware-assisted dump support we don't require a reboot when we are in second kernel after crash. The second kernel after crash is a normal kernel boot and has knowledge about entire system RAM with the page tables initialized for entire system RAM. Hence once the dump is saved to disk, we can just release the reserved memory area for general use and continue with second kernel as production kernel. Hence when we release the reserved memory that contains dump data, the '/proc/vmcore' will not be valid anymore. Hence this patch introduces a cleanup routine that invalidates and removes the /proc/vmcore file. This routine will be invoked before we release the reserved dump memory area. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Showing 1 changed file with 23 additions and 0 deletions Side-by-side Diff
fs/proc/vmcore.c
... | ... | @@ -700,4 +700,27 @@ |
700 | 700 | return 0; |
701 | 701 | } |
702 | 702 | module_init(vmcore_init) |
703 | + | |
704 | +/* Cleanup function for vmcore module. */ | |
705 | +void vmcore_cleanup(void) | |
706 | +{ | |
707 | + struct list_head *pos, *next; | |
708 | + | |
709 | + if (proc_vmcore) { | |
710 | + remove_proc_entry(proc_vmcore->name, proc_vmcore->parent); | |
711 | + proc_vmcore = NULL; | |
712 | + } | |
713 | + | |
714 | + /* clear the vmcore list. */ | |
715 | + list_for_each_safe(pos, next, &vmcore_list) { | |
716 | + struct vmcore *m; | |
717 | + | |
718 | + m = list_entry(pos, struct vmcore, list); | |
719 | + list_del(&m->list); | |
720 | + kfree(m); | |
721 | + } | |
722 | + kfree(elfcorebuf); | |
723 | + elfcorebuf = NULL; | |
724 | +} | |
725 | +EXPORT_SYMBOL_GPL(vmcore_cleanup); |