[PATCH 1/4] printk: An all-in-one commit to fix build failures

From: Sebastian Andrzej Siewior
Date: Wed Mar 27 2019 - 14:33:27 EST


From: John Ogness <john.ogness@xxxxxxxxxxxxx>

This commit contains addresses several build failures which were
reported by the kbuild test robot.
The fixes were folded into the original commits.

Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
arch/powerpc/kernel/traps.c | 1 -
arch/powerpc/kernel/watchdog.c | 5 -----
kernel/printk/printk.c | 16 ++++++++++++++--
lib/printk_ringbuffer.c | 8 +++++++-
4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 7a1de34f38c85..314be8e39d1fd 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -174,7 +174,6 @@ extern void panic_flush_kmsg_start(void)

extern void panic_flush_kmsg_end(void)
{
- printk_safe_flush_on_panic();
kmsg_dump(KMSG_DUMP_PANIC);
bust_spinlocks(0);
debug_locks_off();
diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c
index 3c6ab22a0c4e3..bf98181c5b309 100644
--- a/arch/powerpc/kernel/watchdog.c
+++ b/arch/powerpc/kernel/watchdog.c
@@ -181,11 +181,6 @@ static void watchdog_smp_panic(int cpu, u64 tb)

wd_smp_unlock(&flags);

- printk_safe_flush();
- /*
- * printk_safe_flush() seems to require another print
- * before anything actually goes out to console.
- */
if (sysctl_hardlockup_all_cpu_backtrace)
trigger_allbutself_cpu_backtrace();

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5cfd8ea445362..997d07b6bf975 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -370,6 +370,18 @@ static u64 clear_seq;
#define LOG_LEVEL(v) ((v) & 0x07)
#define LOG_FACILITY(v) ((v) >> 3 & 0xff)

+/* Return log buffer address */
+char *log_buf_addr_get(void)
+{
+ return printk_rb.buffer;
+}
+
+/* Return log buffer size */
+u32 log_buf_len_get(void)
+{
+ return (1 << printk_rb.size_bits);
+}
+
/* human readable text of the record */
static char *log_text(const struct printk_log *msg)
{
@@ -1910,7 +1922,7 @@ asmlinkage int vprintk_emit(int facility, int level,
}
EXPORT_SYMBOL(vprintk_emit);

-__printf(1, 0) int vprintk_func(const char *fmt, va_list args)
+static __printf(1, 0) int vprintk_func(const char *fmt, va_list args)
{
return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args);
}
@@ -2684,7 +2696,7 @@ static int __init init_printk_kthread(void)
}
late_initcall(init_printk_kthread);

-int vprintk_deferred(const char *fmt, va_list args)
+static int vprintk_deferred(const char *fmt, va_list args)
{
return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, 0, fmt, args);
}
diff --git a/lib/printk_ringbuffer.c b/lib/printk_ringbuffer.c
index ce33b5add5a17..9a31d7dbdc005 100644
--- a/lib/printk_ringbuffer.c
+++ b/lib/printk_ringbuffer.c
@@ -196,8 +196,14 @@ void prb_commit(struct prb_handle *h)

if (changed) {
atomic_long_inc(&rb->wq_counter);
- if (wq_has_sleeper(rb->wq))
+ if (wq_has_sleeper(rb->wq)) {
+#ifdef CONFIG_IRQ_WORK
irq_work_queue(rb->wq_work);
+#else
+ if (!in_nmi())
+ wake_up_interruptible_all(rb->wq);
+#endif
+ }
}
}

--
2.20.1