From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751546AbdH2RM0 (ORCPT ); Tue, 29 Aug 2017 13:12:26 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35476 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751238AbdH2RMX (ORCPT ); Tue, 29 Aug 2017 13:12:23 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170815025625.1977-1-sergey.senozhatsky@gmail.com> <20170828090521.GA25025@amd> <20170828102830.GA403@jagdpanzerIV.localdomain> <20170828122109.GA532@jagdpanzerIV.localdomain> <20170828124634.GD492@amd> <20170829134048.GA437@jagdpanzerIV.localdomain> From: Linus Torvalds Date: Tue, 29 Aug 2017 10:12:22 -0700 X-Google-Sender-Auth: oOfU8HLZdYSeK_SDpGIMSMn2yZA Message-ID: Subject: Re: printk: what is going on with additional newlines? To: Sergey Senozhatsky Cc: Pavel Machek , Sergey Senozhatsky , Petr Mladek , Steven Rostedt , Jan Kara , Andrew Morton , Jiri Slaby , Andreas Mohr , Tetsuo Handa , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Linus