Skip to contentSkip to conversation

kexec: check if memory is reserved only when loading kdump kernel.

PATCH Applied WANG Chao 2 participants 2 messages May 14, 2013 – May 15, 2013

Subsystems (2)
lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH 1/1 kexec: check if memory is reserved only when loading kdump kernel.

When memory for crashkernel isn't reserved, it's confusing that kexec spits error message for unloading kdump kernel as if we were loading it:

  # kexec -p -u
  Memory for crashkernel is not reserved
  Please reserve memory by passing "crashkernel=X@Y" parameter to the kernel
  Then try loading kdump kernel
  # echo $?
  1

It's more appropriate to test if memory is reserved only when loading kdump kernel. With this patch:

  # kexec -p -u
  # echo $?
  0

It's also the same behavior with the case of trying to unload kernel from unloaded state.

---
 kexec/kexec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kexec/kexec.c +2 -1
index 911c0f6..6a13f79 100644
@@ -1175,7 +1175,8 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if ((kexec_flags & KEXEC_ON_CRASH) && !is_crashkernel_mem_reserved()) {
+	if (do_load && (kexec_flags & KEXEC_ON_CRASH) &&
+	    !is_crashkernel_mem_reserved()) {
 		die("Memory for crashkernel is not reserved\n"
 		    "Please reserve memory by passing"
 		    "\"crashkernel=X@Y\" parameter to kernel\n"
Signature · 7 lines
1.8.2.1


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Applied
#1 lore raw
Quoted 13 lines · WANG Chao

When memory for crashkernel isn't reserved, it's confusing that kexec spits error message for unloading kdump kernel as if we were loading it:

  # kexec -p -u
  Memory for crashkernel is not reserved
  Please reserve memory by passing "crashkernel=X@Y" parameter to the kernel
  Then try loading kdump kernel
  # echo $?
  1

It's more appropriate to test if memory is reserved only when loading kdump kernel. With this patch:

Quoted 8 lines
  # kexec -p -u
  # echo $?
  0

It's also the same behavior with the case of trying to unload kernel from unloaded state.

Thanks, applied.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec