On 20/08/19 5:35 PM, Hari Bathini wrote:
> During kexec boot, metadata address needs to be reset to avoid running
> into errors interpreting stale metadata address, in case the kexec'ed
> kernel crashes before metadata address could be setup again.
> 
> Signed-off-by: Hari Bathini <hbath...@linux.ibm.com>
> ---
>  arch/powerpc/kernel/fadump-common.h          |    1 +
>  arch/powerpc/kernel/fadump.c                 |    2 ++
>  arch/powerpc/platforms/powernv/opal-fadump.c |   10 ++++++++++
>  arch/powerpc/platforms/pseries/rtas-fadump.c |    3 +++
>  4 files changed, 16 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/fadump-common.h 
> b/arch/powerpc/kernel/fadump-common.h
> index 0acf412..d2dd117 100644
> --- a/arch/powerpc/kernel/fadump-common.h
> +++ b/arch/powerpc/kernel/fadump-common.h
> @@ -120,6 +120,7 @@ struct fadump_ops {
>       int     (*fadump_register)(struct fw_dump *fadump_config);
>       int     (*fadump_unregister)(struct fw_dump *fadump_config);
>       int     (*fadump_invalidate)(struct fw_dump *fadump_config);
> +     void    (*fadump_cleanup)(struct fw_dump *fadump_config);
>       int     (*fadump_process)(struct fw_dump *fadump_config);
>       void    (*fadump_region_show)(struct fw_dump *fadump_config,
>                                     struct seq_file *m);
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index a086a09..b2d5ca6 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -830,6 +830,8 @@ void fadump_cleanup(void)
>               fw_dump.ops->fadump_unregister(&fw_dump);
>               free_crash_memory_ranges();
>       }
> +
> +     fw_dump.ops->fadump_cleanup(&fw_dump);

Actually, need to check if FADump is supported before proceeding with cleanup 
callbacks
as fadump_cleanup() can be called outside FADump code in shutdown and kexec 
paths which
could crash the system on machines that do not support FADump. Re-sent the 
patch adding
the check in fadump_cleanup() function:

    https://patchwork.ozlabs.org/patch/1153806/
    ("[RESEND,v5,13/31] powernv/fadump: reset metadata address during clean up")

- Hari

Reply via email to