[PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools

Xianting Tian xianting.tian at linux.alibaba.com
Tue Jul 18 02:40:17 PDT 2023


在 2023/7/18 下午5:37, Petr Tesařík 写道:
> On Mon, 27 Mar 2023 16:27:56 +0800
> Guo Ren <guoren at kernel.org> wrote:
>
>> F.Y.I
>>
>> xianting_100 at 126.com
>>
>> On Mon, Mar 27, 2023 at 9:52 AM Baoquan He <bhe at redhat.com> wrote:
>>> Hi Xianting,
>>>
>>> On 10/26/22 at 10:59am, Xianting Tian wrote:
>>>> 在 2022/10/26 上午10:13, Xianting Tian 写道:
>>>>> Hi Simon
>>>>>
>>>>> thanks for the comments
>>>>>
>>>>> 在 2022/10/21 下午11:27, Simon Horman 写道:
>>>>>> On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote:
>>>>>>> From: Nick Kossifidis <mick at ics.forth.gr>
>>>>>>>
>>>>>>> This patch adds support for loading the ELF kernel image. It parses
>>>>>>> the current/provided device tree to determine the system's memory
>>>>>>> layout, and /proc/iomem for the various kernel segments.
>>>>>>>
>>>>>>> This patch was firstly developed by Nick Kossifidis, and two fixes (
>>>>>>>      1: fail to find free memory area for dtb load when using
>>>>>>> initrd image,
>>>>>>> lists.infradead.org/pipermail/linux-riscv/2022-August/018398.html;
>>>>>>>      2: fix memory range size calculation,
>>>>>>>          kexec/arch/riscv/crashdump-riscv.c:line 85
>>>>>>> ) are contributed by Yixun Lan, Xianting Tian.
>>>>>>>
>>>>>>> Tested on Qemu's rv64 virt machine and SoC of T-Head RISC-V
>>>>>>> Xuantie 910 CPU.
>>>>>> Hi,
>>>>>>
>>>>>> thanks for some patch.
>>>>>>
>>>>>> Some minor feedback follows.
>>>>>>
>>>>>> Separately, I'll post a patch to add RISC-V builds to the github
>>>>>> workflow. If you could include that in V3 I'd be most grateful.
>>>>>>   
>>>>>>> Tested-by: Yixun Lan <yixun.lan at gmail.com>
>>>>>>> Co-developed-by: Xianting Tian <xianting.tian at linux.alibaba.com>
>>>>>>> Co-developed-by: Yixun Lan <yixun.lan at gmail.com>
>>>>>>> Signed-off-by: Nick Kossifidis <mick at ics.forth.gr>
>>>>>> ...
>>>>>>   
>>>>>>> +    ret = mem_regions_alloc_and_add(mem_ranges, start,
>>>>>>> +                    end - start, type);
>>>>>> mem_regions_alloc_and_add isn't always available.
>>>>>> f.e. on mips this causes a build failure.
>>>>>>
>>>>>> Ref: https://github.com/horms/kexec-tools/actions/runs/3298491143/jobs/5440677595
>>>>> As you know, mem_regions_sort, mem_regions_alloc_and_add are the common
>>>>> funtions,
>>>>>
>>>>> The build error of mips is caused by this riscv patch?
>>>>>
>>>>> kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges)
>>>>> kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges);
>>>>>
>>>>>
>>>>> kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges
>>>>> *ranges,
>>>>> kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges
>>>>> *ranges,
>>>>>   
>>>>>> ...
>>>>>>   
>>>>>>> +int dtb_get_memory_ranges(char *dtb, struct memory_ranges
>>>>>>> *mem_ranges, struct memory_ranges *extra_ranges)
>>>>>>> +{
>>>>>> ...
>>>>>>   
>>>>>>> +    mem_regions_sort(mem_ranges);
>>>>>> Likewise, mem_regions_sort isn't always available.
>>>>>> f.e. on mips this causes a build failure.
>>>>>>
>>>>>> ...
>>>>>>   
>>>>>>> diff --git a/purgatory/arch/riscv/Makefile
>>>>>>> b/purgatory/arch/riscv/Makefile
>>>>>>> new file mode 100644
>>>>>>> index 0000000..8bded71
>>>>>>> --- /dev/null
>>>>>>> +++ b/purgatory/arch/riscv/Makefile
>>>>>>> @@ -0,0 +1,7 @@
>>>>>>> +#
>>>>>>> +# Purgatory riscv
>>>>>>> +#
>>>>>>> +
>>>>>>> +riscv_PURGATORY_SRCS =
>>>>>>> +
>>>>>>> +dist += purgatory/arch/sh/Makefile $(riscv_PURGATORY_SRCS)
>>>>>> s/sh/riscv/
>>>>>>
>>>>>> Else the distribution tarball won't include this Makefile
>>>>>>
>>>>>> You can exercise this using:
>>>>>>     make distcheck DISTCHECK_CONFIGURE_FLAGS="--host=riscv64-linux-gnu"
>>>>> thanks, I will fix this.
>>>> the fix is in my personal gitee
>>>>
>>>> https://gitee.com/xianting-tian/kexec-tools/commits/master
>>> Is this patchset reposting still in your working plan? I don't see the
>>> code in kexe-tools, so ping to ask.
>>>
>>> If this is not your work tasks any more, people interested can pick this
>>> patchset and post after polishing.
> Now it seems I am interested. FYI my plan is to start working on this
> if there is no further reaction from anybody else within a fortnight.
Good, please feel free to do it.
>
> Petr T



More information about the kexec mailing list