* where/how 2nd kernel's elfcorehdr_addr comes from
@ 2022-11-04 9:03 lizhijian
2022-11-05 1:38 ` lizhijian
2022-11-05 1:49 ` Baoquan He
0 siblings, 2 replies; 3+ messages in thread
From: lizhijian @ 2022-11-04 9:03 UTC (permalink / raw)
To: kexec@lists.infradead.org; +Cc: lizhijian@fujitsu.com
Hi folks,
I'm trying to add pmem's metadata(located at pmem device) to
/proc/vmcore. To accomplish this, I think
something i need to know is where the contents of /proc/vmcore come
from, and then append
something into it.
I have read
https://opensource.com/article/17/6/kdump-usage-and-internals, and knew
/proc/vmcore is a elf file.
It mentioned that "Creates /proc/vmcore as per elfcorehdr information
received", but i don't get how it
elfcorehdr(maybe elfcorehdr_addr) be assigned in 2nd kernel.
I tried to grep it in the kernel source, but still no answer. So i deep
hope you guys can give me some hints or answer.
and thank you in advance :)
[root@iaas-rpma linux]# git grep elfcorehdr_addr | grep -v -w -e ia64 -e
loongarch -e mips -e powerpc -e riscv
arch/s390/kernel/setup.c: elfcorehdr_addr = ELFCORE_ADDR_MAX;
drivers/of/fdt.c: if (memblock_is_region_reserved(elfcorehdr_addr,
elfcorehdr_size)) {
drivers/of/fdt.c: memblock_reserve(elfcorehdr_addr, elfcorehdr_size);
drivers/of/fdt.c: elfcorehdr_size >> 10, elfcorehdr_addr);
drivers/of/fdt.c: elfcorehdr_addr =
dt_mem_next_cell(dt_root_addr_cells, &prop);
drivers/of/fdt.c: elfcorehdr_addr, elfcorehdr_size);
fs/proc/vmcore.c: addr = elfcorehdr_addr;
fs/proc/vmcore.c: addr = elfcorehdr_addr;
fs/proc/vmcore.c: addr = elfcorehdr_addr;
fs/proc/vmcore.c: addr = elfcorehdr_addr;
fs/proc/vmcore.c: addr = elfcorehdr_addr;
fs/proc/vmcore.c: rc = elfcorehdr_alloc(&elfcorehdr_addr,
&elfcorehdr_size);
fs/proc/vmcore.c: elfcorehdr_free(elfcorehdr_addr);
fs/proc/vmcore.c: elfcorehdr_addr = ELFCORE_ADDR_ERR;
include/linux/crash_dump.h:extern unsigned long long elfcorehdr_addr;
include/linux/crash_dump.h: return elfcorehdr_addr != ELFCORE_ADDR_MAX;
include/linux/crash_dump.h: return is_kdump_kernel() &&
elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0;
include/linux/crash_dump.h: elfcorehdr_addr = ELFCORE_ADDR_ERR;
kernel/crash_dump.c: * Note: elfcorehdr_addr is not just limited to
vmcore. It is also used by
kernel/crash_dump.c:unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
kernel/crash_dump.c:EXPORT_SYMBOL_GPL(elfcorehdr_addr);
kernel/crash_dump.c: elfcorehdr_addr = memparse(arg, &end);
kernel/crash_dump.c: elfcorehdr_size = elfcorehdr_addr;
kernel/crash_dump.c: elfcorehdr_addr = memparse(end + 1, &end);
Thanks
Zhijian
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: where/how 2nd kernel's elfcorehdr_addr comes from
2022-11-04 9:03 where/how 2nd kernel's elfcorehdr_addr comes from lizhijian
@ 2022-11-05 1:38 ` lizhijian
2022-11-05 1:49 ` Baoquan He
1 sibling, 0 replies; 3+ messages in thread
From: lizhijian @ 2022-11-05 1:38 UTC (permalink / raw)
To: kexec@lists.infradead.org
On 04/11/2022 17:03, Li, Zhijian/李 智坚 wrote:
> Hi folks,
>
> I'm trying to add pmem's metadata(located at pmem device) to
> /proc/vmcore. To accomplish this, I think
>
> something i need to know is where the contents of /proc/vmcore come
> from, and then append
>
> something into it.
>
> I have read
> https://opensource.com/article/17/6/kdump-usage-and-internals, and knew
> /proc/vmcore is a elf file.
>
> It mentioned that "Creates /proc/vmcore as per elfcorehdr information
> received", but i don't get how it
>
> elfcorehdr(maybe elfcorehdr_addr) be assigned in 2nd kernel.
I got it, elfcorehdr comes from 1st kernel's kexec-tools which passes
elfcorehdr=xxx to 2nd kernel
Thanks
>
> I tried to grep it in the kernel source, but still no answer. So i deep
> hope you guys can give me some hints or answer.
>
> and thank you in advance :)
>
> [root@iaas-rpma linux]# git grep elfcorehdr_addr | grep -v -w -e ia64 -e
> loongarch -e mips -e powerpc -e riscv
>
> arch/s390/kernel/setup.c: elfcorehdr_addr = ELFCORE_ADDR_MAX;
>
> drivers/of/fdt.c: if (memblock_is_region_reserved(elfcorehdr_addr,
> elfcorehdr_size)) {
>
> drivers/of/fdt.c: memblock_reserve(elfcorehdr_addr, elfcorehdr_size);
>
> drivers/of/fdt.c: elfcorehdr_size >> 10, elfcorehdr_addr);
>
> drivers/of/fdt.c: elfcorehdr_addr =
> dt_mem_next_cell(dt_root_addr_cells, &prop);
>
> drivers/of/fdt.c: elfcorehdr_addr, elfcorehdr_size);
>
> fs/proc/vmcore.c: addr = elfcorehdr_addr;
>
> fs/proc/vmcore.c: addr = elfcorehdr_addr;
>
> fs/proc/vmcore.c: addr = elfcorehdr_addr;
>
> fs/proc/vmcore.c: addr = elfcorehdr_addr;
>
> fs/proc/vmcore.c: addr = elfcorehdr_addr;
>
> fs/proc/vmcore.c: rc = elfcorehdr_alloc(&elfcorehdr_addr,
> &elfcorehdr_size);
>
> fs/proc/vmcore.c: elfcorehdr_free(elfcorehdr_addr);
>
> fs/proc/vmcore.c: elfcorehdr_addr = ELFCORE_ADDR_ERR;
>
> include/linux/crash_dump.h:extern unsigned long long elfcorehdr_addr;
>
> include/linux/crash_dump.h: return elfcorehdr_addr != ELFCORE_ADDR_MAX;
>
> include/linux/crash_dump.h: return is_kdump_kernel() &&
> elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0;
>
> include/linux/crash_dump.h: elfcorehdr_addr = ELFCORE_ADDR_ERR;
>
> kernel/crash_dump.c: * Note: elfcorehdr_addr is not just limited to
> vmcore. It is also used by
>
> kernel/crash_dump.c:unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
>
> kernel/crash_dump.c:EXPORT_SYMBOL_GPL(elfcorehdr_addr);
>
> kernel/crash_dump.c: elfcorehdr_addr = memparse(arg, &end);
>
> kernel/crash_dump.c: elfcorehdr_size = elfcorehdr_addr;
>
> kernel/crash_dump.c: elfcorehdr_addr = memparse(end + 1, &end);
>
> Thanks
>
> Zhijian
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: where/how 2nd kernel's elfcorehdr_addr comes from
2022-11-04 9:03 where/how 2nd kernel's elfcorehdr_addr comes from lizhijian
2022-11-05 1:38 ` lizhijian
@ 2022-11-05 1:49 ` Baoquan He
1 sibling, 0 replies; 3+ messages in thread
From: Baoquan He @ 2022-11-05 1:49 UTC (permalink / raw)
To: lizhijian@fujitsu.com; +Cc: kexec@lists.infradead.org
On 11/04/22 at 09:03am, lizhijian@fujitsu.com wrote:
> Hi folks,
>
> I'm trying to add pmem's metadata(located at pmem device) to
> /proc/vmcore. To accomplish this, I think
>
> something i need to know is where the contents of /proc/vmcore come
> from, and then append
>
> something into it.
>
> I have read
> https://opensource.com/article/17/6/kdump-usage-and-internals, and knew
> /proc/vmcore is a elf file.
>
> It mentioned that "Creates /proc/vmcore as per elfcorehdr information
> received", but i don't get how it
>
> elfcorehdr(maybe elfcorehdr_addr) be assigned in 2nd kernel.
>
> I tried to grep it in the kernel source, but still no answer. So i deep
> hope you guys can give me some hints or answer.
Since you have studied this, so:
crash_prepare_elf64_headers() is the place where elf header of vmcore is
contructed in 1st kernel. And in crash_load_segments() it's prepared to
be passed out. I am talking about x86, and kexec_file load. You should
be able to find the similar thing in user space code.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-05 1:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04 9:03 where/how 2nd kernel's elfcorehdr_addr comes from lizhijian
2022-11-05 1:38 ` lizhijian
2022-11-05 1:49 ` Baoquan He
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox