Skip to contentSkip to conversation

arm64/kexec: Fix missing extra range for crashkres_low.

PATCH Superseded Levi Yun 4 participants 15 messages Aug 3, 2022 – Sep 1, 2022

Subsystems (4)
lore
Share & tools
lore

Levi Yun

author
#0 lore raw

PATCH 1/1 arm64/kexec: Fix missing extra range for crashkres_low.

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too. Add one extra crash_mem range when crashk_low_res is used.

---
 arch/arm64/kernel/machine_kexec_file.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/kernel/machine_kexec_file.c +3 -0
index 889951291cc0..378aee04e7d4 100644
@@ -51,6 +51,9 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
 	for_each_mem_range(i, &start, &end)
 		nr_ranges++;
 
+	if (crashk_low_res.end)
+		nr_ranges++; /**< for exclusion of crashkernel=size,low region */
+
 	cmem = kmalloc(struct_size(cmem, ranges, nr_ranges), GFP_KERNEL);
 	if (!cmem)
 		return -ENOMEM;

--
2.35.1

author
#1 lore raw

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too. Add one extra crash_mem range when crashk_low_res is used.

---
 arch/arm64/kernel/machine_kexec_file.c | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/arch/arm64/kernel/machine_kexec_file.c
index 889951291cc0..378aee04e7d4 100644

arch/arm64/kernel/machine_kexec_file.c +2 -0
@@ -51,6 +51,9 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
        for_each_mem_range(i, &start, &end)
                nr_ranges++;
 
+       if (crashk_low_res.end)
+               nr_ranges++; /**< for exclusion of

crashkernel=size,low region */
+

        cmem = kmalloc(struct_size(cmem, ranges, nr_ranges), GFP_KERNEL);
        if (!cmem)
                return -ENOMEM;

--
2.35.1

#2 lore raw
Quoted 20 lines · Yun Levi

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too. Add one extra crash_mem range when crashk_low_res is used.

---
 arch/arm64/kernel/machine_kexec_file.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/kernel/machine_kexec_file.c +2 -0
index 889951291cc0..378aee04e7d4 100644
@@ -51,6 +51,9 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
        for_each_mem_range(i, &start, &end)
                nr_ranges++;
 
+       if (crashk_low_res.end)
+               nr_ranges++; /**< for exclusion of
Quoted 2 lines

crashkernel=size,low region */
+

Right, excluding crashkernel region may cause memory region splitting, so we need extra slot for that.

Meanwhile, can you fix above code comment mess? Otherwise, this looks good to me.

Or we can add extra 2 slots like we do in x86, it just add another 16 bytes temporarily.

Quoted 6 lines
        cmem = kmalloc(struct_size(cmem, ranges, nr_ranges), GFP_KERNEL);
        if (!cmem)
                return -ENOMEM;

--
2.35.1

author
#3 lore raw
Quoted 5 lines

Right, excluding crashkernel region may cause memory region splitting, so we need extra slot for that.

Meanwhile, can you fix above code comment mess? Otherwise, this looks good to me.

Thanks! I'll remove the comment.

Quoted 2 lines

Or we can add extra 2 slots like we do in x86, it just add another 16 bytes temporarily.

Agree. I'll send the patch again by modifying nr_ranges' initialized value as 2.

Thanks!

author
#4 lore raw

PATCH v2 1/1 arm64/kexec: Fix missing extra range for crashkres_low.

In reply to Yun Levi

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem range slot in case of crashk_low_res is used.

---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec_file.c +1 -1
index 889951291cc0..a11a6e14ba89 100644
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
 	u64 i;
 	phys_addr_t start, end;
 
-	nr_ranges = 1; /* for exclusion of crashkernel region */
+	nr_ranges = 2; /* for exclusion of crashkernel region */
 	for_each_mem_range(i, &start, &end)
 		nr_ranges++;
 
Signature · 1 line
2.35.1
Acked-by on v2 1/1
#5 lore raw
Quoted 4 lines · Levi Yun

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem range slot in case of crashk_low_res is used.

~~^ should be removed.

LGTM,

Quoted 22 lines
---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec_file.c +1 -1
index 889951291cc0..a11a6e14ba89 100644
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
 	u64 i;
 	phys_addr_t start, end;
 
-	nr_ranges = 1; /* for exclusion of crashkernel region */
+	nr_ranges = 2; /* for exclusion of crashkernel region */
 	for_each_mem_range(i, &start, &end)
 		nr_ranges++;
 
Signature · 1 line
2.35.1
author
#7 lore raw
Quoted 6 lines

Does this need a Fixes tag and cc stable?

--
Catalin

IMHO, it seems good to add two tags like:

Fixes 3751e728cef29 ("arm64: kexec_file: add crash dump support")

