Skip to contentSkip to conversation

powerpc/fadump: when fadump is supported register the fadump sysfs files.

PATCH Superseded Michal Suchanek 3 participants 8 messages Sep 23, 2019 – Nov 14, 2019 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/fadump: when fadump is supported register the fadump sysfs files.

Currently it is not possible to distinguish the case when fadump is supported by firmware and disabled in kernel and completely unsupported using the kernel sysfs interface. User can investigate the devicetree but it is more reasonable to provide sysfs files in case we get some fadumpv2 in the future.

With this patch sysfs files are available whenever fadump is supported by firmware.

---
v2: move the sysfs initialization earlier to avoid condition nesting
rebase: on top of the powernv fadump support

---
 arch/powerpc/kernel/fadump.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
arch/powerpc/kernel/fadump.c +9 -7
index ed59855430b9..cdcdea6c6453 100644
@@ -1466,16 +1466,20 @@ static void fadump_init_files(void)
  */
 int __init setup_fadump(void)
 {
-	if (!fw_dump.fadump_enabled)
-		return 0;
-
-	if (!fw_dump.fadump_supported) {
+	if (!fw_dump.fadump_supported && fw_dump.fadump_enabled) {
 		printk(KERN_ERR "Firmware-assisted dump is not supported on"
 			" this hardware\n");
-		return 0;
 	}
 
+	if (!fw_dump.fadump_supported)
+		return 0;
+
+	fadump_init_files();
 	fadump_show_config();
+
+	if (!fw_dump.fadump_enabled)
+		return 1;
+
 	/*
 	 * If dump data is available then see if it is valid and prepare for
 	 * saving it to the disk.
@@ -1492,8 +1496,6 @@ int __init setup_fadump(void)
 	else if (fw_dump.reserve_dump_area_size)
 		fw_dump.ops->fadump_init_mem_struct(&fw_dump);
 
-	fadump_init_files();
-
 	return 1;
 }
 subsys_initcall(setup_fadump);
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/1 powerpc/fadump: Remove duplicate message.

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Due to different capitalization it is clear that the one in setup_fadump is shown on boot. Remove the duplicate that is not shown.

---
 arch/powerpc/kernel/fadump.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/kernel/fadump.c +1 -3
index cdcdea6c6453..f40dc713f089 100644
@@ -438,10 +438,8 @@ int __init fadump_reserve_mem(void)
 	if (!fw_dump.fadump_enabled)
 		return 0;
 
-	if (!fw_dump.fadump_supported) {
-		pr_info("Firmware-Assisted Dump is not supported on this hardware\n");
+	if (!fw_dump.fadump_supported)
 		goto error_out;
-	}
 
 	/*
 	 * Initialize boot memory size
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH] powerpc/fadump: Remove duplicate message.

Michal, thanks for looking into this.

Quoted 4 lines · Michal Suchanek

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Due to different capitalization it is clear that the one in setup_fadump is shown on boot. Remove the duplicate that is not shown.

Actually, the message in fadump_reserve_mem() is logged. fadump_reserve_mem() executes first and sets fw_dump.fadump_enabled to 0, if fadump is not supported. So, the other message in setup_fadump() doesn't get logged anymore with recent changes. The right thing to do would be to remove similar message in setup_fadump() instead.

- Hari

#3 lore raw

Re: [PATCH] powerpc/fadump: Remove duplicate message.

Quoted 9 lines · Hari Bathini

Michal, thanks for looking into this.

Quoted 4 lines · Michal Suchanek

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Due to different capitalization it is clear that the one in setup_fadump is shown on boot. Remove the duplicate that is not shown.

Quoted 4 lines

Actually, the message in fadump_reserve_mem() is logged. fadump_reserve_mem() executes first and sets fw_dump.fadump_enabled to 0, if fadump is not supported. So, the other message in setup_fadump() doesn't get logged anymore with recent changes. The right thing to do would be to remove similar message in setup_fadump() instead.

I need to re-check with a recent kernel build. I saw the message from setup_fadump and not the one from fadump_reserve_mem but not sure what the platform init code looked like in the kernel I tested with.

Thanks

Michal

#4 lore raw

Re: [PATCH] powerpc/fadump: Remove duplicate message.

Quoted 10 lines · Michal Suchánek
Quoted 9 lines · Hari Bathini

Michal, thanks for looking into this.

Quoted 4 lines · Michal Suchanek

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Due to different capitalization it is clear that the one in setup_fadump is shown on boot. Remove the duplicate that is not shown.

Quoted 8 lines
Quoted 4 lines

Actually, the message in fadump_reserve_mem() is logged. fadump_reserve_mem() executes first and sets fw_dump.fadump_enabled to 0, if fadump is not supported. So, the other message in setup_fadump() doesn't get logged anymore with recent changes. The right thing to do would be to remove similar message in setup_fadump() instead.

I need to re-check with a recent kernel build. I saw the message from setup_fadump and not the one from fadump_reserve_mem but not sure what the platform init code looked like in the kernel I tested with.

Indeed, I was missing the patch that changes the capitalization in fadump_reserve_mem. In my kernel both messages are the same and the one from fadump_reserve_mem is displayed.

Thanks

Michal

#5 lore raw

PATCH v3 1/1 powerpc/fadump: when fadump is supported register the fadump sysfs files.

In reply to Michal Suchanek

Currently it is not possible to distinguish the case when fadump is supported by firmware and disabled in kernel and completely unsupported using the kernel sysfs interface. User can investigate the devicetree but it is more reasonable to provide sysfs files in case we get some fadumpv2 in the future.

With this patch sysfs files are available whenever fadump is supported by firmware.

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Remove the duplicate message in setup_fadump.

---
v2: move the sysfs initialization earlier to avoid condition nesting
v3: remove duplicate message

---
 arch/powerpc/kernel/fadump.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
arch/powerpc/kernel/fadump.c +6 -9
index ed59855430b9..ff0114aeba9b 100644
@@ -1466,16 +1466,15 @@ static void fadump_init_files(void)
  */
 int __init setup_fadump(void)
 {
-	if (!fw_dump.fadump_enabled)
-		return 0;
-
-	if (!fw_dump.fadump_supported) {
-		printk(KERN_ERR "Firmware-assisted dump is not supported on"
-			" this hardware\n");
+	if (!fw_dump.fadump_supported)
 		return 0;
-	}
 
+	fadump_init_files();
 	fadump_show_config();
+
+	if (!fw_dump.fadump_enabled)
+		return 1;
+
 	/*
 	 * If dump data is available then see if it is valid and prepare for
 	 * saving it to the disk.
@@ -1492,8 +1491,6 @@ int __init setup_fadump(void)
 	else if (fw_dump.reserve_dump_area_size)
 		fw_dump.ops->fadump_init_mem_struct(&fw_dump);
 
-	fadump_init_files();
-
 	return 1;
 }
 subsys_initcall(setup_fadump);
Signature · 1 line
2.23.0
Reviewed-by on v3 1/1
#6 lore raw
Quoted 6 lines · Michal Suchanek

Currently it is not possible to distinguish the case when fadump is supported by firmware and disabled in kernel and completely unsupported using the kernel sysfs interface. User can investigate the devicetree but it is more reasonable to provide sysfs files in case we get some fadumpv2 in the future.

Quoted 6 lines

With this patch sysfs files are available whenever fadump is supported by firmware.

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Remove the duplicate message in setup_fadump.

Thanks for doing this, Michal.
Exporting the node will be helpful in finding if FADump is supported, given FADump is now supported on two different platforms...

Quoted 46 lines

---
v2: move the sysfs initialization earlier to avoid condition nesting
v3: remove duplicate message

---
 arch/powerpc/kernel/fadump.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
arch/powerpc/kernel/fadump.c +6 -9
index ed59855430b9..ff0114aeba9b 100644
@@ -1466,16 +1466,15 @@ static void fadump_init_files(void)
  */
 int __init setup_fadump(void)
 {
-	if (!fw_dump.fadump_enabled)
-		return 0;
-
-	if (!fw_dump.fadump_supported) {
-		printk(KERN_ERR "Firmware-assisted dump is not supported on"
-			" this hardware\n");
+	if (!fw_dump.fadump_supported)
 		return 0;
-	}
 
+	fadump_init_files();
 	fadump_show_config();
+
+	if (!fw_dump.fadump_enabled)
+		return 1;
+
 	/*
 	 * If dump data is available then see if it is valid and prepare for
 	 * saving it to the disk.
@@ -1492,8 +1491,6 @@ int __init setup_fadump(void)
 	else if (fw_dump.reserve_dump_area_size)
 		fw_dump.ops->fadump_init_mem_struct(&fw_dump);
 
-	fadump_init_files();
-
 	return 1;
 }
 subsys_initcall(setup_fadump);
Signature · 1 line
- Hari
#7 lore raw
In reply to Michal Suchanek
Quoted 6 lines · Michal Suchanek

Currently it is not possible to distinguish the case when fadump is supported by firmware and disabled in kernel and completely unsupported using the kernel sysfs interface. User can investigate the devicetree but it is more reasonable to provide sysfs files in case we get some fadumpv2 in the future.

Quoted 8 lines

With this patch sysfs files are available whenever fadump is supported by firmware.

There is duplicate message about lack of support by firmware in fadump_reserve_mem and setup_fadump. Remove the duplicate message in setup_fadump.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/565f9bc05e2dad6c7fdfc7c2e641be580aa599cd

cheers