Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1741490 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2017-09-28 14:30 +0200 |
| Last post | 2017-09-28 19:10 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/3] early_printk: Add force_early_printk kernel parameter Peter Zijlstra <peterz@infradead.org> - 2017-09-28 14:30 +0200
Re: [PATCH 2/3] early_printk: Add force_early_printk kernel parameter Randy Dunlap <rdunlap@infradead.org> - 2017-09-28 17:50 +0200
Re: [PATCH 2/3] early_printk: Add force_early_printk kernel parameter Peter Zijlstra <peterz@infradead.org> - 2017-09-28 18:10 +0200
Re: [PATCH 2/3] early_printk: Add force_early_printk kernel parameter Randy Dunlap <rdunlap@infradead.org> - 2017-09-28 19:10 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-09-28 14:30 +0200 |
| Subject | [PATCH 2/3] early_printk: Add force_early_printk kernel parameter |
| Message-ID | <uuG70-vR-29@gated-at.bofh.it> |
Add add the 'force_early_printk' kernel parameter to override printk()
and force it into early_printk(). This bypasses all the cruft and fail
from printk() and makes things work again.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/printk/printk.c | 68 +++++++++++++++++++++++++++++++++----------------
1 file changed, 47 insertions(+), 21 deletions(-)
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -365,6 +365,42 @@ __packed __aligned(4)
#endif
;
+#ifdef CONFIG_EARLY_PRINTK
+struct console *early_console;
+
+static bool __read_mostly force_early_printk;
+
+static int __init force_early_printk_setup(char *str)
+{
+ force_early_printk = true;
+ return 0;
+}
+early_param("force_early_printk", force_early_printk_setup);
+
+static int early_vprintk(const char *fmt, va_list args)
+{
+ char buf[512];
+ int n;
+
+ n = vscnprintf(buf, sizeof(buf), fmt, args);
+ early_console->write(early_console, buf, n);
+
+ return n;
+}
+
+asmlinkage __visible void early_printk(const char *fmt, ...)
+{
+ va_list ap;
+
+ if (!early_console)
+ return;
+
+ va_start(ap, fmt);
+ early_vprintk(fmt, ap);
+ va_end(ap);
+}
+#endif
+
/*
* The logbuf_lock protects kmsg buffer, indices, counters. This can be taken
* within the scheduler's rq lock. It must be released before calling
@@ -1816,6 +1852,11 @@ asmlinkage int vprintk_emit(int facility
return vkdb_printf(KDB_MSGSRC_PRINTK, fmt, args);
#endif
+#ifdef CONFIG_EARLY_PRINTK
+ if (force_early_printk && early_console)
+ return early_vprintk(fmt, args);
+#endif
+
if (level == LOGLEVEL_SCHED) {
level = LOGLEVEL_DEFAULT;
in_sched = true;
@@ -1939,7 +1980,12 @@ asmlinkage __visible int printk(const ch
int r;
va_start(args, fmt);
- r = vprintk_func(fmt, args);
+#ifdef CONFIG_EARLY_PRINTK
+ if (force_early_printk && early_console)
+ r = vprintk_default(fmt, args);
+ else
+#endif
+ r = vprintk_func(fmt, args);
va_end(args);
return r;
@@ -1975,26 +2021,6 @@ static size_t msg_print_text(const struc
static bool suppress_message_printing(int level) { return false; }
#endif /* CONFIG_PRINTK */
-#ifdef CONFIG_EARLY_PRINTK
-struct console *early_console;
-
-asmlinkage __visible void early_printk(const char *fmt, ...)
-{
- va_list ap;
- char buf[512];
- int n;
-
- if (!early_console)
- return;
-
- va_start(ap, fmt);
- n = vscnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
-
- early_console->write(early_console, buf, n);
-}
-#endif
-
static int __add_preferred_console(char *name, int idx, char *options,
char *brl_options)
{
[toc] | [next] | [standalone]
| From | Randy Dunlap <rdunlap@infradead.org> |
|---|---|
| Date | 2017-09-28 17:50 +0200 |
| Message-ID | <uuJez-2kP-33@gated-at.bofh.it> |
| In reply to | #1741490 |
On 09/28/17 05:18, Peter Zijlstra wrote: <attachment not shown> Hi Peter, Please add that kernel parameter to Documentation/admin-guide/kernel-parameters.txt. thanks, -- ~Randy
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-09-28 18:10 +0200 |
| Message-ID | <uuJxT-2Gx-3@gated-at.bofh.it> |
| In reply to | #1741657 |
On Thu, Sep 28, 2017 at 08:41:37AM -0700, Randy Dunlap wrote: > Please add that kernel parameter to Documentation/admin-guide/kernel-parameters.txt. Something like so? --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1165,6 +1165,11 @@ parameter will force ia64_sal_cache_flush to call ia64_pal_cache_flush instead of SAL_CACHE_FLUSH. + force_early_printk + Forcefully uses early_console (as per earlyprintk=) + usage for regular printk, bypassing everything, + including the syslog (dmesg will be empty). + forcepae [X86-32] Forcefully enable Physical Address Extension (PAE). Many Pentium M systems disable PAE but may have a
[toc] | [prev] | [next] | [standalone]
| From | Randy Dunlap <rdunlap@infradead.org> |
|---|---|
| Date | 2017-09-28 19:10 +0200 |
| Message-ID | <uuKtX-3hQ-3@gated-at.bofh.it> |
| In reply to | #1741673 |
On 09/28/17 09:07, Peter Zijlstra wrote: > On Thu, Sep 28, 2017 at 08:41:37AM -0700, Randy Dunlap wrote: > >> Please add that kernel parameter to Documentation/admin-guide/kernel-parameters.txt. > > Something like so? Yes, thanks. Ack. > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1165,6 +1165,11 @@ > parameter will force ia64_sal_cache_flush to call > ia64_pal_cache_flush instead of SAL_CACHE_FLUSH. > > + force_early_printk > + Forcefully uses early_console (as per earlyprintk=) > + usage for regular printk, bypassing everything, > + including the syslog (dmesg will be empty). > + > forcepae [X86-32] > Forcefully enable Physical Address Extension (PAE). > Many Pentium M systems disable PAE but may have a > -- ~Randy
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web