From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751402AbdK0JD2 (ORCPT ); Mon, 27 Nov 2017 04:03:28 -0500 Received: from smtprelay0051.hostedemail.com ([216.40.44.51]:55236 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751224AbdK0JD0 (ORCPT ); Mon, 27 Nov 2017 04:03:26 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2693:2828:2895:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6119:6691:7903:8660:10004:10400:10848:11232:11658:11914:12043:12262:12296:12438:12555:12679:12740:12760:12895:13069:13148:13161:13229:13230:13255:13311:13357:13439:14096:14097:14181:14659:14721:21080:21212:21365:21451:21627:30012:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: blood70_3a931c7c13350 X-Filterd-Recvd-Size: 3236 Message-ID: <1511773401.32426.21.camel@perches.com> Subject: Re: [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line From: Joe Perches To: Julia Lawall Cc: Logan Gunthorpe , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Andy Whitcroft Date: Mon, 27 Nov 2017 01:03:21 -0800 In-Reply-To: References: <20171126054037.9743-1-logang@deltatee.com> <85bdbab8-8b7e-91a9-7199-a0e39041aef1@deltatee.com> <3fc88c02-b9b6-80a3-0c41-63e0806d34aa@deltatee.com> <1511746526.20482.38.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 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 On Mon, 2017-11-27 at 07:42 +0100, Julia Lawall wrote: > On Mon, 27 Nov 2017, Julia Lawall wrote: > > On Sun, 26 Nov 2017, Joe Perches wrote: > > > On Sun, 2017-11-26 at 19:17 +0100, Julia Lawall wrote: > > > > I just assume that a printk that has no KERN_ is adding a > > > > newline, which is my understanding of Joe's comment. > > > > > > More precisely: > > > > > > Any printk without an initial KERN_CONT prepends a newline > > > if the last printk content char emitted that is not part > > > of a printk timestamp/header was not a newline. > > > > Ah, I misunderstood. I thought it was any printk that has no KERN > > indicator at all. That I can fix. > > Although I guess that in that case the whole exercise is pointless? > Because every print will at runtime be followed by another print, which > will add either the newline or a continuation. Kinda yes and no. A printk without a newline termination is not emitted as output until the next printk call. This can cause issues on quiescent systems as the printk is not emitted for potentially a very long time. Also, any thread interleaving can still cause misformatted output. and: All the historical printks without KERN_CONT worked well until the commit that broke them by requiring KERN_CONT. But now these consecutive calls to printk which used to be emitted on on a single line are printed on multiple lines. The title of the commit is wrong as KERN_CONT was not necessary before this change. --- commit 4bcc595ccd80decb4245096e3d1258989c50ed41 Author: Linus Torvalds Date: Sat Oct 8 20:32:40 2016 -0700 printk: reinstate KERN_CONT for printing continuation lines --- So IMO it's _somewhat_ useful to try to update the printks without either KERN_CONT or with a KERN_ but without a newline. As the above commit is about a year old, most of the cases in the code that are actually likely have been fixed by now.