]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/kexec.c
kdump: add missing RAM resource in crash_shrink_memory()
[karo-tx-linux.git] / kernel / kexec.c
index dc7bc0829286d60cd5e37e162441bdc7a8d12b46..60bf181b3eaed859dc7ae63f0338c01c4cfaed0d 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/console.h>
 #include <linux/vmalloc.h>
 #include <linux/swap.h>
-#include <linux/kmsg_dump.h>
 #include <linux/syscore_ops.h>
 
 #include <asm/page.h>
@@ -1094,8 +1093,6 @@ void crash_kexec(struct pt_regs *regs)
                if (kexec_crash_image) {
                        struct pt_regs fixed_regs;
 
-                       kmsg_dump(KMSG_DUMP_KEXEC);
-
                        crash_setup_regs(&fixed_regs, regs);
                        crash_save_vmcoreinfo();
                        machine_crash_shutdown(&fixed_regs);
@@ -1132,6 +1129,7 @@ int crash_shrink_memory(unsigned long new_size)
 {
        int ret = 0;
        unsigned long start, end;
+       struct resource *ram_res;
 
        mutex_lock(&kexec_mutex);
 
@@ -1149,6 +1147,12 @@ int crash_shrink_memory(unsigned long new_size)
                goto unlock;
        }
 
+       ram_res = kzalloc(sizeof(*ram_res), GFP_KERNEL);
+       if (!ram_res) {
+               ret = -ENOMEM;
+               goto unlock;
+       }
+
        start = roundup(start, KEXEC_CRASH_MEM_ALIGN);
        end = roundup(start + new_size, KEXEC_CRASH_MEM_ALIGN);
 
@@ -1157,7 +1161,15 @@ int crash_shrink_memory(unsigned long new_size)
 
        if ((start == end) && (crashk_res.parent != NULL))
                release_resource(&crashk_res);
+
+       ram_res->start = end;
+       ram_res->end = crashk_res.end;
+       ram_res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
+       ram_res->name = "System RAM";
+
        crashk_res.end = end - 1;
+
+       insert_resource(&iomem_resource, ram_res);
        crash_unmap_reserved_pages();
 
 unlock:
@@ -1523,7 +1535,7 @@ int kernel_kexec(void)
 
 #ifdef CONFIG_KEXEC_JUMP
        if (kexec_image->preserve_context) {
-               mutex_lock(&pm_mutex);
+               lock_system_sleep();
                pm_prepare_console();
                error = freeze_processes();
                if (error) {
@@ -1576,7 +1588,7 @@ int kernel_kexec(void)
                thaw_processes();
  Restore_console:
                pm_restore_console();
-               mutex_unlock(&pm_mutex);
+               unlock_system_sleep();
        }
 #endif