From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966154AbcKKA0g (ORCPT ); Thu, 10 Nov 2016 19:26:36 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34417 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965311AbcKKA0f (ORCPT ); Thu, 10 Nov 2016 19:26:35 -0500 Date: Fri, 11 Nov 2016 09:26:35 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Linus Torvalds , Joe Perches , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Jason Wessel , Jaroslav Kysela , Takashi Iwai , Chris Mason , Josef Bacik , David Sterba , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/4] printk/NMI: Handle continuous lines and missing newline Message-ID: <20161111002635.GA4682@swordfish> References: <1478695291-12169-1-git-send-email-pmladek@suse.com> <1478695291-12169-2-git-send-email-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478695291-12169-2-git-send-email-pmladek@suse.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (11/09/16 13:41), Petr Mladek wrote: > The commit 4bcc595ccd80decb4245 ("printk: reinstate KERN_CONT for printing > continuation lines") added back KERN_CONT message header. As a result > it might appear in the middle of the line when the parts are squashed > via the temporary NMI buffer. > > A reasonable solution seems to be to split the text in the NNI temporary > not only by newlines but also by the message headers. > > Another solution would be to filter out KERN_CONT when writing to > the temporary buffer. But this would complicate the lockless handling. > Also it would not solve problems with a missing newline that was there > even before the KERN_CONT stuff. > > This patch moves the temporary buffer handling into separate function. > I played with it and it seems that using the char pointers make the > code easier to read. > > Also it prints the final newline as a continuous line. > > Finally, it moves handling of the s->len overflow into the paranoid check. > And allows to recover from the disaster. > > Signed-off-by: Petr Mladek Reviewed-by: Sergey Senozhatsky without the patch I see prefixes (^Ac) in WARN_ON() output from NMI: [ 0.895911] ------------[ cut here ]------------ [ 0.895966] WARNING: CPU: 0 PID: 1 at kernel/[..] [ 0.896026] Modules linked in:^Ac ^^^^ [..] [ 0.896705] RSP: 0000:ffffc900000176c0 EFLAGS: 00000296^Ac ^^^^^ -ss