Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754560AbbBTREY (ORCPT ); Fri, 20 Feb 2015 12:04:24 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.226]:53863 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754041AbbBTREW (ORCPT ); Fri, 20 Feb 2015 12:04:22 -0500 Date: Fri, 20 Feb 2015 12:05:06 -0500 From: Steven Rostedt To: Linus Torvalds Cc: Masami Hiramatsu , Alexander van Heukelum , tglx@linutronix.de, luto@amacapital.net, fruggeri@arista.com, a.ryabinin@samsung.com, akpm@linux-foundation.org, hpa@zytor.com, Adrien Schildknecht , linux-kernel@vger.kernel.org, bp@alien8.de, adech.fo@gmail.com, x86@kernel.org, mingo@redhat.com Subject: Re: [PATCH v2] x86: fix output of show_stack_log_lvl() Message-ID: <20150220120506.1c3812a8@grimm.local.home> In-Reply-To: References: <1424385796-28910-1-git-send-email-adrien+dev@schischi.me> <1424399661-20327-1-git-send-email-adrien+dev@schischi.me> <20150219234548.2e4412cb@grimm.local.home> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2027 Lines: 52 On Thu, 19 Feb 2015 21:13:29 -0800 Linus Torvalds wrote: > On Feb 19, 2015 8:45 PM, "Steven Rostedt" wrote: > > > > This looks like a bug in printk(). Why doesn't pr_cont() continue? It > > shouldn't care if there's a newline or not. pr_cont() is supposed to > > continue whatever the last printk log level was. > > pr_cont() should continue the current line. If there was a behind, and it's > a new line, then pr_cont() is meaningless. Ah, you are right. I got confused by the lack of comments around pr_cont. Now KERN_CONT is nicely commented, but unfortunately that comment exists in a different file. How about adding the below patch so people like me wont get confused again. -- Steve printk: Comment pr_cont() stating it is only to continue a line KERN_CONT is nicely commented in kern_levels.h, but pr_cont() is now used more often, and it lacks the comment stating what it is used for. It can be confused as continuing the log level, but that is not its purpose. It's purpose is to continue a line that had no newline enclosed. This should be documented by pr_cont() as well. Signed-off-by: Steven Rostedt --- diff --git a/include/linux/printk.h b/include/linux/printk.h index 4d5bf57..937d2f3 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -255,6 +255,11 @@ extern asmlinkage void dump_stack(void) __cold; printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) #define pr_info(fmt, ...) \ printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) +/* + * Like KERN_CONT, pr_cont() should only be used when continuing + * a line with no newline ('\n') enclosed. Otherwise it defaults + * back to KERN_DEFAULT. + */ #define pr_cont(fmt, ...) \ printk(KERN_CONT fmt, ##__VA_ARGS__) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/