[PATCH v17 2/6] crash: add a new kexec flag for hotplug support
Sourabh Jain
sourabhjain at linux.ibm.com
Thu Feb 29 19:34:19 AEDT 2024
Hello
On 29/02/24 12:58, Baoquan He wrote:
> On 02/26/24 at 02:11pm, Sourabh Jain wrote:
> ......snip...
>> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
>> index 70fa8111a9d6..630c4fd7ea39 100644
>> --- a/kernel/crash_core.c
>> +++ b/kernel/crash_core.c
>> @@ -496,7 +496,7 @@ static DEFINE_MUTEX(__crash_hotplug_lock);
>> * It reflects the kernel's ability/permission to update the crash
>> * elfcorehdr directly.
> ~~~~~~~~~ this should be updated too.
>
>> */
>> -int crash_check_update_elfcorehdr(void)
>> +int crash_check_hotplug_support(void)
>> {
>> int rc = 0;
>>
>> @@ -508,10 +508,7 @@ int crash_check_update_elfcorehdr(void)
>> return 0;
>> }
>> if (kexec_crash_image) {
>> - if (kexec_crash_image->file_mode)
>> - rc = 1;
>> - else
>> - rc = kexec_crash_image->update_elfcorehdr;
>> + rc = kexec_crash_image->hotplug_support;
>> }
>> /* Release lock now that update complete */
>> kexec_unlock();
>> @@ -552,8 +549,8 @@ static void crash_handle_hotplug_event(unsigned int hp_action, unsigned int cpu,
>>
>> image = kexec_crash_image;
>>
>> - /* Check that updating elfcorehdr is permitted */
>> - if (!(image->file_mode || image->update_elfcorehdr))
>> + /* Check that kexec segments update is permitted */
>> + if (!image->hotplug_support)
>> goto out;
>>
>> if (hp_action == KEXEC_CRASH_HP_ADD_CPU ||
>> diff --git a/kernel/kexec.c b/kernel/kexec.c
>> index bab542fc1463..a6b3f96bb50c 100644
>> --- a/kernel/kexec.c
>> +++ b/kernel/kexec.c
>> @@ -135,8 +135,8 @@ static int do_kexec_load(unsigned long entry, unsigned long nr_segments,
>> image->preserve_context = 1;
>>
>> #ifdef CONFIG_CRASH_HOTPLUG
>> - if (flags & KEXEC_UPDATE_ELFCOREHDR)
>> - image->update_elfcorehdr = 1;
>> + if ((flags & KEXEC_ON_CRASH) && arch_crash_hotplug_support(image, flags))
>> + image->hotplug_support = 1;
>> #endif
>>
>> ret = machine_kexec_prepare(image);
>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>> index 2d1db05fbf04..3d64290d24c9 100644
>> --- a/kernel/kexec_file.c
>> +++ b/kernel/kexec_file.c
>> @@ -376,6 +376,11 @@ SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
>> if (ret)
>> goto out;
>>
>> +#ifdef CONFIG_CRASH_HOTPLUG
>> + if ((flags & KEXEC_FILE_ON_CRASH) && arch_crash_hotplug_support(image, flags))
>> + image->hotplug_support = 1;
>> +#endif
>> +
>> ret = machine_kexec_prepare(image);
>> if (ret)
>> goto out;
> Other than the tiny part, the overall looks good to me.
>
> Acked-by: Baoquan He <bhe at redhat.com>
>
Thank you for the review and feedback.
- Sourabh
More information about the Linuxppc-dev
mailing list