Merge branch 'rework/printk_safe-removal' into for-linus
authorPetr Mladek <pmladek@suse.com>
Mon, 30 Aug 2021 14:36:10 +0000 (16:36 +0200)
committerPetr Mladek <pmladek@suse.com>
Mon, 30 Aug 2021 14:36:10 +0000 (16:36 +0200)
1  2 
arch/powerpc/kernel/traps.c
arch/powerpc/kernel/watchdog.c
arch/powerpc/kexec/crash.c
include/linux/printk.h
init/Kconfig
kernel/kexec_core.c
kernel/panic.c
kernel/printk/internal.h
kernel/printk/printk.c
kernel/trace/trace.c

Simple merge
Simple merge
Simple merge
@@@ -170,8 -166,18 +158,18 @@@ int _printk(const char *fmt, ...)
  /*
   * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ !
   */
 -__printf(1, 2) __cold int printk_deferred(const char *fmt, ...);
 +__printf(1, 2) __cold int _printk_deferred(const char *fmt, ...);
  
+ extern void __printk_safe_enter(void);
+ extern void __printk_safe_exit(void);
+ /*
+  * The printk_deferred_enter/exit macros are available only as a hack for
+  * some code paths that need to defer all printk console printing. Interrupts
+  * must be disabled for the deferred duration.
+  */
+ #define printk_deferred_enter __printk_safe_enter
+ #define printk_deferred_exit __printk_safe_exit
  /*
   * Please don't use printk_ratelimit(), because it shares ratelimiting state
   * with all other unrelated printk_ratelimit() callsites.  Instead use
diff --cc init/Kconfig
Simple merge
Simple merge
diff --cc kernel/panic.c
Simple merge
@@@ -6,18 -6,6 +6,12 @@@
  
  #ifdef CONFIG_PRINTK
  
- #define PRINTK_SAFE_CONTEXT_MASK      0x007ffffff
- #define PRINTK_NMI_DIRECT_CONTEXT_MASK        0x008000000
- #define PRINTK_NMI_CONTEXT_MASK               0xff0000000
- #define PRINTK_NMI_CONTEXT_OFFSET     0x010000000
 +/* Flags for a single printk record. */
 +enum printk_info_flags {
 +      LOG_NEWLINE     = 2,    /* text ended with a newline */
 +      LOG_CONT        = 8,    /* text is a fragment of a continuation line */
 +};
 +
  __printf(4, 0)
  int vprintk_store(int facility, int level,
                  const struct dev_printk_info *dev_info,
@@@ -43,22 -28,8 +34,10 @@@ bool printk_percpu_data_ready(void)
                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)
  void defer_console_output(void);
  
 +u16 printk_parse_prefix(const char *text, int *level,
 +                      enum printk_info_flags *flags);
  #else
  
  /*
@@@ -350,8 -350,13 +350,8 @@@ static int console_msg_format = MSG_FOR
   * non-prinatable characters are escaped in the "\xff" notation.
   */
  
 -enum log_flags {
 -      LOG_NEWLINE     = 2,    /* text ended with a newline */
 -      LOG_CONT        = 8,    /* text is a fragment of a continuation line */
 -};
 -
  /* syslog_lock protects syslog_* variables and write access to clear_seq. */
- static DEFINE_RAW_SPINLOCK(syslog_lock);
+ static DEFINE_MUTEX(syslog_lock);
  
  #ifdef CONFIG_PRINTK
  DECLARE_WAIT_QUEUE_HEAD(log_wait);
@@@ -2035,10 -2104,12 +2101,12 @@@ int vprintk_store(int facility, int lev
  {
        const u32 caller_id = printk_caller_id();
        struct prb_reserved_entry e;
 -      enum log_flags lflags = 0;
 +      enum printk_info_flags flags = 0;
        struct printk_record r;
+       unsigned long irqflags;
        u16 trunc_msg_len = 0;
        char prefix_buf[8];
+       u8 *recursion_ptr;
        u16 reserve_size;
        va_list args2;
        u16 text_len;
@@@ -2655,9 -2740,7 +2731,7 @@@ skip
         * there's a new owner and the console_unlock() from them will do the
         * flush, no worries.
         */
 -      retry = prb_read_valid(prb, console_seq, NULL);
 +      retry = prb_read_valid(prb, next_seq, NULL);
-       printk_safe_exit_irqrestore(flags);
        if (retry && console_trylock())
                goto again;
  }
Simple merge