Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755098AbbBTRkY (ORCPT ); Fri, 20 Feb 2015 12:40:24 -0500 Received: from smtprelay0107.hostedemail.com ([216.40.44.107]:51197 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754565AbbBTRkX (ORCPT ); Fri, 20 Feb 2015 12:40:23 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2553:2559:2562:2828:2898:3138:3139:3140:3141:3142:3315:3355:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6119:6261:6742:7875:7903:9108:10004:10400:10450:10455:10848:10967:11026:11232:11658:11914:12043:12114:12295:12296:12517:12519:12555:12740:13095:13161:13229:19904:19999:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: trade84_2a1c9605a95e X-Filterd-Recvd-Size: 3976 Message-ID: <1424454016.18211.8.camel@perches.com> Subject: Re: [PATCH v2] x86: fix output of show_stack_log_lvl() From: Joe Perches To: Steven Rostedt Cc: Linus Torvalds , 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 Date: Fri, 20 Feb 2015 09:40:16 -0800 In-Reply-To: <20150220120506.1c3812a8@grimm.local.home> 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> <20150220120506.1c3812a8@grimm.local.home> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.7-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2756 Lines: 75 On Fri, 2015-02-20 at 12:05 -0500, Steven Rostedt wrote: > 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. > + */ The first sentence is basically true though the "enclosed" use is at best awkward. Maybe "closing" or "terminating" is better. There are still a few dozen uses of this pattern: pr_info("Some message line 1\nNext line: "); for (...) pr_cont(" part %d", i); pr_cont('\n"); The second sentence is not true. KERN_DEFAULT is an odd-ball variable level that likely could be removed altogether. It's like a naked printk, but if the last emitted char is not a newline, one is prepended. How about something like: Use pr_cont() when continuing a message that does not end in a '\n'. Do not use pr_cont when continuing a dynamic_debug type message. -- 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/