* [PATCH] printk: Remove no longer used LOG_PREFIX.
@ 2019-02-22 9:59 Tetsuo Handa
2019-03-01 10:31 ` Tetsuo Handa
2019-03-04 2:22 ` Sergey Senozhatsky
0 siblings, 2 replies; 6+ messages in thread
From: Tetsuo Handa @ 2019-02-22 9:59 UTC (permalink / raw)
To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, Linus Torvalds
Cc: linux-kernel, Tetsuo Handa
When commit 5becfb1df5ac8e49 ("kmsg: merge continuation records while
printing") introduced LOG_PREFIX, we used KERN_DEFAULT etc. as a flag
for setting LOG_PREFIX in order to tell whether to call cont_add()
(i.e. whether to append the message to "struct cont").
But since commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
printing continuation lines") inverted the behavior (i.e. don't append
the message to "struct cont" unless KERN_CONT is specified) and commit
5aa068ea4082b39e ("printk: remove games with previous record flags")
removed the last LOG_PREFIX check, setting LOG_PREFIX via KERN_DEFAULT
etc. is no longer meaningful.
Therefore, we can remove LOG_PREFIX and make KERN_DEFAULT empty string.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
include/linux/kern_levels.h | 2 +-
include/linux/printk.h | 1 -
kernel/printk/printk.c | 6 +-----
3 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/include/linux/kern_levels.h b/include/linux/kern_levels.h
index d237fe8..bf2389c 100644
--- a/include/linux/kern_levels.h
+++ b/include/linux/kern_levels.h
@@ -14,7 +14,7 @@
#define KERN_INFO KERN_SOH "6" /* informational */
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
-#define KERN_DEFAULT KERN_SOH "d" /* the default kernel loglevel */
+#define KERN_DEFAULT "" /* the default kernel loglevel */
/*
* Annotation for a "continued" line of log printout (only done after a
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 77740a5..9fe6c9e 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -18,7 +18,6 @@ static inline int printk_get_level(const char *buffer)
if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
switch (buffer[1]) {
case '0' ... '7':
- case 'd': /* KERN_DEFAULT */
case 'c': /* KERN_CONT */
return buffer[1];
}
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index d3d1703..3e4a735 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -344,7 +344,6 @@ enum con_msg_format_flags {
enum log_flags {
LOG_NEWLINE = 2, /* text ended with a newline */
- LOG_PREFIX = 4, /* text started with a prefix */
LOG_CONT = 8, /* text is a fragment of a continuation line */
};
@@ -1867,9 +1866,6 @@ int vprintk_store(int facility, int level,
case '0' ... '7':
if (level == LOGLEVEL_DEFAULT)
level = kern_level - '0';
- /* fallthrough */
- case 'd': /* KERN_DEFAULT */
- lflags |= LOG_PREFIX;
break;
case 'c': /* KERN_CONT */
lflags |= LOG_CONT;
@@ -1884,7 +1880,7 @@ int vprintk_store(int facility, int level,
level = default_message_loglevel;
if (dict)
- lflags |= LOG_PREFIX|LOG_NEWLINE;
+ lflags |= LOG_NEWLINE;
return log_output(facility, level, lflags,
dict, dictlen, text, text_len);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: Remove no longer used LOG_PREFIX.
2019-02-22 9:59 [PATCH] printk: Remove no longer used LOG_PREFIX Tetsuo Handa
@ 2019-03-01 10:31 ` Tetsuo Handa
2019-03-01 12:48 ` Petr Mladek
2019-03-04 2:22 ` Sergey Senozhatsky
1 sibling, 1 reply; 6+ messages in thread
From: Tetsuo Handa @ 2019-03-01 10:31 UTC (permalink / raw)
To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, Linus Torvalds
Cc: linux-kernel
Can this patch go to Linux 5.1?
On 2019/02/22 18:59, Tetsuo Handa wrote:
> When commit 5becfb1df5ac8e49 ("kmsg: merge continuation records while
> printing") introduced LOG_PREFIX, we used KERN_DEFAULT etc. as a flag
> for setting LOG_PREFIX in order to tell whether to call cont_add()
> (i.e. whether to append the message to "struct cont").
>
> But since commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
> printing continuation lines") inverted the behavior (i.e. don't append
> the message to "struct cont" unless KERN_CONT is specified) and commit
> 5aa068ea4082b39e ("printk: remove games with previous record flags")
> removed the last LOG_PREFIX check, setting LOG_PREFIX via KERN_DEFAULT
> etc. is no longer meaningful.
>
> Therefore, we can remove LOG_PREFIX and make KERN_DEFAULT empty string.
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> include/linux/kern_levels.h | 2 +-
> include/linux/printk.h | 1 -
> kernel/printk/printk.c | 6 +-----
> 3 files changed, 2 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: Remove no longer used LOG_PREFIX.
2019-03-01 10:31 ` Tetsuo Handa
@ 2019-03-01 12:48 ` Petr Mladek
2019-03-02 0:54 ` Joe Perches
0 siblings, 1 reply; 6+ messages in thread
From: Petr Mladek @ 2019-03-01 12:48 UTC (permalink / raw)
To: Tetsuo Handa
Cc: Sergey Senozhatsky, Steven Rostedt, Linus Torvalds, linux-kernel
On Fri 2019-03-01 19:31:59, Tetsuo Handa wrote:
> Can this patch go to Linux 5.1?
I am going to look at it the following week. I do not think that
it is necessary to hurry a clean up of old stuff up into 5.1.
I believe that it is correct. But it is not a typo fix. For example,
I want to double check what was the history of KERN_DEFAULT defined
as "d". It existed since ages...
Best Regards,
Petr
> On 2019/02/22 18:59, Tetsuo Handa wrote:
> > When commit 5becfb1df5ac8e49 ("kmsg: merge continuation records while
> > printing") introduced LOG_PREFIX, we used KERN_DEFAULT etc. as a flag
> > for setting LOG_PREFIX in order to tell whether to call cont_add()
> > (i.e. whether to append the message to "struct cont").
> >
> > But since commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
> > printing continuation lines") inverted the behavior (i.e. don't append
> > the message to "struct cont" unless KERN_CONT is specified) and commit
> > 5aa068ea4082b39e ("printk: remove games with previous record flags")
> > removed the last LOG_PREFIX check, setting LOG_PREFIX via KERN_DEFAULT
> > etc. is no longer meaningful.
> >
> > Therefore, we can remove LOG_PREFIX and make KERN_DEFAULT empty string.
> >
> > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > ---
> > include/linux/kern_levels.h | 2 +-
> > include/linux/printk.h | 1 -
> > kernel/printk/printk.c | 6 +-----
> > 3 files changed, 2 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: Remove no longer used LOG_PREFIX.
2019-03-01 12:48 ` Petr Mladek
@ 2019-03-02 0:54 ` Joe Perches
0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2019-03-02 0:54 UTC (permalink / raw)
To: Petr Mladek, Tetsuo Handa
Cc: Sergey Senozhatsky, Steven Rostedt, Linus Torvalds, linux-kernel
On Fri, 2019-03-01 at 13:48 +0100, Petr Mladek wrote:
> I want to double check what was the history of KERN_DEFAULT defined
> as "d". It existed since ages...
There less than 100 uses of KERN_DEFAULT.
Relatively speaking, KERN_DEFAULT hasn't existed all
that long actually.
commit e28d713704117bca0820c732210df6075b09f13b
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Tue Jun 16 11:02:28 2009 -0700
printk: Add KERN_DEFAULT printk log-level
This adds a KERN_DEFAULT loglevel marker, for when you cannot decide
which loglevel you want, and just want to keep an existing printk
with the default loglevel.
The difference between having KERN_DEFAULT and having no log-level
marker at all is two-fold:
- having the log-level marker will now force a new-line if the
previous printout had not added one (perhaps because it forgot,
but perhaps because it expected a continuation)
- having a log-level marker is required if you are printing out a
message that otherwise itself could perhaps otherwise be mistaken
for a log-level.
Signed-of-by: Linus Torvalds <torvalds@linux-foundation.org>
Ever since Linus changed the default logging mechanism
for printks and KERN_CONT uses in
commit 4bcc595ccd80decb4245096e3d1258989c50ed41
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sat Oct 8 20:32:40 2016 -0700
printk: reinstate KERN_CONT for printing continuation lines
the listed reasons in commit e28d713704117bca0820c732210df6075b09f13b
for the use of KERN_DEFAULT are no longer necessary.
I still think it'd be better to remove KERN_DEFAULT altogether.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: Remove no longer used LOG_PREFIX.
2019-02-22 9:59 [PATCH] printk: Remove no longer used LOG_PREFIX Tetsuo Handa
2019-03-01 10:31 ` Tetsuo Handa
@ 2019-03-04 2:22 ` Sergey Senozhatsky
2019-03-04 12:54 ` Petr Mladek
1 sibling, 1 reply; 6+ messages in thread
From: Sergey Senozhatsky @ 2019-03-04 2:22 UTC (permalink / raw)
To: Tetsuo Handa
Cc: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, Linus Torvalds,
linux-kernel
On (02/22/19 18:59), Tetsuo Handa wrote:
> When commit 5becfb1df5ac8e49 ("kmsg: merge continuation records while
> printing") introduced LOG_PREFIX, we used KERN_DEFAULT etc. as a flag
> for setting LOG_PREFIX in order to tell whether to call cont_add()
> (i.e. whether to append the message to "struct cont").
>
> But since commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
> printing continuation lines") inverted the behavior (i.e. don't append
> the message to "struct cont" unless KERN_CONT is specified) and commit
> 5aa068ea4082b39e ("printk: remove games with previous record flags")
> removed the last LOG_PREFIX check, setting LOG_PREFIX via KERN_DEFAULT
> etc. is no longer meaningful.
>
> Therefore, we can remove LOG_PREFIX and make KERN_DEFAULT empty string.
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Looks good to me. Well, at least I don't see any problems with the patch.
We can do a tree-wide KERN_DEFAULT removal later.
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
-ss
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] printk: Remove no longer used LOG_PREFIX.
2019-03-04 2:22 ` Sergey Senozhatsky
@ 2019-03-04 12:54 ` Petr Mladek
0 siblings, 0 replies; 6+ messages in thread
From: Petr Mladek @ 2019-03-04 12:54 UTC (permalink / raw)
To: Sergey Senozhatsky
Cc: Tetsuo Handa, Sergey Senozhatsky, Steven Rostedt, Linus Torvalds,
linux-kernel
On Mon 2019-03-04 11:22:29, Sergey Senozhatsky wrote:
> On (02/22/19 18:59), Tetsuo Handa wrote:
> > When commit 5becfb1df5ac8e49 ("kmsg: merge continuation records while
> > printing") introduced LOG_PREFIX, we used KERN_DEFAULT etc. as a flag
> > for setting LOG_PREFIX in order to tell whether to call cont_add()
> > (i.e. whether to append the message to "struct cont").
> >
> > But since commit 4bcc595ccd80decb ("printk: reinstate KERN_CONT for
> > printing continuation lines") inverted the behavior (i.e. don't append
> > the message to "struct cont" unless KERN_CONT is specified) and commit
> > 5aa068ea4082b39e ("printk: remove games with previous record flags")
> > removed the last LOG_PREFIX check, setting LOG_PREFIX via KERN_DEFAULT
> > etc. is no longer meaningful.
> >
> > Therefore, we can remove LOG_PREFIX and make KERN_DEFAULT empty string.
> >
> > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>
> Looks good to me. Well, at least I don't see any problems with the patch.
> We can do a tree-wide KERN_DEFAULT removal later.
Yup.
> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
With a fresh head after the weekend, the patch looks fine and
pretty safe to me.
I have pushed it into for-5.1 branch.
Best Regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-04 12:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 9:59 [PATCH] printk: Remove no longer used LOG_PREFIX Tetsuo Handa
2019-03-01 10:31 ` Tetsuo Handa
2019-03-01 12:48 ` Petr Mladek
2019-03-02 0:54 ` Joe Perches
2019-03-04 2:22 ` Sergey Senozhatsky
2019-03-04 12:54 ` Petr Mladek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).