All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2 1/2] kexec: add a dummy note for each offline cpu
@ 2016-12-19  2:08 Pingfan Liu
  2016-12-19  2:08 ` [PATCHv2 2/2] [fs] proc/vmcore: check the dummy place holder for offline cpu to avoid warning Pingfan Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Pingfan Liu @ 2016-12-19  2:08 UTC (permalink / raw)
  To: kexec; +Cc: Xunlei Pang, Dave Young, kernelfans, Baoquan He

kexec-tools always allocates program headers for each present cpu. This
incurs zero PT_NOTE for offline cpu. We mark this case so that later,
the capture kernel can distinguish it from the mistake of allocated
program header.
The counterpart of the capture kernel comes in next patch.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
 include/uapi/linux/elf.h |  1 +
 kernel/kexec_core.c      | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index b59ee07..9744f1e 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -367,6 +367,7 @@ typedef struct elf64_shdr {
  * using the corresponding note types via the PTRACE_GETREGSET and
  * PTRACE_SETREGSET requests.
  */
+#define NT_DUMMY	0
 #define NT_PRSTATUS	1
 #define NT_PRFPREG	2
 #define NT_PRPSINFO	3
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 5616755..e41a736 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -891,9 +891,13 @@ void __crash_kexec(struct pt_regs *regs)
 	if (mutex_trylock(&kexec_mutex)) {
 		if (kexec_crash_image) {
 			struct pt_regs fixed_regs;
+			unsigned int cpu;
 
 			crash_setup_regs(&fixed_regs, regs);
 			crash_save_vmcoreinfo();
+			for_each_present_cpu(cpu)
+				if (!cpu_online(cpu))
+					crash_save_cpu(NULL, cpu);
 			machine_crash_shutdown(&fixed_regs);
 			machine_kexec(kexec_crash_image);
 		}
@@ -1040,6 +1044,12 @@ void crash_save_cpu(struct pt_regs *regs, int cpu)
 	buf = (u32 *)per_cpu_ptr(crash_notes, cpu);
 	if (!buf)
 		return;
+	if (regs == NULL) {
+		buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_DUMMY,
+				NULL, 0);
+		final_note(buf);
+		return;
+	}
 	memset(&prstatus, 0, sizeof(prstatus));
 	prstatus.pr_pid = current->pid;
 	elf_core_copy_kernel_regs(&prstatus.pr_reg, regs);
-- 
2.7.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-21  7:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19  2:08 [PATCHv2 1/2] kexec: add a dummy note for each offline cpu Pingfan Liu
2016-12-19  2:08 ` [PATCHv2 2/2] [fs] proc/vmcore: check the dummy place holder for offline cpu to avoid warning Pingfan Liu
2016-12-19  2:40   ` Dave Young
2016-12-20 15:38     ` Pratyush Anand
2016-12-21  3:26       ` Xunlei Pang
2016-12-21  3:57         ` Pratyush Anand
2016-12-21  4:52           ` Xunlei Pang
2016-12-21  7:15           ` Liu ping fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.