diff mbox series

[v2] powerpc/fadump: reset dump area size if fadump memory reserve fails

Message ID 20230704050715.203581-1-sourabhjain@linux.ibm.com (mailing list archive)
State Accepted
Commit d1eb75e0dfed80d2d85b664e28a39f65b290ab55
Headers show
Series [v2] powerpc/fadump: reset dump area size if fadump memory reserve fails | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 24 jobs.

Commit Message

Sourabh Jain July 4, 2023, 5:07 a.m. UTC
In case fadump_reserve_mem() fails to reserve memory, the
reserve_dump_area_size variable will retain the reserve area size. This
will lead to /sys/kernel/fadump/mem_reserved node displaying an incorrect
memory reserved by fadump.

To fix this problem, reserve dump area size variable is set to 0 if fadump
failed to reserve memory.

Fixes: 8255da95e545 ("powerpc/fadump: release all the memory above boot memory size")
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Acked-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
---
Chnages form V1:
* Reset the dump area size within the error_out path to cover more
  failure cases. Furthermore, the commit description has been modified
  accordingly.
---
 arch/powerpc/kernel/fadump.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sourabh Jain Aug. 17, 2023, 11:02 a.m. UTC | #1
Hello Michael,

Are there any reviews or comments on this fix?

Thanks,
Sourabh Jain

On 04/07/23 10:37, Sourabh Jain wrote:
> In case fadump_reserve_mem() fails to reserve memory, the
> reserve_dump_area_size variable will retain the reserve area size. This
> will lead to /sys/kernel/fadump/mem_reserved node displaying an incorrect
> memory reserved by fadump.
>
> To fix this problem, reserve dump area size variable is set to 0 if fadump
> failed to reserve memory.
>
> Fixes: 8255da95e545 ("powerpc/fadump: release all the memory above boot memory size")
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> Acked-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
> ---
> Chnages form V1:
> * Reset the dump area size within the error_out path to cover more
>    failure cases. Furthermore, the commit description has been modified
>    accordingly.
> ---
>   arch/powerpc/kernel/fadump.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index f3166acab09b..5a07d0f9c7f0 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -654,6 +654,7 @@ int __init fadump_reserve_mem(void)
>   	return ret;
>   error_out:
>   	fw_dump.fadump_enabled = 0;
> +	fw_dump.reserve_dump_area_size = 0;
>   	return 0;
>   }
>
Michael Ellerman Aug. 17, 2023, 12:47 p.m. UTC | #2
Sourabh Jain <sourabhjain@linux.ibm.com> writes:
> Hello Michael,
>
> Are there any reviews or comments on this fix?

No, looks fine. Will pick it up for 6.6.

cheers

> On 04/07/23 10:37, Sourabh Jain wrote:
>> In case fadump_reserve_mem() fails to reserve memory, the
>> reserve_dump_area_size variable will retain the reserve area size. This
>> will lead to /sys/kernel/fadump/mem_reserved node displaying an incorrect
>> memory reserved by fadump.
>>
>> To fix this problem, reserve dump area size variable is set to 0 if fadump
>> failed to reserve memory.
>>
>> Fixes: 8255da95e545 ("powerpc/fadump: release all the memory above boot memory size")
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> Acked-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
>> ---
>> Chnages form V1:
>> * Reset the dump area size within the error_out path to cover more
>>    failure cases. Furthermore, the commit description has been modified
>>    accordingly.
>> ---
>>   arch/powerpc/kernel/fadump.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
>> index f3166acab09b..5a07d0f9c7f0 100644
>> --- a/arch/powerpc/kernel/fadump.c
>> +++ b/arch/powerpc/kernel/fadump.c
>> @@ -654,6 +654,7 @@ int __init fadump_reserve_mem(void)
>>   	return ret;
>>   error_out:
>>   	fw_dump.fadump_enabled = 0;
>> +	fw_dump.reserve_dump_area_size = 0;
>>   	return 0;
>>   }
>>
Michael Ellerman Aug. 23, 2023, 11:55 a.m. UTC | #3
On Tue, 04 Jul 2023 10:37:15 +0530, Sourabh Jain wrote:
> In case fadump_reserve_mem() fails to reserve memory, the
> reserve_dump_area_size variable will retain the reserve area size. This
> will lead to /sys/kernel/fadump/mem_reserved node displaying an incorrect
> memory reserved by fadump.
> 
> To fix this problem, reserve dump area size variable is set to 0 if fadump
> failed to reserve memory.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/fadump: reset dump area size if fadump memory reserve fails
      https://git.kernel.org/powerpc/c/d1eb75e0dfed80d2d85b664e28a39f65b290ab55

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index f3166acab09b..5a07d0f9c7f0 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -654,6 +654,7 @@  int __init fadump_reserve_mem(void)
 	return ret;
 error_out:
 	fw_dump.fadump_enabled = 0;
+	fw_dump.reserve_dump_area_size = 0;
 	return 0;
 }