From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751775AbdH2Ulh (ORCPT ); Tue, 29 Aug 2017 16:41:37 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:34295 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbdH2UlU (ORCPT ); Tue, 29 Aug 2017 16:41:20 -0400 To: torvalds@linux-foundation.org, sergey.senozhatsky.work@gmail.com Cc: pavel@ucw.cz, sergey.senozhatsky@gmail.com, pmladek@suse.com, rostedt@goodmis.org, jack@suse.cz, akpm@linux-foundation.org, jslaby@suse.com, andi@lisas.de, linux-kernel@vger.kernel.org Subject: Re: printk: what is going on with additional newlines? From: Tetsuo Handa References: <20170828122109.GA532@jagdpanzerIV.localdomain> <20170828124634.GD492@amd> <20170829134048.GA437@jagdpanzerIV.localdomain> In-Reply-To: Message-Id: <201708300541.IHE65621.SFMHVFOQOOtJFL@I-love.SAKURA.ne.jp> X-Mailer: Winbiff [Version 2.51 PL2] X-Accept-Language: ja,en,zh Date: Wed, 30 Aug 2017 05:41:20 +0900 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds wrote: > On Tue, Aug 29, 2017 at 10:00 AM, Linus Torvalds > wrote: > > > > I refuse to help those things. We mis-designed things > > Actually, let me rephrase that: > > It might actually be a good idea to help those things, by making > helper functions available that do the marshalling. > > So not calling "printk()" directly, but having a set of simple > "buffer_print()" functions where each user has its own buffer, and > then the "buffer_print()" functions will help people do nicely output > data. > > So if the issue is that people want to print (for example) hex dumps > one character at a time, but don't want to have each character show up > on a line of their own, I think we might well add a few functions to > help dop that. > > But they wouldn't be "printk". They would be the buffering functions > that then call printk when tyhey have buffered a line. > > That avoids the whole nasty issue with printk - printk wants to show > stuff early (because _maybe_ it's critical) and printk wants to make > log records with timestamps and loglevels. And printk has serious > locking issues that are really nasty and fundamental. > > A private buffer has none of those issues. Yes, I posted "[PATCH] printk: Add best-effort printk() buffering." at http://lkml.kernel.org/r/1493560477-3016-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp . > > Linus >