Re: [RFC][PATCHv4 2/6] printk: rename nmi.c and exported api

From: Petr Mladek
Date: Thu Nov 24 2016 - 11:35:08 EST


On Fri 2016-10-28 00:49:29, Sergey Senozhatsky wrote:
> A preparation patch for printk_safe work. No functional change.
> - rename nmi.c to print_safe.c
> - rename exported functions to have `safe' prefix.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
> ---
> arch/arm/kernel/smp.c | 4 +-
> include/linux/hardirq.h | 4 +-
> include/linux/printk.h | 20 +++++-----
> init/Kconfig | 16 ++++----
> init/main.c | 2 +-
> kernel/kexec_core.c | 2 +-
> kernel/panic.c | 4 +-
> kernel/printk/Makefile | 2 +-
> kernel/printk/{nmi.c => printk_safe.c} | 69 +++++++++++++++++-----------------
> lib/nmi_backtrace.c | 2 +-
> 10 files changed, 64 insertions(+), 61 deletions(-)
> rename kernel/printk/{nmi.c => printk_safe.c} (77%)
>
> diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
> index 7dd14e8..8b056e1 100644
> --- a/arch/arm/kernel/smp.c
> +++ b/arch/arm/kernel/smp.c
> @@ -644,11 +644,11 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
> break;
>
> case IPI_CPU_BACKTRACE:
> - printk_nmi_enter();
> + printk_safe_nmi_enter();
> irq_enter();
> nmi_cpu_backtrace(regs);
> irq_exit();
> - printk_nmi_exit();
> + printk_safe_nmi_exit();
> break;
>
> default:
> diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
> index c683996..14840aa 100644
> --- a/include/linux/hardirq.h
> +++ b/include/linux/hardirq.h
> @@ -61,7 +61,7 @@ extern void irq_exit(void);
>
> #define nmi_enter() \
> do { \
> - printk_nmi_enter(); \
> + printk_safe_nmi_enter(); \
> lockdep_off(); \
> ftrace_nmi_enter(); \
> BUG_ON(in_nmi()); \
> @@ -78,7 +78,7 @@ extern void irq_exit(void);
> preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> ftrace_nmi_exit(); \
> lockdep_on(); \
> - printk_nmi_exit(); \
> + printk_safe_nmi_exit(); \
> } while (0)
>
> #endif /* LINUX_HARDIRQ_H */
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index eac1af8..c9a3080 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -132,17 +132,17 @@ void early_printk(const char *s, ...) { }
> #endif
>
> #ifdef CONFIG_PRINTK_NMI
> -extern void printk_nmi_init(void);
> -extern void printk_nmi_enter(void);
> -extern void printk_nmi_exit(void);
> -extern void printk_nmi_flush(void);
> -extern void printk_nmi_flush_on_panic(void);
> +extern void printk_safe_init(void);
> +extern void printk_safe_nmi_enter(void);
> +extern void printk_safe_nmi_exit(void);

I would personally keep the short names pritnk_nmi_enter() and
printk_nmi_exit(). These are the only functions that will stay
in this CONFIG_PRINT_NMI section. The others are generic and
will be moved to the generic section in the next patch.

Well, it is just a cosmetic problem and a personal opinion.
The patch makes sense and looks fine:

Reviewed-by: Petr Mladek <pmladek@pmladek@suse.com>

Best Regards,
Petr