Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2890829pxa; Tue, 25 Aug 2020 06:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/8zCCuqm3ZWU7PbfXFxwbtn2kQV6JHpgC3JU9XMASttoUsMB4TfDUCxGHUUb7tQBXXeBm X-Received: by 2002:aa7:cf8a:: with SMTP id z10mr9851961edx.323.1598361449989; Tue, 25 Aug 2020 06:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598361449; cv=none; d=google.com; s=arc-20160816; b=ekpVYvJMq4EVQTU8lWUJkM3R4zql5FwG1P+i64CaCrKp0EpA9YllIp48uCnbzOJC0/ IIoeBQeV9mAUJenLiehxTD4MKyXWVuEQGoSXV8lKjWSVeQGw4jTO+odeSh4ft/L2y8jy UoTA6VRk0CoZNCrJafQ1EmE0CSScJqqlok9zBDvkj1vGRn6J3YNRjBU2L1fJlT0aUjcN JTbkfAxEcc1rGIxGooSEGH4QAc2v0cj12GOsxhVn6RkEaeAOFVN2ORG9TvlfXTTT+6Qs wEbsCpjOIcOBcJfF7rUeXvkL4AKOL/mgfefXuqmpgWG+/DsN0aZ2vSN0+8X/zHfBfXp/ AcDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZZpRdt7V6+ZbpK1M0IF0N+7HcHJoa8touYXXXfNbVTo=; b=A+OQwgdvjQ19aSrScWHIiR0ZMTGgZL+F5SuLtBdf39T6/pt5BJVOXm13PbViWQp8H3 mQPuTEeTc5/LM2XCd7dxOOnPMMCVfGICHOtxAxIU93VJi9WiMDPPtko+JDAdUoeUmWji wbwg4J46n/4sILeNYmOTIztZPLmK41zCgeTA8UJJK8yQmOaslnJ0uakQy/j2McAD75vY Ln6tqZMqC5Uta8KXwzp9A+XvVD/wF17FdYh4xpX6/fXWlq3jrf4nOu9ljZuNjY48DZq2 GpVg9BKgZAGF9z8qOiAutiu0y/U/FNRbeWkeeFvNTY11bCvU1H1G48CG6WIbJwtVkkR4 VFLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si9499233ejc.453.2020.08.25.06.17.07; Tue, 25 Aug 2020 06:17:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbgHYNKo (ORCPT + 99 others); Tue, 25 Aug 2020 09:10:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:43026 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbgHYNKn (ORCPT ); Tue, 25 Aug 2020 09:10:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B3FD4B5DC; Tue, 25 Aug 2020 13:11:12 +0000 (UTC) Date: Tue, 25 Aug 2020 15:10:41 +0200 From: Petr Mladek To: David Laight Cc: John Ogness , Linus Torvalds , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , Thomas Gleixner , Sergey Senozhatsky , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH 1/5] printk: implement pr_cont_t Message-ID: <20200825131041.GV4353@alley> References: <20200819232632.13418-1-john.ogness@linutronix.de> <20200819232632.13418-2-john.ogness@linutronix.de> <20200820101625.GE4353@alley> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-08-20 12:33:23, David Laight wrote: > From: Petr Mladek > > Sent: 20 August 2020 11:16 > ... > > Now that I think about it. This is the biggest problem with any temporary buffer > > for pr_cont() lines. I am more and more convinced that we should just > > _keep the current behavior_. It is not ideal. But sometimes mixed > > messages are always better than lost ones. > > Maybe a marker to say 'more expected' might be useful. > OTOH lack of a trailing '\n' probably signifies that a > pr_cont() is likely to be next. The problem is the "probably". Lack of trailing '\n' might also mean that the author did not care. Note that newline is not strictly required at the moment. The next message is concatenated only when pr_cont() is used from the same process. I would personally hate printk when I debugged some hard-to-reproduce bug, finally succeeded, and some message was missing just because of a missing newline. > Unexpected pr_cont() could be output with a leading "... " > to help indicate the message is a continuation. Interesting idea. It might help to catch broken code. Well, I am still not sure that people would appreciate this printk() behavior. > > That said, some printk() API using local buffer would be still > > valuable for pieces of code where people really want to avoid > > mixed lines. But it should be optional and people should be > > aware of the risks. > > That could be very useful if it supported multi-line output. > Thing like the stack backtrace code could use it avoid > the mess that happens when multiple processes generate > tracebacks at the same time. Honestly, I am going to push against it. I agree that would be useful but it is an evil path. There has to be some limits. Backtraces are often printed in situation where the buffer could not get allocated dynamically. There always be a situation when a buffer will not be big enough. If we add this feature, people will want to use it also for other purposes that might need even bigger buffers and the size might be even harder to predict. And the temporary buffer is only part of the problem. The message also has to be stored into the lockless ringbuffer, show on consoles, passed to userspace, stored during panic by pstore. The printk() design already is very complicated. And multiple lines support would stretch it in yet another dimension. And it is going to be less important. We are going to always store the information about the printk caller. So that it will be much easier to grep related lines. Best Regards, Petr