From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752293AbdJDN2b (ORCPT ); Wed, 4 Oct 2017 09:28:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:58863 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752071AbdJDN2T (ORCPT ); Wed, 4 Oct 2017 09:28:19 -0400 Date: Wed, 4 Oct 2017 15:28:17 +0200 From: Petr Mladek To: pierre kuo Cc: Sergey Senozhatsky , Sergey Senozhatsky , rostedt@goodmis.org, linux-kernel@vger.kernel.org Subject: Re: [RFC V2] printk: add warning while drop partial text in msg Message-ID: <20171004132817.GK20084@pathway.suse.cz> References: <1501421870-12042-1-git-send-email-vichy.kuo@gmail.com> <20170801024303.GA469@jagdpanzerIV.localdomain> <20170817010541.GA20907@jagdpanzerIV.localdomain> <20170918093905.GB1514@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2017-09-27 21:59:52, pierre kuo wrote: > hi: > > printk_deferred("%s", local_string[2048]) makes no sense anyway, > > since we limit the message size to 1024 - HEADER chars in > > vprintk_emit() // see static char textbuf[LOG_LINE_MAX]. > > We use the example in this mail since we try to collect the message at > different places in our driver. > And batch to printk for saving individual output time and group > message together. I wonder what is the motivation for the extra buffering. Did you have troubles with direct printk() calls? For example, because of performance, mixed messages, deadlocks? Note that any buffering is potentially dangerous. You might miss the messages if the system dies before they are flushed. Also you might lose messages if the buffer is too small. > > I'm not quite following what were you trying to prove, sorry. > >does any function in the upstream kernel printk()-s buffers > >larger than LOG_LINE_MAX? which one? > > You are correct. > The upstream kernel printk()-s buffers are indeed smaller LOG_LINE_MAX > and not with multi "\n" like this example did. You might go around this by flushing the buffer line by line. Well, it might get quite complicated, see printk_safe_flush_buffer(). Another question is if the buffering makes sense then. Best Regards, Petr