lkml.org 
[lkml]   [2018]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCHv2 2/4] printk: move printk_safe macros to printk header
On Tue, Oct 16, 2018 at 02:04:26PM +0900, Sergey Senozhatsky wrote:
> Make printk_safe_enter_irqsave()/etc macros available to the
> rest of the kernel.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> include/linux/printk.h | 40 +++++++++++++++++++++++++++++++++++++
> kernel/printk/internal.h | 37 ----------------------------------
> kernel/printk/printk_safe.c | 6 ++++--
> 3 files changed, 44 insertions(+), 39 deletions(-)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index cf3eccfe1543..75f99441fd54 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -157,6 +157,46 @@ static inline void printk_nmi_direct_enter(void) { }
> static inline void printk_nmi_direct_exit(void) { }
> #endif /* PRINTK_NMI */
>
> +#ifdef CONFIG_PRINTK
> +extern void printk_safe_enter(void);
> +extern void printk_safe_exit(void);
> +
> +#define printk_safe_enter_irqsave(flags) \
> + do { \
> + local_irq_save(flags); \
> + printk_safe_enter(); \
> + } while (0)
> +
> +#define printk_safe_exit_irqrestore(flags) \
> + do { \
> + printk_safe_exit(); \
> + local_irq_restore(flags); \
> + } while (0)
> +
> +#define printk_safe_enter_irq() \
> + do { \
> + local_irq_disable(); \
> + printk_safe_enter(); \
> + } while (0)
> +
> +#define printk_safe_exit_irq() \
> + do { \
> + printk_safe_exit(); \
> + local_irq_enable(); \
> + } while (0)

So I really _really_ hate all this. Utterly detest it.

That whole magic 'safe' printk buffer crap is just that crap.

Instead of this tinkering around the edges, why don't you make the main
logbuf a lockless ringbuffer and then delegate the actual printing of
that buffer to a kthread, except for earlycon, which can do synchronous
output.

\
 
 \ /
  Last update: 2018-10-16 09:29    [W:0.185 / U:2.364 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site