Skip to contentSkip to conversation

kexec: Make a pair of reserved pages when kdump fails to start

PATCH New Minfei Huang 1 participant 1 message Jun 25, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec: Make a pair of reserved pages when kdump fails to start

From: Minfei Huang <[email protected]>

For some arch, kexec shall map the reserved pages, then use them, when we try to start the kdump service.

Now kexec will never unmap the reserved pages, once it fails to continue starting the kdump service.

Make a pair of reserved pages in kdump starting path, whatever kexec fails or not.

---
 kernel/kexec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
kernel/kexec.c +8 -4
index 7a36fdc..ab32d59 100644
@@ -1308,19 +1308,23 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 			image->preserve_context = 1;
 		result = machine_kexec_prepare(image);
 		if (result)
-			goto out;
+			goto failure;
 
 		for (i = 0; i < nr_segments; i++) {
 			result = kimage_load_segment(image, &image->segment[i]);
 			if (result)
-				goto out;
+				goto failure;
 		}
 		kimage_terminate(image);
+
+failure:
 		if (flags & KEXEC_ON_CRASH)
 			crash_unmap_reserved_pages();
 	}
-	/* Install the new kernel, and  Uninstall the old */
-	image = xchg(dest_image, image);
+
+	if (result == 0)
+		/* Install the new kernel, and  Uninstall the old */
+		image = xchg(dest_image, image);
 
 out:
 	mutex_unlock(&kexec_mutex);
Signature · 1 line
2.2.2