[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1333673854.2171.3.camel@hebo>
Date: Fri, 06 Apr 2012 08:57:34 +0800
From: "he, bo" <bo.he@...el.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: akpm@...ux-foundation.org, mingo@...e.hu, rusty@...tcorp.com.au,
a.p.zijlstra@...llo.nl, linux-kernel@...r.kernel.org,
william.douglas@...el.com, yanmin_zhang@...ux.intel.com
Subject: Re: [PATCH_V2 1/2] fix the bug that printk can't support
printk(KERN_LEVEL)
On Mon, 2012-03-26 at 09:36 +0800, he, bo wrote:
> From: he bo <bo.he@...el.com>
>
> Usually, there is a special scenario that developer wants to
> call printk to just set up a log level (might be transferred
> here as a parameter from upper level), then, later calling
> of printk prints out real string with the same log level
> continuously.
>
> Current function vprintk has an issue to support this capability.
> When the whole string in one calling to printk is just a log level,
> it ignores it.
>
> Signed-off-by: he, bo <bo.he@...el.com>
> Reviewed-by: Zhang, Yanmin <yanmin.zhang@...el.com>
> ---
> kernel/printk.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
Ingo,
What's your opinion about the 2 patches? The 1st patch fixes an issue
and 2nd patch enhances dump_stack with log level.
https://lkml.org/lkml/2012/3/25/152
https://lkml.org/lkml/2012/3/25/153
Thanks,
Bo
>
> diff --git a/kernel/printk.c b/kernel/printk.c
> index b663c2c..473afdb 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -909,7 +909,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
> * Copy the output into log_buf. If the caller didn't provide
> * the appropriate log prefix, we insert them here
> */
> - for (; *p; p++) {
> + for (; plen || *p; p++) {
> if (new_text_line) {
> new_text_line = 0;
>
> @@ -920,6 +920,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
> for (i = 0; i < plen; i++)
> emit_log_char(printk_buf[i]);
> printed_len += plen;
> + plen = 0;
> } else {
> /* Add log prefix */
> emit_log_char('<');
> @@ -946,10 +947,10 @@ asmlinkage int vprintk(const char *fmt, va_list args)
> printed_len += tlen;
> }
>
> - if (!*p)
> - break;
> }
>
> + if (!*p)
> + break;
> emit_log_char(*p);
> if (*p == '\n')
> new_text_line = 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists