From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751966AbdH3Col (ORCPT ); Tue, 29 Aug 2017 22:44:41 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:34432 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbdH3Cok (ORCPT ); Tue, 29 Aug 2017 22:44:40 -0400 Date: Wed, 30 Aug 2017 11:47:03 +0900 From: Sergey Senozhatsky To: Joe Perches Cc: Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Pavel Machek , Sergey Senozhatsky , Petr Mladek , Jan Kara , Andrew Morton , Jiri Slaby , Andreas Mohr , Tetsuo Handa , Linux Kernel Mailing List Subject: Re: printk: what is going on with additional newlines? Message-ID: <20170830024703.GA17175@jagdpanzerIV.localdomain> References: <20170828124634.GD492@amd> <20170829134048.GA437@jagdpanzerIV.localdomain> <20170829195013.5048dc42@gandalf.local.home> <20170830010348.GB654@jagdpanzerIV.localdomain> <20170829211046.74644c8a@gandalf.local.home> <1504057959.2786.4.camel@perches.com> <20170830022528.GA17968@jagdpanzerIV.localdomain> <1504060296.2786.8.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1504060296.2786.8.camel@perches.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/29/17 19:31), Joe Perches wrote: [..] > > the idea is not to do printk() on that seq buffer at all, but to > > log_store(), atomically, seq buffer messages > > > > spin_lock(&logbuf_lock) > > while (offset < seq_buffer->len) { > > ... > > log_store(seq->buffer + offset); > > ... > > } > > spin_unlock(&logbuf_unlock) > > Why? > > What's wrong with a simple printk? > It'd still do a log_store. sure, it will. but in separate logbuf entries, and between two consequent printk calls on the same CPU a lot of stuff can happen: IRQs->printks, rescheduling->printks, etc. etc. (not to mention concurrent printks from other CPUs) so what people want to have is to have a way to make several printks appear next to each other in the logs (dmesg or serial log). Tetsuo wants this, for instance, for OOM reports and backtraces. SCIS/ATA people want it as well. -ss