Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7433948ybh; Thu, 8 Aug 2019 15:57:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOIOxx8mHmssB2dE4s9lPSSTGaisXHa/OfLjWJiI75Fl1V0OnUisbMLYDzFNYI5pyqxodu X-Received: by 2002:a17:902:b604:: with SMTP id b4mr1348333pls.94.1565305045763; Thu, 08 Aug 2019 15:57:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565305045; cv=none; d=google.com; s=arc-20160816; b=Bmy2LUX4mCYCe9o7KT8gfbvjvXLBElaHXMNxM/EfytyPkiLcnWWcYGfao8yrdr27ry gWNb9+dNFj9eaOhsT8a4dYqtmi6VdsNz6444GfQbEKY6EcRsivsprH7aBJ+Fsbbpg75A 9oJu6nHzsQqMFvNfoHBnmNIbiuCME5TZCQzlSlXOqx/kM1h4qCKA7luRkwglw9tu6ILA WrB9j4pg7SgGfK1Y+4Cluvpo7nSBfcaIOVzlYWhibdL9cm2ImsFAciKujGzZrllEqeum l4eFUDKuKFh2v0NZzprGX9Yo4e4GzxXyKJ6L8YB3hPxyV+G9aBrVetzD8+2FvAratzK8 ablQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=NvBfsA/0dCJ22MfqVjwmcW33uIK5ULTosKz2BBxZYTk=; b=GMYnAUkTfs2hC5C/k3YM5Qf+M2bQ8cy1N/5VMHl+9kyEsN0AjDokhmCzKlNXL0UGMT bOdF8VVOkXRgBxEBjmCz2PpBVED2oDiP+5UJa0UvB24Kqb/rSwUbt+7LLRVVzE50i3za hveo2yD6CLaAxmypbUuRjWuDUxWh/wvltoduW2/JX9KTA64oblFKcc8dkUHB7G+9mCxG 90QZaG9DHH7pwNYEVqFu/81ftxFQxdcgM6rQH9ImMOtRY7J1ir1e5syALetOFtgfdO3P OylpTH4Xh6mDdsaD2u6/39ty86aVD+r8rJuSPePSajQ9balvg7dWVPyfJ2AOlbpwvNx2 gdCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y62si26387047pgy.348.2019.08.08.15.57.09; Thu, 08 Aug 2019 15:57:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390439AbfHHW4b (ORCPT + 99 others); Thu, 8 Aug 2019 18:56:31 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:54337 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390022AbfHHW4b (ORCPT ); Thu, 8 Aug 2019 18:56:31 -0400 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hvrK5-0000po-J4; Fri, 09 Aug 2019 00:55:53 +0200 From: John Ogness To: Linus Torvalds Cc: Linux List Kernel Mailing , Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Sergey Senozhatsky , Brendan Higgins Subject: Re: [RFC PATCH v4 9/9] printk: use a new ringbuffer implementation References: <20190807222634.1723-1-john.ogness@linutronix.de> <20190807222634.1723-10-john.ogness@linutronix.de> Date: Fri, 09 Aug 2019 00:55:51 +0200 In-Reply-To: (Linus Torvalds's message of "Thu, 8 Aug 2019 12:07:28 -0700") Message-ID: <874l2rclmw.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-08-08, Linus Torvalds wrote: >> 2. For the CONFIG_PPC_POWERNV powerpc platform, kernel log buffer >> registration is no longer available because there is no longer >> a single contigous block of memory to represent all of the >> ringbuffer. > > So this is tangential, but I've actually been wishing for a special > "raw dump" format that has absolutely *no* structure to it at all, and > is as a result not necessarily strictly reliable, but is a lot more > robust. > > The background for that is that we have a class of bugs that are > really hard to debug "in the wild", because people don't have access > to serial consoles or any kind of special hardware at all (ie forget > things like nvram etc), and when the machine locks up you're happy to > just have a reset button (but more likely you have to turn power off > and on). > > End result: a DRAM buffer can work, but is not "reliable". > Particularly if you turn power on and off, data retention of DRAM is > iffy. But it's possible, at least in theory. > > So I have a patch that implements a "stupid ring buffer" for thisa > case, with absolutely zero data structures (because in the presense of > DRAM corruption, all you can get is "hopefully only slightly garbled > ASCII". You can read the current printk ringbuffer this way also because the ASCII strings are sorted and separated by struct binary data. The binary parts of the structs can even prove useful in this case to act as record separators. dump_area(log_buf, log_buf_len); Note: To test this, I modified your dump_area() to call trace_printk() instead of printk(). The _raw_ contents of the ringbuffer I am proposing (dataring.data) is nearly identical to that of the current ringbuffer. Its raw data is also sorted and separated by non-ascii data. So using: dump_area(prb->dr.data, 1 << prb->dr.size_bits); produces essentially the same results. Both ringbuffers are structuring the data similar to yours, but they have the advantage of writer synchronization. What is missing is a way for the raw data buffers to be fixed to a specified address so that they can be recovered after a reset. I will look into such a feature for my next version. On a side note, I'm not sure sure if we want kernel code to do the ASCII dump of the raw buffer. A userspace application grabbing from /dev/mem might be more desirable. I can imagine that all kinds of "intelligence" could be added to such an application to try to recover/sanitize as much meta-data as possible (such as timestamps, CPU ID, task ID, etc). Maybe we should add CRC or ECC to struct prink_log. :-) John Ogness