From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: Hari Bathini <hbathini@linux.ibm.com>, kexec@lists.infradead.org
Cc: Aditya Gupta <adityag@linux.ibm.com>, Baoquan He <bhe@redhat.com>,
Coiby Xu <coxu@redhat.com>,
Mahesh Salgaonkar <mahesh@linux.ibm.com>
Subject: Re: [PATCH 1/3] kexec_load: Use new kexec flag for hotplug support
Date: Mon, 10 Jun 2024 17:12:36 +0530 [thread overview]
Message-ID: <a9dc1d83-4b2c-4274-8a3f-e9fc04e0e48e@linux.ibm.com> (raw)
In-Reply-To: <2373f9fb-5601-4a58-894d-8f9ca84d8834@linux.ibm.com>
Hello Hari,
On 10/06/24 14:22, Hari Bathini wrote:
>
>
> On 22/05/24 6:43 pm, Sourabh Jain wrote:
>> Kernel commit 79365026f869 (crash: add a new kexec flag for hotplug
>> support) has introduced a new kexec flag to generalize hotplug support.
>> The newly introduced kexec flags for hotplug allow architectures to
>> exclude all the required kexec segments from SHA calculation so that
>> the kernel can update them on hotplug events. This was not possible
>> earlier with the KEXEC_UPDATE_ELFCOREHDR kexec flags since it was added
>> only for the elfcorehdr segment.
>>
>> To enable architectures to control the list of kexec segments to exclude
>> when hotplug support is enabled, add a new architecture-specific
>> function named arch_do_exclude_segment. During the SHA calculation, this
>> function gets called to let the architecture decide whether a specific
>> kexec segment should be considered for SHA calculation or not.
>>
>> Given that the KEXEC_UPDATE_ELFCOREHDR is no longer required and was
>> colliding with the KEXEC_LIVE_UPDATE update flag, it is removed.
>>
>> Cc: Aditya Gupta <adityag@linux.ibm.com>
>> Cc: Baoquan He <bhe@redhat.com>
>> Cc: Coiby Xu <coxu@redhat.com>
>> Cc: Hari Bathini <hbathini@linux.ibm.com>
>> Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> kexec/arch/arm/kexec-arm.c | 5 +++++
>> kexec/arch/arm64/kexec-arm64.c | 4 ++++
>> kexec/arch/cris/kexec-cris.c | 4 ++++
>> kexec/arch/hppa/kexec-hppa.c | 5 +++++
>> kexec/arch/i386/kexec-x86.c | 8 ++++++++
>> kexec/arch/ia64/kexec-ia64.c | 4 ++++
>> kexec/arch/loongarch/kexec-loongarch.c | 5 +++++
>> kexec/arch/m68k/kexec-m68k.c | 5 +++++
>> kexec/arch/mips/kexec-mips.c | 4 ++++
>> kexec/arch/ppc/kexec-ppc.c | 4 ++++
>> kexec/arch/ppc64/kexec-ppc64.c | 5 +++++
>> kexec/arch/s390/kexec-s390.c | 5 +++++
>> kexec/arch/sh/kexec-sh.c | 5 +++++
>> kexec/arch/x86_64/kexec-x86_64.c | 5 +++++
>> kexec/kexec-syscall.h | 2 +-
>> kexec/kexec.c | 14 ++++++++------
>> kexec/kexec.h | 2 ++
>> 17 files changed, 79 insertions(+), 7 deletions(-)
>>
>> diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
>> index 49f35b1..34531f9 100644
>> --- a/kexec/arch/arm/kexec-arm.c
>> +++ b/kexec/arch/arm/kexec-arm.c
>> @@ -148,3 +148,8 @@ int have_sysfs_fdt(void)
>> {
>> return !access(SYSFS_FDT, F_OK);
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/arm64/kexec-arm64.c
>> b/kexec/arch/arm64/kexec-arm64.c
>> index 4a67b0d..9d052b0 100644
>> --- a/kexec/arch/arm64/kexec-arm64.c
>> +++ b/kexec/arch/arm64/kexec-arm64.c
>> @@ -1363,3 +1363,7 @@ void arch_reuse_initrd(void)
>> void arch_update_purgatory(struct kexec_info *UNUSED(info))
>> {
>> }
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c
>> index 3b69709..7f09121 100644
>> --- a/kexec/arch/cris/kexec-cris.c
>> +++ b/kexec/arch/cris/kexec-cris.c
>> @@ -109,3 +109,7 @@ unsigned long add_buffer(struct kexec_info *info,
>> const void *buf,
>> buf_min, buf_max, buf_end, 1);
>> }
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/hppa/kexec-hppa.c b/kexec/arch/hppa/kexec-hppa.c
>> index 77c9739..a64dc3d 100644
>> --- a/kexec/arch/hppa/kexec-hppa.c
>> +++ b/kexec/arch/hppa/kexec-hppa.c
>> @@ -146,3 +146,8 @@ unsigned long virt_to_phys(unsigned long addr)
>> {
>> return addr - phys_offset;
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/i386/kexec-x86.c b/kexec/arch/i386/kexec-x86.c
>> index 444cb69..b4947a0 100644
>> --- a/kexec/arch/i386/kexec-x86.c
>> +++ b/kexec/arch/i386/kexec-x86.c
>> @@ -208,3 +208,11 @@ void arch_update_purgatory(struct kexec_info *info)
>> elf_rel_set_symbol(&info->rhdr, "panic_kernel",
>> &panic_kernel, sizeof(panic_kernel));
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *seg_ptr, struct
>> kexec_info *info)
>> +{
>> + if (info->elfcorehdr == (unsigned long) seg_ptr->mem)
>> + return 1;
>> +
>> + return 0;
>> +}
>> diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c
>> index 418d997..8d9c1f3 100644
>> --- a/kexec/arch/ia64/kexec-ia64.c
>> +++ b/kexec/arch/ia64/kexec-ia64.c
>> @@ -245,3 +245,7 @@ void arch_update_purgatory(struct kexec_info
>> *UNUSED(info))
>> {
>> }
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/loongarch/kexec-loongarch.c
>> b/kexec/arch/loongarch/kexec-loongarch.c
>> index 32a42d2..9a50ff6 100644
>> --- a/kexec/arch/loongarch/kexec-loongarch.c
>> +++ b/kexec/arch/loongarch/kexec-loongarch.c
>> @@ -378,3 +378,8 @@ unsigned long add_buffer(struct kexec_info *info,
>> const void *buf,
>> return add_buffer_phys_virt(info, buf, bufsz, memsz, buf_align,
>> buf_min, buf_max, buf_end, 1);
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/m68k/kexec-m68k.c b/kexec/arch/m68k/kexec-m68k.c
>> index cb54927..0c7dbaf 100644
>> --- a/kexec/arch/m68k/kexec-m68k.c
>> +++ b/kexec/arch/m68k/kexec-m68k.c
>> @@ -108,3 +108,8 @@ void add_segment(struct kexec_info *info, const
>> void *buf, size_t bufsz,
>> {
>> add_segment_phys_virt(info, buf, bufsz, base, memsz, 1);
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
>> index d8cbea8..94224ee 100644
>> --- a/kexec/arch/mips/kexec-mips.c
>> +++ b/kexec/arch/mips/kexec-mips.c
>> @@ -189,3 +189,7 @@ unsigned long add_buffer(struct kexec_info *info,
>> const void *buf,
>> buf_min, buf_max, buf_end, 1);
>> }
>> +int arch_do_exclude_segment(const void *UNUSED(seg_ptr), struct
>> kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
>> index 03bec36..c8af870 100644
>> --- a/kexec/arch/ppc/kexec-ppc.c
>> +++ b/kexec/arch/ppc/kexec-ppc.c
>> @@ -966,3 +966,7 @@ void arch_update_purgatory(struct kexec_info
>> *UNUSED(info))
>> {
>> }
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/ppc64/kexec-ppc64.c
>> b/kexec/arch/ppc64/kexec-ppc64.c
>> index bd5274c..fb27b6b 100644
>> --- a/kexec/arch/ppc64/kexec-ppc64.c
>> +++ b/kexec/arch/ppc64/kexec-ppc64.c
>> @@ -967,3 +967,8 @@ int arch_compat_trampoline(struct kexec_info
>> *UNUSED(info))
>> void arch_update_purgatory(struct kexec_info *UNUSED(info))
>> {
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
>> index 33ba6b9..0561ee7 100644
>> --- a/kexec/arch/s390/kexec-s390.c
>> +++ b/kexec/arch/s390/kexec-s390.c
>> @@ -267,3 +267,8 @@ int get_crash_kernel_load_range(uint64_t *start,
>> uint64_t *end)
>> {
>> return parse_iomem_single("Crash kernel\n", start, end);
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>> diff --git a/kexec/arch/sh/kexec-sh.c b/kexec/arch/sh/kexec-sh.c
>> index ce341c8..f84c40c 100644
>> --- a/kexec/arch/sh/kexec-sh.c
>> +++ b/kexec/arch/sh/kexec-sh.c
>> @@ -257,3 +257,8 @@ unsigned long add_buffer(struct kexec_info *info,
>> const void *buf,
>> return add_buffer_phys_virt(info, buf, bufsz, memsz, buf_align,
>> buf_min, buf_max, buf_end, 1);
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>> + return 0;
>> +}
>
>> diff --git a/kexec/arch/x86_64/kexec-x86_64.c
>> b/kexec/arch/x86_64/kexec-x86_64.c
>> index ffd84f0..42af90a 100644
>> --- a/kexec/arch/x86_64/kexec-x86_64.c
>> +++ b/kexec/arch/x86_64/kexec-x86_64.c
>> @@ -188,3 +188,8 @@ void arch_update_purgatory(struct kexec_info *info)
>> elf_rel_set_symbol(&info->rhdr, "panic_kernel",
>> &panic_kernel, sizeof(panic_kernel));
>> }
>> +
>> +int arch_do_exclude_segment(struct kexec_segment *UNUSED(seg_ptr),
>> struct kexec_info *UNUSED(info))
>> +{
>
> This should also be similar to i386, no?
> Except for that, rest looks good..
In kexec tools, hotplug support for the kexec_load syscall is not yet
enabled for x86_64.
Hence, the function returns 0.
>
> Acked-by: Hari Bathini <hbathini@linux.ibm.com>
Thank you for reviewing and giving an Ack to the patch.
- Sourabh Jain
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
prev parent reply other threads:[~2024-06-10 11:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 13:13 [PATCH 1/3] kexec_load: Use new kexec flag for hotplug support Sourabh Jain
2024-05-22 13:13 ` [PATCH 2/3] powerpc/kexec_load: add " Sourabh Jain
2024-06-10 9:38 ` Hari Bathini
2024-06-10 12:19 ` Sourabh Jain
2024-05-22 13:13 ` [PATCH 3/3] doc/hotplug: update man and --help Sourabh Jain
2024-06-10 9:19 ` Hari Bathini
2024-06-10 12:24 ` Sourabh Jain
2024-05-28 11:33 ` [PATCH 1/3] kexec_load: Use new kexec flag for hotplug support Aditya Gupta
2024-05-29 13:13 ` Sourabh Jain
2024-05-30 6:23 ` Aditya Gupta
2024-06-10 8:52 ` Hari Bathini
2024-06-10 11:42 ` Sourabh Jain [this message]
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=a9dc1d83-4b2c-4274-8a3f-e9fc04e0e48e@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=bhe@redhat.com \
--cc=coxu@redhat.com \
--cc=hbathini@linux.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=mahesh@linux.ibm.com \
/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