[RFC PATCH v2 3/3] resource, crash: Make kexec_file_load support pmem
Zhijian Li (Fujitsu)
lizhijian at fujitsu.com
Fri Apr 28 00:10:02 PDT 2023
Jane,
On 28/04/2023 04:41, Jane Chu wrote:
>> diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
>> index cdd92ab43cda..dc9d03083565 100644
>> --- a/arch/x86/kernel/crash.c
>> +++ b/arch/x86/kernel/crash.c
>> @@ -178,6 +178,7 @@ static struct crash_mem *fill_up_crash_elf_data(void)
>> if (!nr_ranges)
>> return NULL;
>> + walk_pmem_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback);
>
> So this will overwrite 'nr_ranges' produced by the previous walk_system_ram_res() call, sure it's correct?
It depends on how the callback walk_system_ram_res() handle 'nr_ranges', so it's safe for this changes IMHO.
163 static int get_nr_ram_ranges_callback(struct resource *res, void *arg)
164 {
165 unsigned int *nr_ranges = arg;
166
167 (*nr_ranges)++;
168 return 0;
169 }
170
171 /* Gather all the required information to prepare elf headers for ram regions */
172 static struct crash_mem *fill_up_crash_elf_data(void)
173 {
174 unsigned int nr_ranges = 0;
175 struct crash_mem *cmem;
176
177 walk_system_ram_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback);
178 if (!nr_ranges)
179 return NULL;
180
181 walk_pmem_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback);
At last, nr_ranges = #ram_res + #pmem_res.
Thanks
Zhijian
>
> Regards,
> -jane
More information about the kexec
mailing list