Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric DeVolder <eric.devolder@oracle.com>
To: Sourabh Jain <sourabhjain@linux.ibm.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	kexec@lists.infradead.org, ebiederm@xmission.com,
	dyoung@redhat.com, bhe@redhat.com, vgoyal@redhat.com
Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	dave.hansen@linux.intel.com, hpa@zytor.com,
	nramas@linux.microsoft.com, thomas.lendacky@amd.com,
	robh@kernel.org, efault@gmx.de, rppt@kernel.org,
	david@redhat.com, konrad.wilk@oracle.com,
	boris.ostrovsky@oracle.com
Subject: Re: [PATCH v15 1/7] crash: move crash_prepare_elf64_headers()
Date: Mon, 9 Jan 2023 13:40:50 -0600	[thread overview]
Message-ID: <3c85676b-ded2-3941-6c57-5b11397cdd81@oracle.com> (raw)
In-Reply-To: <09567e13-c5ed-d1b9-027c-9340fce6a0a8@linux.ibm.com>



On 1/8/23 23:05, Sourabh Jain wrote:
> 
> On 09/12/22 21:06, Eric DeVolder wrote:
>> At the outcome of this patch set, the crash_prepare_elf64_headers()
>> is utilized on both the kexec_file_load() and kexec_load() paths. As
>> such, need to move this function out of kexec_file.c and into a
>> common location crash_core.c.
>>
>> No functionality change.
>>
>> Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
>> Acked-by: Baoquan He <bhe@redhat.com>
>> ---
>>   kernel/crash_core.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
>>   kernel/kexec_file.c |  99 -------------------------------------------
>>   2 files changed, 100 insertions(+), 99 deletions(-)
>>
>> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
>> index a0eb4d5cf557..46c160d14045 100644
>> --- a/kernel/crash_core.c
>> +++ b/kernel/crash_core.c
>> @@ -10,6 +10,7 @@
>>   #include <linux/utsname.h>
>>   #include <linux/vmalloc.h>
>>   #include <linux/sizes.h>
>> +#include <linux/kexec.h>
>>   #include <asm/page.h>
>>   #include <asm/sections.h>
>> @@ -314,6 +315,105 @@ static int __init parse_crashkernel_dummy(char *arg)
>>   }
>>   early_param("crashkernel", parse_crashkernel_dummy);
>> +int crash_prepare_elf64_headers(struct crash_mem *mem, int need_kernel_map,
>> +              void **addr, unsigned long *sz)
>> +{
>> +    Elf64_Ehdr *ehdr;
>> +    Elf64_Phdr *phdr;
>> +    unsigned long nr_cpus = num_possible_cpus(), nr_phdr, elf_sz;
>> +    unsigned char *buf;
>> +    unsigned int cpu, i;
>> +    unsigned long long notes_addr;
>> +    unsigned long mstart, mend;
>> +
>> +    /* extra phdr for vmcoreinfo ELF note */
>> +    nr_phdr = nr_cpus + 1;
>> +    nr_phdr += mem->nr_ranges;
>> +
>> +    /*
>> +     * kexec-tools creates an extra PT_LOAD phdr for kernel text mapping
>> +     * area (for example, ffffffff80000000 - ffffffffa0000000 on x86_64).
>> +     * I think this is required by tools like gdb. So same physical
>> +     * memory will be mapped in two ELF headers. One will contain kernel
>> +     * text virtual addresses and other will have __va(physical) addresses.
>> +     */
>> +
>> +    nr_phdr++;
>> +    elf_sz = sizeof(Elf64_Ehdr) + nr_phdr * sizeof(Elf64_Phdr);
>> +    elf_sz = ALIGN(elf_sz, ELF_CORE_HEADER_ALIGN);
> Seems like above function is out of CONFIG_KEXEC_FILE but some of the
> structure/attributes like crash_mem and ELF_CORE_HEADER_ALIGN are
> still defined under CONFIG_KEXEC_FILE (look for include/linux/kexec.h).
> 
> This leads to kernel build issue when CONFIG_KEXEC_FILE is disabled.
> 
> Thanks,
> Sourabh Jain
Thanks Sourabh, I'll look into this further.
eric

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

  reply	other threads:[~2023-01-09 19:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 15:36 [PATCH v15 0/7] crash: Kernel handling of CPU and memory hot un/plug Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 1/7] crash: move crash_prepare_elf64_headers() Eric DeVolder
2023-01-09  5:05   ` Sourabh Jain
2023-01-09 19:40     ` Eric DeVolder [this message]
2023-01-12 17:23     ` Eric DeVolder
2023-01-16 16:30       ` Petr Tesařík
2023-01-17 22:33       ` Eric DeVolder
2023-01-19  3:09       ` Sourabh Jain
2022-12-09 15:36 ` [PATCH v15 2/7] crash: prototype change for crash_prepare_elf64_headers() Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 3/7] crash: add generic infrastructure for crash hotplug support Eric DeVolder
2023-01-04  8:34   ` Baoquan He
2023-01-04 16:18     ` Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 4/7] kexec: exclude elfcorehdr from the segment digest Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 5/7] kexec: exclude hot remove cpu from elfcorehdr notes Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 6/7] crash: memory and cpu hotplug sysfs attributes Eric DeVolder
2022-12-09 15:36 ` [PATCH v15 7/7] x86/crash: add x86 crash hotplug support Eric DeVolder
2023-01-04  9:08   ` Baoquan He
2023-01-04 16:20     ` Eric DeVolder

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=3c85676b-ded2-3941-6c57-5b11397cdd81@oracle.com \
    --to=eric.devolder@oracle.com \
    --cc=bhe@redhat.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=efault@gmx.de \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nramas@linux.microsoft.com \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=sourabhjain@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.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