From patchwork Fri Feb 7 12:25:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WeiXiong Liao X-Patchwork-Id: 1234903 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=allwinnertech.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=YnAUffiZ; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48DZKV1vRHz9sSQ for ; Fri, 7 Feb 2020 23:26:22 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=o5OFaHnDoEQYyntsVgMDLYSgriKx3vVOlimKczpH2ek=; b=YnA UffiZ2fIKHoMiK8I7FkNAIcwJnVHb8uHm6weP9fEpc8+GyL6FJTdWE2CovBzXUhKo/KYYXrHyIMCX 95PCyZ4o9MORTj16PYQju33Rj7JIQltvhbqXgmf+ovvDjS/UQeOVwKrLMYrbfo23NJqZv1oJTXURX fbt2wVmxwz8mrB9ZCh6TF44ZlsHR8iNdLe7bxYvD1yCq7/XhHMyy7TQ8VvNbHDfoSgz21ehJzL+/2 iqq65ItjaRvH59i5Zy8MJcpmBGKJUyElIFqztoN6wUkZ1pak7rKc6xm3XrXrIkHmixgZfFZW+RQ9L 1bQs3ZjxFgKSOYpowQQnaCMHHw2CQ0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j02i0-0002ec-6m; Fri, 07 Feb 2020 12:26:08 +0000 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j02hw-0002ca-9r for linux-mtd@lists.infradead.org; Fri, 07 Feb 2020 12:26:06 +0000 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.06713034|-1; CH=green; DM=CONTINUE|CONTINUE|true|0.243597-0.0807567-0.675647; DS=CONTINUE|ham_system_inform|0.0554339-0.00117818-0.943388; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03299; MF=liaoweixiong@allwinnertech.com; NM=1; PH=DS; RN=17; RT=17; SR=0; TI=SMTPD_---.GlaQplc_1581078351; Received: from PC-liaoweixiong.allwinnertech.com(mailfrom:liaoweixiong@allwinnertech.com fp:SMTPD_---.GlaQplc_1581078351) by smtp.aliyun-inc.com(10.147.41.137); Fri, 07 Feb 2020 20:25:57 +0800 From: WeiXiong Liao To: Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , Greg Kroah-Hartman , Jonathan Cameron , WeiXiong Liao Subject: [PATCH v2 00/11] pstore: mtd: support crash log to block and mtd device Date: Fri, 7 Feb 2020 20:25:44 +0800 Message-Id: <1581078355-19647-1-git-send-email-liaoweixiong@allwinnertech.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200207_042604_619494_FFF05DD5 X-CRM114-Status: GOOD ( 10.02 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [121.197.207.205 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Why do we need to log to block (mtd) device? 1. Most embedded intelligent equipment have no persistent ram, which increases costs. We perfer to cheaper solutions, like block devices. 2. Do not any equipment have battery, which means that it lost all data on general ram if power failure. Pstore has little to do for these equipments. Why do we need mtdpstore instead of mtdoops? 1. repetitive jobs between pstore and mtdoops Both of pstore and mtdoops do the same jobs that store panic/oops log. 2. do what a driver should do To me, a driver should provide methods instead of policies. What MTD should do is to provide read/write/erase operations, geting rid of codes about chunk management, kmsg dumper and configuration. 3. enhanced feature Not only store log, but also show it as files. Not only log, but also trigger time and trigger count. Not only panic/oops log, but also log recorder for pmsg, console and ftrace in the future. Before upstream submission, pstore/blk is tested on arch ARM and x84_64, block device and mtd device, built as modules and in kernel. Here are the details: https://github.com/gmpy/articles/blob/master/pstore/Test-Pstore-Block.md [PATCH v2]: 1. fix syntax error in documents. Thank Randy Dunlap 2. replace pr_* with dev_* for mtdpstore. Thank Vignesh Raghavendra 3. improve mtdpstore. Thank Miquel Raynal [PATCH v1]: 1. fix errors and warnings reported by kbuild test robot. WeiXiong Liao (11): pstore/blk: new support logger for block devices blkoops: add blkoops, a warpper for pstore/blk pstore/blk: blkoops: support pmsg recorder pstore/blk: blkoops: support console recorder pstore/blk: blkoops: support ftrace recorder Documentation: pstore/blk: blkoops: create document for pstore_blk pstore/blk: skip broken zone for mtd device blkoops: respect for device to pick recorders pstore/blk: blkoops: support special removing jobs for dmesg. blkoops: add interface for dirver to get information of blkoops mtd: new support oops logger based on pstore/blk Documentation/admin-guide/pstore-block.rst | 306 +++++++ MAINTAINERS | 3 +- drivers/mtd/Kconfig | 10 + drivers/mtd/Makefile | 1 + drivers/mtd/mtdpstore.c | 564 ++++++++++++ fs/pstore/Kconfig | 109 +++ fs/pstore/Makefile | 5 + fs/pstore/blkoops.c | 475 ++++++++++ fs/pstore/blkzone.c | 1328 ++++++++++++++++++++++++++++ include/linux/blkoops.h | 94 ++ include/linux/pstore_blk.h | 91 ++ 11 files changed, 2985 insertions(+), 1 deletion(-) create mode 100644 Documentation/admin-guide/pstore-block.rst create mode 100644 drivers/mtd/mtdpstore.c create mode 100644 fs/pstore/blkoops.c create mode 100644 fs/pstore/blkzone.c create mode 100644 include/linux/blkoops.h create mode 100644 include/linux/pstore_blk.h