diff mbox series

[v24,5/6] of: Support more than one crash kernel regions for kexec -s

Message ID 20220506114402.365-6-thunder.leizhen@huawei.com
State Not Applicable, archived
Headers show
Series support reserving crashkernel above 4G on arm64 kdump | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied fail build log

Commit Message

Leizhen (ThunderTown) May 6, 2022, 11:44 a.m. UTC
When "crashkernel=X,high" is used, there may be two crash regions:
high=crashk_res and low=crashk_low_res. But now the syscall
kexec_file_load() only add crashk_res into "linux,usable-memory-range",
this may cause the second kernel to have no available dma memory.

Fix it like kexec tool do for option -c, add both 'high' and 'low' regions
into the dtb.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 drivers/of/kexec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Baoquan He May 6, 2022, 11:17 p.m. UTC | #1
On 05/06/22 at 07:44pm, Zhen Lei wrote:
> When "crashkernel=X,high" is used, there may be two crash regions:
> high=crashk_res and low=crashk_low_res. But now the syscall
> kexec_file_load() only add crashk_res into "linux,usable-memory-range",
> this may cause the second kernel to have no available dma memory.
> 
> Fix it like kexec tool do for option -c, add both 'high' and 'low' regions
              ~~~~~~~~~~~~ 
              kexec-tools does

Other than this, LGTM,

Acked-by: Baoquan He <bhe@redhat.com>

> into the dtb.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/of/kexec.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
> index b9bd1cff179388c..8d374cc552be5f2 100644
> --- a/drivers/of/kexec.c
> +++ b/drivers/of/kexec.c
> @@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
>  				crashk_res.end - crashk_res.start + 1);
>  		if (ret)
>  			goto out;
> +
> +		if (crashk_low_res.end) {
> +			ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
> +					"linux,usable-memory-range",
> +					crashk_low_res.start,
> +					crashk_low_res.end - crashk_low_res.start + 1);
> +			if (ret)
> +				goto out;
> +		}
>  	}
>  
>  	/* add bootargs */
> -- 
> 2.25.1
>
Leizhen (ThunderTown) May 7, 2022, 1:42 a.m. UTC | #2
On 2022/5/7 7:17, Baoquan He wrote:
> On 05/06/22 at 07:44pm, Zhen Lei wrote:
>> When "crashkernel=X,high" is used, there may be two crash regions:
>> high=crashk_res and low=crashk_low_res. But now the syscall
>> kexec_file_load() only add crashk_res into "linux,usable-memory-range",
>> this may cause the second kernel to have no available dma memory.
>>
>> Fix it like kexec tool do for option -c, add both 'high' and 'low' regions
>               ~~~~~~~~~~~~ 
>               kexec-tools does

OK, I will update it. Thanks.

> 
> Other than this, LGTM,
> 
> Acked-by: Baoquan He <bhe@redhat.com>
> 
>> into the dtb.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> Acked-by: Rob Herring <robh@kernel.org>
>> ---
>>  drivers/of/kexec.c | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
>> index b9bd1cff179388c..8d374cc552be5f2 100644
>> --- a/drivers/of/kexec.c
>> +++ b/drivers/of/kexec.c
>> @@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
>>  				crashk_res.end - crashk_res.start + 1);
>>  		if (ret)
>>  			goto out;
>> +
>> +		if (crashk_low_res.end) {
>> +			ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
>> +					"linux,usable-memory-range",
>> +					crashk_low_res.start,
>> +					crashk_low_res.end - crashk_low_res.start + 1);
>> +			if (ret)
>> +				goto out;
>> +		}
>>  	}
>>  
>>  	/* add bootargs */
>> -- 
>> 2.25.1
>>
> 
> .
>
Baoquan He May 7, 2022, 2:36 a.m. UTC | #3
On 05/07/22 at 09:42am, Leizhen (ThunderTown) wrote:
> 
> 
> On 2022/5/7 7:17, Baoquan He wrote:
> > On 05/06/22 at 07:44pm, Zhen Lei wrote:
> >> When "crashkernel=X,high" is used, there may be two crash regions:
> >> high=crashk_res and low=crashk_low_res. But now the syscall
> >> kexec_file_load() only add crashk_res into "linux,usable-memory-range",
> >> this may cause the second kernel to have no available dma memory.
> >>
> >> Fix it like kexec tool do for option -c, add both 'high' and 'low' regions
> >               ~~~~~~~~~~~~ 
> >               kexec-tools does
> 
> OK, I will update it. Thanks.

Let's wait and see how Catalin considers. He may pick these with
minor fix directly or your v25.

> 
> > 
> > Other than this, LGTM, > > > > Acked-by: Baoquan He <bhe@redhat.com>
> > 
> >> into the dtb.
> >>
> >> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> >> Acked-by: Rob Herring <robh@kernel.org>
> >> ---
> >>  drivers/of/kexec.c | 9 +++++++++
> >>  1 file changed, 9 insertions(+)
> >>
> >> diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
> >> index b9bd1cff179388c..8d374cc552be5f2 100644
> >> --- a/drivers/of/kexec.c
> >> +++ b/drivers/of/kexec.c
> >> @@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
> >>  				crashk_res.end - crashk_res.start + 1);
> >>  		if (ret)
> >>  			goto out;
> >> +
> >> +		if (crashk_low_res.end) {
> >> +			ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
> >> +					"linux,usable-memory-range",
> >> +					crashk_low_res.start,
> >> +					crashk_low_res.end - crashk_low_res.start + 1);
> >> +			if (ret)
> >> +				goto out;
> >> +		}
> >>  	}
> >>  
> >>  	/* add bootargs */
> >> -- 
> >> 2.25.1
> >>
> > 
> > .
> > 
> 
> -- 
> Regards,
>   Zhen Lei
>
diff mbox series

Patch

diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index b9bd1cff179388c..8d374cc552be5f2 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -386,6 +386,15 @@  void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
 				crashk_res.end - crashk_res.start + 1);
 		if (ret)
 			goto out;
+
+		if (crashk_low_res.end) {
+			ret = fdt_appendprop_addrrange(fdt, 0, chosen_node,
+					"linux,usable-memory-range",
+					crashk_low_res.start,
+					crashk_low_res.end - crashk_low_res.start + 1);
+			if (ret)
+				goto out;
+		}
 	}
 
 	/* add bootargs */