[PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

COOLING12d

6 messages, 4 authors, 12d ago · open the first message on its own page

[PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Shivang Upadhyay <hidden>
Date: 2026-08-28 09:50:12

During Fadump in Qemu VM, when maxcpus value is set to more than current
cpus, following failure is observed.

    [    0.045806] [      T1] rtas fadump: Dump taken by platform is
        incomplete (0)

This is because the CPU_STATE_DATA is allocated for maxcpus, while the
data is only filled for current cpus. As per current implementation
of Fadump, dumped_bytes and source_len for a region have to match,
Which is failing for qemu's case, Even tough the dumped bytes are
reported correctly for only the current cpus. After this /proc/vmcore
generatition also fails.

Allowing dumped_bytes to be lesser than or equal to allocated length, for
CPU_STATE_DATA Fadump region.

Reported-by: Anushree Mathur <redacted>
Closes: https://lore.kernel.org/all/5e66daf4-3f55-4044-94a5-4f50bb040849@linux.ibm.com/T/#u
Signed-off-by: Shivang Upadhyay <redacted>
---

Changelog:
v4:
    removed extra blank line.

v3: https://lore.kernel.org/all/20260827075803.2240934-1-shivangu@linux.ibm.com/
    removed extra variable.

v2: https://lore.kernel.org/all/20260826125626.2108771-1-shivangu@linux.ibm.com/
    Only allowing lesser size for CPU_STATE_DATE Fadump region.

v1: https://lore.kernel.org/qemu-devel/20260429065127.366813-1-shivangu@linux.ibm.com/

---
 arch/powerpc/platforms/pseries/rtas-fadump.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/rtas-fadump.c b/arch/powerpc/platforms/pseries/rtas-fadump.c
index 3bb4ac2ab6cc..838e97c24308 100644
--- a/arch/powerpc/platforms/pseries/rtas-fadump.c
+++ b/arch/powerpc/platforms/pseries/rtas-fadump.c
@@ -459,6 +459,8 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 	/* Check if the dump data is valid. */
 	for (int i = 0; i < be16_to_cpu(fdm_active->header.dump_num_sections); i++) {
 		int type = be16_to_cpu(fdm_active->rgn[i].source_data_type);
+		uint64_t bytes_dumped = be64_to_cpu(fdm_active->rgn[i].bytes_dumped);
+		uint64_t source_len = be64_to_cpu(fdm_active->rgn[i].source_len);
 		int rc = 0;
 
 		switch (type) {
@@ -469,10 +471,20 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 				pr_err("Dump taken by platform is not valid (%d)\n", i);
 				rc = -EINVAL;
 			}
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len) {
+
+			/*
+			 * Make sure that dump is collected for entire region.
+			 * CPU_STATE_DATA region is allowed to dump less than allocated space.
+			 */
+			if (!(bytes_dumped == source_len ||
+			(type == RTAS_FADUMP_CPU_STATE_DATA && bytes_dumped <= source_len))) {
+
 				pr_err("Dump taken by platform is incomplete (%d)\n", i);
+				pr_debug("type -> %d, bytes_dumped -> %llx, source_len -> %llx\n",
+					 type, bytes_dumped, source_len);
 				rc = -EINVAL;
 			}
+
 			if (rc) {
 				pr_warn("Region type: %u src addr: 0x%llx dest addr: 0x%llx\n",
 					be16_to_cpu(fdm_active->rgn[i].source_data_type),
@@ -482,7 +494,7 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 			}
 			break;
 		case RTAS_FADUMP_PARAM_AREA:
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len ||
+			if (bytes_dumped != source_len ||
 			    fdm_active->rgn[i].error_flags != 0) {
 				pr_warn("Failed to process additional parameters! Proceeding anyway..\n");
 				fadump_conf->param_area = 0;
-- 
2.54.0

Re: [PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Sourabh Jain <hidden>
Date: 2026-09-12 12:34:22


On 28/08/26 15:19, Shivang Upadhyay wrote:
During Fadump in Qemu VM, when maxcpus value is set to more than current
cpus, following failure is observed.

     [    0.045806] [      T1] rtas fadump: Dump taken by platform is
         incomplete (0)

This is because the CPU_STATE_DATA is allocated for maxcpus, while the
data is only filled for current cpus. As per current implementation
of Fadump, dumped_bytes and source_len for a region have to match,
Which is failing for qemu's case, Even tough the dumped bytes are
reported correctly for only the current cpus. After this /proc/vmcore
generatition also fails.

Allowing dumped_bytes to be lesser than or equal to allocated length, for
CPU_STATE_DATA Fadump region.
Yes, as per PAPR, it is possible for the CPU data to be less than the source length
due to CPU hotplug. Therefore, it is OK to accept bytes_dumped being less than
source_len for the CPU region.

I have verified the changes and tested them on LPARs with different partition configurations.
The dump collection went fine.

Feel free to add:

Reviewed-by: Sourabh Jain <redacted>

quoted hunk
Reported-by: Anushree Mathur <redacted>
Closes: https://lore.kernel.org/all/5e66daf4-3f55-4044-94a5-4f50bb040849@linux.ibm.com/T/#u
Signed-off-by: Shivang Upadhyay <redacted>
---

Changelog:
v4:
     removed extra blank line.

v3: https://lore.kernel.org/all/20260827075803.2240934-1-shivangu@linux.ibm.com/
     removed extra variable.

v2: https://lore.kernel.org/all/20260826125626.2108771-1-shivangu@linux.ibm.com/
     Only allowing lesser size for CPU_STATE_DATE Fadump region.

v1: https://lore.kernel.org/qemu-devel/20260429065127.366813-1-shivangu@linux.ibm.com/

---
  arch/powerpc/platforms/pseries/rtas-fadump.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/rtas-fadump.c b/arch/powerpc/platforms/pseries/rtas-fadump.c
index 3bb4ac2ab6cc..838e97c24308 100644
--- a/arch/powerpc/platforms/pseries/rtas-fadump.c
+++ b/arch/powerpc/platforms/pseries/rtas-fadump.c
@@ -459,6 +459,8 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  	/* Check if the dump data is valid. */
  	for (int i = 0; i < be16_to_cpu(fdm_active->header.dump_num_sections); i++) {
  		int type = be16_to_cpu(fdm_active->rgn[i].source_data_type);
+		uint64_t bytes_dumped = be64_to_cpu(fdm_active->rgn[i].bytes_dumped);
+		uint64_t source_len = be64_to_cpu(fdm_active->rgn[i].source_len);
  		int rc = 0;
  
  		switch (type) {
@@ -469,10 +471,20 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  				pr_err("Dump taken by platform is not valid (%d)\n", i);
  				rc = -EINVAL;
  			}
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len) {
+
+			/*
+			 * Make sure that dump is collected for entire region.
+			 * CPU_STATE_DATA region is allowed to dump less than allocated space.
+			 */
+			if (!(bytes_dumped == source_len ||
+			(type == RTAS_FADUMP_CPU_STATE_DATA && bytes_dumped <= source_len))) {
+
  				pr_err("Dump taken by platform is incomplete (%d)\n", i);
+				pr_debug("type -> %d, bytes_dumped -> %llx, source_len -> %llx\n",
+					 type, bytes_dumped, source_len);
  				rc = -EINVAL;
  			}
+
  			if (rc) {
  				pr_warn("Region type: %u src addr: 0x%llx dest addr: 0x%llx\n",
  					be16_to_cpu(fdm_active->rgn[i].source_data_type),
@@ -482,7 +494,7 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  			}
  			break;
  		case RTAS_FADUMP_PARAM_AREA:
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len ||
+			if (bytes_dumped != source_len ||
  			    fdm_active->rgn[i].error_flags != 0) {
  				pr_warn("Failed to process additional parameters! Proceeding anyway..\n");
  				fadump_conf->param_area = 0;

Re: [PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Anushree Mathur <hidden>
Date: 2026-09-23 16:21:29

On 28/08/26 3:19 PM, Shivang Upadhyay wrote:
quoted hunk
During Fadump in Qemu VM, when maxcpus value is set to more than current
cpus, following failure is observed.

     [    0.045806] [      T1] rtas fadump: Dump taken by platform is
         incomplete (0)

This is because the CPU_STATE_DATA is allocated for maxcpus, while the
data is only filled for current cpus. As per current implementation
of Fadump, dumped_bytes and source_len for a region have to match,
Which is failing for qemu's case, Even tough the dumped bytes are
reported correctly for only the current cpus. After this /proc/vmcore
generatition also fails.

Allowing dumped_bytes to be lesser than or equal to allocated length, for
CPU_STATE_DATA Fadump region.

Reported-by: Anushree Mathur <redacted>
Closes: https://lore.kernel.org/all/5e66daf4-3f55-4044-94a5-4f50bb040849@linux.ibm.com/T/#u
Signed-off-by: Shivang Upadhyay <redacted>
---

Changelog:
v4:
     removed extra blank line.

v3: https://lore.kernel.org/all/20260827075803.2240934-1-shivangu@linux.ibm.com/
     removed extra variable.

v2: https://lore.kernel.org/all/20260826125626.2108771-1-shivangu@linux.ibm.com/
     Only allowing lesser size for CPU_STATE_DATE Fadump region.

v1: https://lore.kernel.org/qemu-devel/20260429065127.366813-1-shivangu@linux.ibm.com/

---
  arch/powerpc/platforms/pseries/rtas-fadump.c | 16 ++++++++++++++--
  1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/rtas-fadump.c b/arch/powerpc/platforms/pseries/rtas-fadump.c
index 3bb4ac2ab6cc..838e97c24308 100644
--- a/arch/powerpc/platforms/pseries/rtas-fadump.c
+++ b/arch/powerpc/platforms/pseries/rtas-fadump.c
@@ -459,6 +459,8 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  	/* Check if the dump data is valid. */
  	for (int i = 0; i < be16_to_cpu(fdm_active->header.dump_num_sections); i++) {
  		int type = be16_to_cpu(fdm_active->rgn[i].source_data_type);
+		uint64_t bytes_dumped = be64_to_cpu(fdm_active->rgn[i].bytes_dumped);
+		uint64_t source_len = be64_to_cpu(fdm_active->rgn[i].source_len);
  		int rc = 0;
  
  		switch (type) {
@@ -469,10 +471,20 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  				pr_err("Dump taken by platform is not valid (%d)\n", i);
  				rc = -EINVAL;
  			}
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len) {
+
+			/*
+			 * Make sure that dump is collected for entire region.
+			 * CPU_STATE_DATA region is allowed to dump less than allocated space.
+			 */
+			if (!(bytes_dumped == source_len ||
+			(type == RTAS_FADUMP_CPU_STATE_DATA && bytes_dumped <= source_len))) {
+
  				pr_err("Dump taken by platform is incomplete (%d)\n", i);
+				pr_debug("type -> %d, bytes_dumped -> %llx, source_len -> %llx\n",
+					 type, bytes_dumped, source_len);
  				rc = -EINVAL;
  			}
+
  			if (rc) {
  				pr_warn("Region type: %u src addr: 0x%llx dest addr: 0x%llx\n",
  					be16_to_cpu(fdm_active->rgn[i].source_data_type),
@@ -482,7 +494,7 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
  			}
  			break;
  		case RTAS_FADUMP_PARAM_AREA:
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len ||
+			if (bytes_dumped != source_len ||
  			    fdm_active->rgn[i].error_flags != 0) {
  				pr_warn("Failed to process additional parameters! Proceeding anyway..\n");
  				fadump_conf->param_area = 0;
Hi Shivang,
Thanks for working on this fix, I have tested it with patched kernel on both PowerVM (ppc64le) lpar and guest, and it worked totally fine.

As reported earlier https://lore.kernel.org/lkml/5e66daf4-3f55-4044-94a5-4f50bb040849@linux.ibm.com/ without patch I was seeing multiple kernel OOPS and

    [    0.045806] [      T1] rtas fadump: Dump taken by platform is
        incomplete (0)

After applying the patch I am not seeing OOPS and not even this error :
"[    0.045806] [      T1] rtas fadump: Dump taken by platform is incomplete (0)"

Fadump got completed and I came back to guest console successfully.

Please feel free to add:

Tested-by: Anushree Mathur<redacted>
Thank you,
Anushree Mathur

Re: [PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Mukesh Kumar Chaurasiya <hidden>
Date: 2026-09-24 09:36:45

On Fri, Aug 28, 2026 at 03:19:42PM +0530, Shivang Upadhyay wrote:
quoted hunk
During Fadump in Qemu VM, when maxcpus value is set to more than current
cpus, following failure is observed.

    [    0.045806] [      T1] rtas fadump: Dump taken by platform is
        incomplete (0)

This is because the CPU_STATE_DATA is allocated for maxcpus, while the
data is only filled for current cpus. As per current implementation
of Fadump, dumped_bytes and source_len for a region have to match,
Which is failing for qemu's case, Even tough the dumped bytes are
reported correctly for only the current cpus. After this /proc/vmcore
generatition also fails.

Allowing dumped_bytes to be lesser than or equal to allocated length, for
CPU_STATE_DATA Fadump region.

Reported-by: Anushree Mathur <redacted>
Closes: https://lore.kernel.org/all/5e66daf4-3f55-4044-94a5-4f50bb040849@linux.ibm.com/T/#u
Signed-off-by: Shivang Upadhyay <redacted>
---

Changelog:
v4:
    removed extra blank line.

v3: https://lore.kernel.org/all/20260827075803.2240934-1-shivangu@linux.ibm.com/
    removed extra variable.

v2: https://lore.kernel.org/all/20260826125626.2108771-1-shivangu@linux.ibm.com/
    Only allowing lesser size for CPU_STATE_DATE Fadump region.

v1: https://lore.kernel.org/qemu-devel/20260429065127.366813-1-shivangu@linux.ibm.com/

---
 arch/powerpc/platforms/pseries/rtas-fadump.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/rtas-fadump.c b/arch/powerpc/platforms/pseries/rtas-fadump.c
index 3bb4ac2ab6cc..838e97c24308 100644
--- a/arch/powerpc/platforms/pseries/rtas-fadump.c
+++ b/arch/powerpc/platforms/pseries/rtas-fadump.c
@@ -459,6 +459,8 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 	/* Check if the dump data is valid. */
 	for (int i = 0; i < be16_to_cpu(fdm_active->header.dump_num_sections); i++) {
 		int type = be16_to_cpu(fdm_active->rgn[i].source_data_type);
+		uint64_t bytes_dumped = be64_to_cpu(fdm_active->rgn[i].bytes_dumped);
+		uint64_t source_len = be64_to_cpu(fdm_active->rgn[i].source_len);
 		int rc = 0;
 
 		switch (type) {
@@ -469,10 +471,20 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 				pr_err("Dump taken by platform is not valid (%d)\n", i);
 				rc = -EINVAL;
 			}
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len) {
+
+			/*
+			 * Make sure that dump is collected for entire region.
+			 * CPU_STATE_DATA region is allowed to dump less than allocated space.
+			 */
+			if (!(bytes_dumped == source_len ||
+			(type == RTAS_FADUMP_CPU_STATE_DATA && bytes_dumped <= source_len))) {
+
Extra line here.
quoted hunk
 				pr_err("Dump taken by platform is incomplete (%d)\n", i);
+				pr_debug("type -> %d, bytes_dumped -> %llx, source_len -> %llx\n",
+					 type, bytes_dumped, source_len);
 				rc = -EINVAL;
 			}
Can bytes_dumped be greater than source_len? 
If yes then the error is misinformed that it's incomplete instead it's corrupted.
If No then shouldn't the internal check bytes_dumped <= source_len should handle it?

Regards,
Mukesh
quoted hunk
+
 			if (rc) {
 				pr_warn("Region type: %u src addr: 0x%llx dest addr: 0x%llx\n",
 					be16_to_cpu(fdm_active->rgn[i].source_data_type),
@@ -482,7 +494,7 @@ static int __init rtas_fadump_process(struct fw_dump *fadump_conf)
 			}
 			break;
 		case RTAS_FADUMP_PARAM_AREA:
-			if (fdm_active->rgn[i].bytes_dumped != fdm_active->rgn[i].source_len ||
+			if (bytes_dumped != source_len ||
 			    fdm_active->rgn[i].error_flags != 0) {
 				pr_warn("Failed to process additional parameters! Proceeding anyway..\n");
 				fadump_conf->param_area = 0;
-- 
2.54.0

Re: [PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Shivang Upadhyay <hidden>
Date: 2026-09-24 13:26:27

On Thu, 2026-09-24 at 15:06 +0530, Mukesh Kumar Chaurasiya wrote:
quoted
+			 */
+			if (!(bytes_dumped == source_len ||
+			(type == RTAS_FADUMP_CPU_STATE_DATA &&
bytes_dumped <= source_len))) {
+
Extra line here.
I'll fix this in next revision.
quoted
  				pr_err("Dump taken by platform is
incomplete (%d)\n", i);
+				pr_debug("type -> %d, bytes_dumped
-> %llx, source_len -> %llx\n",
+					 type, bytes_dumped,
source_len);
  				rc = -EINVAL;
  			}
Can bytes_dumped be greater than source_len? 
If yes then the error is misinformed that it's incomplete instead
it's corrupted.
If No then shouldn't the internal check bytes_dumped <= source_len
should handle it?
Yes, It can be more. The wording on error here can be better. I should
change that in next revision.

Thanks for your review.

~Shivang.

Re: [PATCH v4] ppc/fadump: collect dump when CPU_STATE_DATA is less than reserved

From: Shivang Upadhyay <hidden>
Date: 2026-09-24 13:28:03

On Wed, 2026-09-23 at 21:51 +0530, Anushree Mathur wrote:
Please feel free to add:

Tested-by: Anushree Mathur<redacted>
Thank you,
Anushree Mathur
Thanks. As I need to send another version with minor changes, I'll keep
this tag.

~Shivang.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help