2019-09-25 07:13:47

by Michal Suchánek

[permalink] [raw]
Subject: [PATCH v2 rebased] 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.

Signed-off-by: Michal Suchanek <[email protected]>
Acked-by: Hari Bathini <[email protected]>
---
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(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index ed59855430b9..cdcdea6c6453 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -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);
--
2.23.0


2019-10-24 08:53:47

by Michal Suchánek

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Michal Suchanek <[email protected]>
---
arch/powerpc/kernel/fadump.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index cdcdea6c6453..f40dc713f089 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -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
--
2.23.0

2019-10-25 09:35:27

by Hari Bathini

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


Michal, thanks for looking into this.

On 23/10/19 11:26 PM, Michal Suchanek wrote:
> 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

2019-10-25 09:50:43

by Michal Suchánek

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

On Thu, Oct 24, 2019 at 04:08:08PM +0530, Hari Bathini wrote:
>
> Michal, thanks for looking into this.
>
> On 23/10/19 11:26 PM, Michal Suchanek wrote:
> > 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.

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

2019-11-07 16:44:16

by Michal Suchánek

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

On Thu, Oct 24, 2019 at 01:16:51PM +0200, Michal Such?nek wrote:
> On Thu, Oct 24, 2019 at 04:08:08PM +0530, Hari Bathini wrote:
> >
> > Michal, thanks for looking into this.
> >
> > On 23/10/19 11:26 PM, Michal Suchanek wrote:
> > > 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.
>
> 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

2019-11-07 16:48:59

by Michal Suchánek

[permalink] [raw]
Subject: [PATCH v3] 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.

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

Signed-off-by: Michal Suchanek <[email protected]>
---
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(-)

diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index ed59855430b9..ff0114aeba9b 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -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);
--
2.23.0

2019-11-08 12:13:39

by Hari Bathini

[permalink] [raw]
Subject: Re: [PATCH v3] powerpc/fadump: when fadump is supported register the fadump sysfs files.



On 07/11/19 10:17 PM, Michal Suchanek wrote:
> 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.

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...

Reviewed-by: Hari Bathini <[email protected]>

>
> Signed-off-by: Michal Suchanek <[email protected]>
> ---
> 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(-)
>
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index ed59855430b9..ff0114aeba9b 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -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);
>

--
- Hari

2019-11-14 09:18:29

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v3] powerpc/fadump: when fadump is supported register the fadump sysfs files.

On Thu, 2019-11-07 at 16:47:57 UTC, Michal Suchanek wrote:
> 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.
>
> Signed-off-by: Michal Suchanek <[email protected]>

Applied to powerpc next, thanks.

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

cheers