BTW, To add above two tags, should I resend the patch again with former tags (Acked-by & Reviewed-by)?

Thanks.

Signature · 7 lines
Best regards,
Levi

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#8 lore raw
Quoted 10 lines · Yun Levi
Quoted 6 lines

Does this need a Fixes tag and cc stable?

--
Catalin

IMHO, it seems good to add two tags like:

Fixes 3751e728cef29 ("arm64: kexec_file: add crash dump support")

No, I don't think the Fixes commit is right. It should fix the commit where crashkernel,low is introduced. Before that, no issue caused. So the tags should be:

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")
author
#9 lore raw
Quoted 6 lines

No, I don't think the Fixes commit is right. It should fix the commit where crashkernel,low is introduced. Before that, no issue caused. So the tags should be:

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")

Thanks! I'will resend the patch with fixed commit message and the tags including Fixes, Cc, Review-By and Acked-by.

author
#10 lore raw

PATCH 1/1 arm64/kexec: Fix missing extra range for crashkres_low.

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem slot in case of crashk_low_res is used.

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")
---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm64/kernel/machine_kexec_file.c
index 889951291cc0..a11a6e14ba89 100644

arch/arm64/kernel/machine_kexec_file.c +1 -1
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
  u64 i;
  phys_addr_t start, end;
 
- nr_ranges = 1; /* for exclusion of crashkernel region */
+ nr_ranges = 2; /* for exclusion of crashkernel region */
  for_each_mem_range(i, &start, &end)
  nr_ranges++;
 
Signature · 1 line
2.35.1
maintainer
#11 lore raw
Quoted 8 lines · Yun Levi

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem slot in case of crashk_low_res is used.

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")

To be even more precise, it should be:

Cc <[email protected]> # 5.19.x
Quoted 12 lines
---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec_file.c +0 -0
index 889951291cc0..a11a6e14ba89 100644

arch/arm64/kernel/machine_kexec_file.c static int prepare_elf_headers(void **addr, unsigned long *sz) · line 52

Quoted 7 lines
arch/arm64/kernel/machine_kexec_file.c +1 -1
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
  u64 i;
  phys_addr_t start, end;
 
- nr_ranges = 1; /* for exclusion of crashkernel region */
+ nr_ranges = 2; /* for exclusion of crashkernel region */
  for_each_mem_range(i, &start, &end)
  nr_ranges++;

Something happened to the whitespace here, so the patch can't be applied.

Signature · 1 line
Catalin
author
#12 lore raw
Quoted 4 lines

To be even more precise, it should be:

Cc <[email protected]> # 5.19.x

Thanks! I'll fix it!

Quoted 2 lines

Something happened to the whitespace here, so the patch can't be applied.

Sorry, I'll check and send again :). Thanks!

Quoted 40 lines · Catalin Marinas
Quoted 8 lines · Yun Levi

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem slot in case of crashk_low_res is used.

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")

To be even more precise, it should be:

Cc <[email protected]> # 5.19.x
Quoted 12 lines
---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec_file.c +0 -0
index 889951291cc0..a11a6e14ba89 100644

arch/arm64/kernel/machine_kexec_file.c static int prepare_elf_headers(void **addr, unsigned long *sz) · line 52

Quoted 7 lines
arch/arm64/kernel/machine_kexec_file.c +1 -1
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
  u64 i;
  phys_addr_t start, end;
 
- nr_ranges = 1; /* for exclusion of crashkernel region */
+ nr_ranges = 2; /* for exclusion of crashkernel region */
  for_each_mem_range(i, &start, &end)
  nr_ranges++;

Something happened to the whitespace here, so the patch can't be applied.

--
Catalin

author
#13 lore raw

PATCH v3 1/1 arm64/kexec: Fix missing extra range for crashkres_low.

In reply to Yun Levi

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem slot in case of crashk_low_res is used.

Fixes 944a45abfabc ("arm64: kdump: Reimplement crashkernel=X")
Cc <[email protected]> # 5.19.x
---
 arch/arm64/kernel/machine_kexec_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec_file.c +1 -1
index 889951291cc0..a11a6e14ba89 100644
@@ -47,7 +47,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
 	u64 i;
 	phys_addr_t start, end;
 
-	nr_ranges = 1; /* for exclusion of crashkernel region */
+	nr_ranges = 2; /* for exclusion of crashkernel region */
 	for_each_mem_range(i, &start, &end)
 		nr_ranges++;
 

--
2.35.1

maintainer Applied
#14 lore raw
Quoted 6 lines · Levi Yun

Like crashk_res, Calling crash_exclude_mem_range function with crashk_low_res area would need extra crash_mem range too.

Add one more extra cmem slot in case of crashk_low_res is used.

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64/kexec: Fix missing extra range for crashkres_low.

      https://git.kernel.org/arm64/c/4831be702b95

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev