Re: [RFC][PATCH] Replace a function call chain of kmsg_dump(KMSG_DUMP_KEXEC) with static function calls

Américo Wang
2011-07-13T08:38:10Z

2011/7/11 Seiji Aguchi <seiji.aguchi@hds.com>:
> Hi,
>

Hi,

>
> [Patch Description]
>
>  For meeting Eric/Vivek's requirements and solving issues of pstore/efivars driver,  I propose a following patch.
>
>    - Remove kmsg_dump(KMSG_DUMP_KEXEC) from crash_kexec()

It is already removed in -mm, can you rebase your patch against -mm?

>    - Add kmsg_dump_kexec() to crash_kexec()
>        kmsg_dump_kexec() moved behind machine_crash_shutdown() so that
>        we can output kernel messages without getting any locks.
>
>    - Introduce CONFIG_KMSG_DUMP_KEXEC
>        - CONFIG_KMSG_DUMP_KEXEC depends on CONFIG_PRINTK which is required for kmsg_dumper.
>
>        - CONFIG_KMSG_DUMP_KEXEC=n (default)
>          Kernel message logging feature doesn't work in kdump path.
>
>        - CONFIG_KMSG_DUMP_KEXEC=y
>          following static functions are called in kdump path.
>          - kmsg_dump_kexec(): This is based on kmsg_dump() and just removed spinlock and a function call chain from it.
>          - do_kmsg_dump_kexec(): This is based on pstore_dump() and just removed mutex lock from it.
>
>        Some people who are not familiar with kexec may add function calls getting spin_lock/mutex_lock in kexec path.
>        These function calls causes failure of kexec.
>        So, I suggest replace a call chain with static function calls so that we can keep reliability of kexec.
>
>     - Add efi_kmsg_dump_kexec() which outputs kernel messages into NVRAM with EFI.
>       This is called by do_kmsg_dump_kexec() statically.
>       By applying to Matthew Garret's patch below, its kernel messages in NVRAM are visible through /dev/pstore.

This looks weird, kmsg_dump_kexec() calls do_kmsg_dump_kexec()
which then calls efi_kmsg_dump_kexec(), so, why not just call
efi_kmsg_dump_kexec()?
since there is no other user of kmsg_dump_kexec().

From the name CONFIG_KMSG_DUMP_KEXEC, you seem to provide a generic method,
but actually only efi_kmsg_dump_kexec() is and can be called.

Thanks.