Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp7136998imm; Sun, 20 May 2018 19:46:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo70js50lu0yAyU7SAGxZgpRiPeM9IOuUB/KVhbxOfXfIYhc69SG9DNkuufUcnTLza0Vemv X-Received: by 2002:a17:902:b60b:: with SMTP id b11-v6mr18897690pls.330.1526870768016; Sun, 20 May 2018 19:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526870767; cv=none; d=google.com; s=arc-20160816; b=woNNXHYc+1WXcT9d3mqXmgurqjLTK4r+J7XF/q65PzHzahtd1I6a5IjKPEgriwituM XAzt+JpGhJYD45eM2U/pbaifZx9BWrR4vCiO0MLFInP15/NaWeQ6vn7GBnHrVptVlFor X8si4iiMmOgW/axexx+v0aUwZ+CdWZ5ZASTIsZSYxDlyyqmW2rJJNB0P6RA4yDWBH6A7 n+x6H+7MQhXv2p5jLepDTmf8RDNh64JqNZYS4JomCcuodBd7LoUxVlctLt1NqjONdfck pOWLEA7VdCIK29atgt9m4olnZ8HyoJi+Lwo689PyQkFumI4mwyhCGWjzCzku5APkYGnO Xd6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=gynfgayKVUEZOuUpWRHfpBvnfKE0Eqsc494lseAbjmE=; b=EF30X9E3kDnrFn/7I+wjGgZcApyP8e2eW3ieF7U9XNfzDRSteKcoyMXp+QgOBsqBCK oZQ14aGrKUXnlIPa3i+QBMd+Eu52Y1xEOjZrd7AAQP6GiykKa3p5D8ZJ8A6cK7FzsmmN 5ONLp0msd0DFulPfLxlFUoXxjoH9V+0Jhx046uNKxLf+S9WSIbU60aN+MX8q+5gYrobX oZ7y/Le7KlxHG7gVV2swSUkmkPTf1UUZOG+ajYg84BKY0CdUqVcKy3J/2toEuMOChPu/ yKX9e26PuZJYEY1FEXSom7k8U17Hz72ds5qAYx8gNWrzjbh341hRCeHkjqERGvR4IMQJ RCbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=Iu38+D/v; 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=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si9990610pgo.437.2018.05.20.19.45.52; Sun, 20 May 2018 19:46:07 -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; dkim=pass header.i=@cisco.com header.s=iport header.b=Iu38+D/v; 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=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688AbeEUCmh (ORCPT + 99 others); Sun, 20 May 2018 22:42:37 -0400 Received: from rcdn-iport-6.cisco.com ([173.37.86.77]:57644 "EHLO rcdn-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbeEUCmg (ORCPT ); Sun, 20 May 2018 22:42:36 -0400 X-Greylist: delayed 766 seconds by postgrey-1.27 at vger.kernel.org; Sun, 20 May 2018 22:42:36 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1684; q=dns/txt; s=iport; t=1526870556; x=1528080156; h=date:from:to:cc:subject:message-id:mime-version; bh=gynfgayKVUEZOuUpWRHfpBvnfKE0Eqsc494lseAbjmE=; b=Iu38+D/vMuWK0UNL1lLpHJKZqf84VH4yBDGVsQK3lnX8Y2OmzAT588CL LCSOp1sMmE8V268nWTHuUo5X8ydJhxL8R35giwzUCB0sPg5HhFiuBmQuS qeIUOmfuPpoWbL5fkUi7uPC/ZtVNqHTX4ii6NOKGvBUoSZYnLSqKRX3Rq k=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ASAgDYLgJb/4kNJK1aGgEBAQEBAgE?= =?us-ascii?q?BAQEIAQEBAYNDgV6ZGIF5dRqVLguEbIITITcVAQIBAQEBAQECbCiFKgQ7PwU?= =?us-ascii?q?WITQFGDGFKQUHAad+iD2CD4g1gVQ/gQ+BdmE1iCOCJAKNBItICY5MgUKGTIR?= =?us-ascii?q?6kHeBJTIigVJwFYJ/ghwajjeQcwEB?= X-IronPort-AV: E=Sophos;i="5.49,425,1520899200"; d="scan'208";a="398384548" Received: from alln-core-4.cisco.com ([173.36.13.137]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 02:29:25 +0000 Received: from sjc-ads-587.cisco.com (sjc-ads-587.cisco.com [171.70.56.29]) by alln-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id w4L2TObS006233; Mon, 21 May 2018 02:29:25 GMT Received: by sjc-ads-587.cisco.com (Postfix, from userid 292853) id 9C648379; Sun, 20 May 2018 19:29:24 -0700 (PDT) Date: Sun, 20 May 2018 19:29:24 -0700 From: Stefan Schaeckeler To: Richard Weinberger Cc: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mtd: mtdoops: optionally dump boottime Message-ID: <20180521022924.GA33758@sjc-ads-587.cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Richard and others, > I get the use-case, but why is this only for mtdoops? Powerpc's nvram module also stores oops messages and does so by adding an additional timestamp, as well (search for kmsg_dump_get_buffer() in arch/powerpc/kernel/nvram_64.c). This timestamp is the number of seconds since 1970 and stored as a 64 bit integer in the nvram header. Basically, the last kmesg timestamp is a few ms less than this additionally stored timestamp. Recording boottime would be more elegant, I guess. > IMHO this needs to go into generic code such that all kmsg dumpers can > benefit from it. This would be not that easy: #1 kmsg_dump_get_buffer(...size...) returns the most recent bytes. Consecutive calls return older chunks. It would be natural to return the boottime as the first line, e.g. in the last call, but some clients such as mtdoops call kmsg_dump_get_buffer() only once. The returned buffer may be complete including boottime, or not. #2 consistency with other clients: nvram_64.c has the same requirement of storing a kind of wall-time but does it in a completely different way: no readable ascii text timestamp preprended to the kmsg buffer but a 64 bit timestamp in its header. Note, I don't think we should make mtdoops behave like nvram_64.c by storing the timestamp as a 64 bit integer (in its header) b/c most people do a cat or string of the mtd device /dev/mtdX and a 64 bit integer would just read as garbage. I hope we can have separate implementations for recording additional timestamps. Later, I'll send a patch with stylistic changes unless we completely disagree on how to move forward. Stefan