Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4012598imu; Mon, 7 Jan 2019 13:49:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN7m6fdyoMTNQf/RWvIZ/JJ+teTECspdrkyFD+2ji5PISaceAvOGsYqF0RF1eE2gnriDrH1T X-Received: by 2002:a63:db02:: with SMTP id e2mr31588812pgg.419.1546897770793; Mon, 07 Jan 2019 13:49:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546897770; cv=none; d=google.com; s=arc-20160816; b=CA61txuO/sT/E/+Q7Ts5DNmiFnheNL4PGXJljIB1uPyOknDQN2drKeVU0kT3LXJ2tH A06Ej/4/CIy9QKldn2EInl2NiaU4/RSIXwyhvkwYo33BHsC+W+vhP1OfqRt5k5O8ZpwF TnG/8O2w7wTTSNn+th5qAho++xrUzMj5by2Dp1+npD8ciw4CUGh7hfIJwtZOi/U5yC4q pQjrxbwgn4lKzYZJsMxgFSrJt9wlExwQrVhf2yysQmB+0n3gUXcSYMSwLctTE5/eowgD WFzesCGlU49ZrtBKEc9CzEAbo1sdoh+XDa4ewot+dNxTzCtDlYq8xeS6mkPeYaqn+5wf rXtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YQ7FpZSVRYgjz4zvMXV7TjL2RDg8LfVCTLWfBdLl6o8=; b=eqUJae2QPN74XgRWTtfJfDh7wm1Ukym8BmaafZG7xqP9HHO9lhDWW735fEgmrEMQFk VvrBiaA4wYd75xEXh0f7yb9l8LpVKQwMJbY9w/IjS0g1eXz87wlUYYTFUCn2diybO10t /0ZZeylwuDkTUnp8VWyNwgc26GrQqAdMEiOchC6BxkOb7G+wbk1oAbh55N2ocztSLkLN vwDLWEkJ2K0kDUj6mWcyIgB1VIrSGZ7LDJSW3nq9q5n2ETuH9TKNYfsguK1nKxrBz/oz XL7T0GpU9sBrECKegRPO6Wz6DJzdYQjp8tTvZZF5B8z8PuYrbXIqi0UTED6Qd5u3fcw/ HF7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Aez9kVa9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si533110plr.355.2019.01.07.13.49.14; Mon, 07 Jan 2019 13:49:30 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=Aez9kVa9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbfAGVrl (ORCPT + 99 others); Mon, 7 Jan 2019 16:47:41 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:46835 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfAGVrk (ORCPT ); Mon, 7 Jan 2019 16:47:40 -0500 Received: by mail-vk1-f195.google.com with SMTP id j23so423200vke.13 for ; Mon, 07 Jan 2019 13:47:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YQ7FpZSVRYgjz4zvMXV7TjL2RDg8LfVCTLWfBdLl6o8=; b=Aez9kVa9X4UBUMcv7J5Gknz6PmFvqpxeK3rtNkfeQ7wczvXCSsAYhYs+9lTBQl/qRx DL1MyN/+3FZiT8Bm2SrtYSLKpWbMwlVezwynkKiW7rCGL249ITSeU5A09NqRlUTK5AP4 VI5MU2pZQl+rMrAA3WpRMqYVux8f75t666KOY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YQ7FpZSVRYgjz4zvMXV7TjL2RDg8LfVCTLWfBdLl6o8=; b=All7yqiEfgqlqdYGEgKPPt8TizPYBa93w1DqUaer4/0DEbFlSbMfg819Sdc/0tnOX5 u9aOxg+X3wInRkSIc7Nr6qObIM7LPPTEz6BP5VTY80xj5divsZGFG0MmWelKywY7hx+x 3YPdHZoAR7SKo2PwkUJAp86w2tvaq6S3rekoyN8tat0IvAS8WgQhs8d066GLc6vj+YRe nNYL29esWMSO26CXrbZyLWbHU8C1Y7/StWdvhmGhhVSaANuCIEUlUWF/YjN5uPe7gw8p xpO33h4QVvPZl+dScU92KQEwjwLqY0wa8CkQW0ncnSWwjKkeI4FcRXc5RlItXN2FLZwS ehRw== X-Gm-Message-State: AJcUukd/INGXkKTatOpQv/2MWXKZrJwPQiNzpzTMxQUUu4USfYIQBbrN kH3qKiNSStdVlsBJMfxmZI/k99vbei4= X-Received: by 2002:a1f:2cb:: with SMTP id 194mr23995506vkc.19.1546897658664; Mon, 07 Jan 2019 13:47:38 -0800 (PST) Received: from mail-vk1-f174.google.com (mail-vk1-f174.google.com. [209.85.221.174]) by smtp.gmail.com with ESMTPSA id m89sm33846898vsh.22.2019.01.07.13.47.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jan 2019 13:47:36 -0800 (PST) Received: by mail-vk1-f174.google.com with SMTP id 197so439666vkf.4 for ; Mon, 07 Jan 2019 13:47:36 -0800 (PST) X-Received: by 2002:a1f:e7c5:: with SMTP id e188mr21439180vkh.92.1546897655846; Mon, 07 Jan 2019 13:47:35 -0800 (PST) MIME-Version: 1.0 References: <1546862462-19640-1-git-send-email-liaoweixiong@allwinnertech.com> In-Reply-To: <1546862462-19640-1-git-send-email-liaoweixiong@allwinnertech.com> From: Kees Cook Date: Mon, 7 Jan 2019 13:47:24 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC v5 0/4] pstore/block: new support logger for block devices To: liaoweixiong Cc: Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Mauro Carvalho Chehab , Greg Kroah-Hartman , "David S. Miller" , Andrew Morton , Nicolas Ferre , Arnd Bergmann , "open list:DOCUMENTATION" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 7, 2019 at 4:01 AM liaoweixiong wrote: > > Why should we need pstore_block? > 1. Most embedded intelligent equipment have no persistent ram, which > increases costs. We perfer to cheaper solutions, like block devices. > In fast, there is already a sample for block device logger in driver > MTD (drivers/mtd/mtdoops.c). > 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. I'm catching up from being off over the holidays, but I just wanted to say that I like the general idea here. > [PATCH v5] > On patch 1: > 1. rename pstore/rom to pstore/blk Thanks! The earlier name seemed wrong. :) > 2. Do not allocate any memory in the write path of panic. So, use local > array instead in function romz_recover_dmesg_meta. > 3. Add C header file "linux/fs.h" to fix implicit declaration of function > 'filp_open','kernel_read'... > On patch 3: > 1. If panic, do not recover pmsg but flush if it is dirty. > 2. Fix erase pmsg failed. > On patch 4: > 1. Create a document for pstore/blk Overall, I wonder if more of the ram backend code could get reused for the blk backend? I'd much rather be able to share that, since much of the logic is the same. I'll get to a more detailed review in the coming days. Thanks for sending this! -Kees > > [PATCH v4] > On patch 1: > 1. Fix always true condition '(--i >= 0) => (0-u32max >= 0)' in function > romz_init_zones by defining variable i to 'int' rahter than > 'unsigned int'. > 2. To make codes more easily to read, we use macro READ_NEXT_ZONE for > return value of romz_dmesg_read if it need to read next zone. > Moveover, we assign READ_NEXT_ZONE -1024 rather than 0. > 3. Add 'FLUSH_META' to 'enum romz_flush_mode' and rename 'NOT_FLUSH' to > 'FLUSH_NONE' > 4. Function romz_zone_write work badly with FLUSH_PART mode as badly > address and offset to write. > On patch 3: > NEW SUPPORT psmg for pstore_rom. > > [PATCH v3] > On patch 1: > Fix build as module error for undefined 'vfs_read' and 'vfs_write' > Both of 'vfs_read' and 'vfs_write' haven't be exproted yet, so we use > 'kernel_read' and 'kernel_write' instead. > > [PATCH v2] > On patch 1: > Fix build as module error for redefinition of 'romz_unregister' and > 'romz_register' > > [PATCH v1] > On patch 1: > Core codes of pstore_rom, which works well on allwinner(sunxi) platform. > On patch 2: > A sample for pstore_rom, using general ram rather than block device. > > liaoweixiong (4): > pstore/blk: new support logger for block devices > pstore/blk: add sample for pstore_blk > pstore/blk: support pmsg for pstore block > Documentation: pstore/blk: create document for pstore_blk > > Documentation/admin-guide/pstore-block.rst | 226 ++++++ > MAINTAINERS | 1 + > fs/pstore/Kconfig | 20 + > fs/pstore/Makefile | 5 + > fs/pstore/blkbuf.c | 46 ++ > fs/pstore/blkzone.c | 1168 ++++++++++++++++++++++++++++ > include/linux/pstore_blk.h | 62 ++ > 7 files changed, 1528 insertions(+) > create mode 100644 Documentation/admin-guide/pstore-block.rst > create mode 100644 fs/pstore/blkbuf.c > create mode 100644 fs/pstore/blkzone.c > create mode 100644 include/linux/pstore_blk.h > > -- > 1.9.1 > -- Kees Cook