From: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
To: "kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: Re: where/how 2nd kernel's elfcorehdr_addr comes from
Date: Sat, 5 Nov 2022 01:38:56 +0000 [thread overview]
Message-ID: <39ff647b-8250-45bb-73a3-c7a29f1d67b6@fujitsu.com> (raw)
In-Reply-To: <72d4be26-1711-aab8-50ed-8af538b4f6eb@fujitsu.com>
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
next prev parent reply other threads:[~2022-11-05 1:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 9:03 where/how 2nd kernel's elfcorehdr_addr comes from lizhijian
2022-11-05 1:38 ` lizhijian [this message]
2022-11-05 1:49 ` Baoquan He
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=39ff647b-8250-45bb-73a3-c7a29f1d67b6@fujitsu.com \
--to=lizhijian@fujitsu.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox