Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp800548pxa; Wed, 5 Aug 2020 13:06:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWykTrnWDU08OzfFRk0OxTxyS1K8ZMnnmjSjVM+h1XqikY4Cn68+5i5BefQF/LVmy52z0F X-Received: by 2002:a17:906:fad1:: with SMTP id lu17mr966476ejb.127.1596657977983; Wed, 05 Aug 2020 13:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596657977; cv=none; d=google.com; s=arc-20160816; b=IMUEu0T8bOQJfADFOj6IYIaB6qMi4V9zYwZC+ucGfNdaPY4AL0520M3X4Mj4903+A+ MwSeswe7Ou/S6AQ5WyWKqpF1UFGipsE/kH67WWjXacdOslsHT5/+HexR7Pd/ixg4Rq/m Ow05TC8gE14leoLmGhpPLoL/mUK91zG+g+DRGEWcomdXK1+/dyPhcsx66RH0iX1//mX7 E+RHtdRvxkbaNY95kj71p8rXnhrkTP7Rbg/GOf6YqcwpBjvcaL9xBDthJSGTOZKgGFVi lAL0Z/NnmAk8zl2vPRv7/Q0qbFdoBDP/K8awewSNNOd7/5LuvDhw+R6h5Ek6q3EYUfbN FsKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=f6URHwOior2ja3S0KkG9nUDkwbkKQIAYKNCGCcWPXZo=; b=Cs5eEeI7R+kqohYXOK5+qMZ4RVpHlUXztAr01jL/FxYf2hyo+0yB2IsDXkZh36hKeR VwfpLmKm8VEYdh8gSQrDALjB2jbY3RPXoge+akABG655n9qaUzIMzIfrCHUU8ab2G5TS uLL9M9zIsoRMMzOFhQo7ReK7ouedwqWqAlCInjPNJruie3Uo5G3c0JQZEySLSO/Mr8sJ Kq1rE5WaXhwCdNL6RyueFfUmJDXQveHaGnenk09fjfANC9PtZ11KPmlgZMymfWT8PW0I fOmgEqpFYxwyCFzWzYeTmF1t0qQd6QoZFSW/0s6PMro0XDvJ/C0gckSCNn+651Z2dPAD f92Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j19si1732429edr.368.2020.08.05.13.05.55; Wed, 05 Aug 2020 13:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728981AbgHEUFm (ORCPT + 99 others); Wed, 5 Aug 2020 16:05:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:58322 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727120AbgHEQfi (ORCPT ); Wed, 5 Aug 2020 12:35:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1583AAEF5; Wed, 5 Aug 2020 14:04:49 +0000 (UTC) Date: Wed, 5 Aug 2020 16:04:30 +0200 From: Petr Mladek To: Prarit Bhargava Cc: corbet@lwn.net, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, chunyan.zhang@unisoc.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, orsonzhai@gmail.com, zhang.lyra@gmail.com Subject: Re: [PATCH V13] printk: Add monotonic, boottime, and realtime timestamps Message-ID: <20200805140430.GI24529@alley> References: <20200729114423.30606-1-zhang.lyra@gmail.com> <20200729122236.17418-1-prarit@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200729122236.17418-1-prarit@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-07-29 08:22:36, Prarit Bhargava wrote: > Chunyan Zhang wrote: > > From: Prarit Bhargava > > > > printk.time=1/CONFIG_PRINTK_TIME=1 adds a unmodified local hardware clock > > timestamp to printk messages. The local hardware clock loses time each > > day making it difficult to determine exactly when an issue has occurred in > > the kernel log, and making it difficult to determine how kernel and > > hardware issues relate to each other in real time. > > > > Make printk output different timestamps by adding options for no > > timestamp, the local hardware clock, the monotonic clock, the boottime > > clock, and the real clock. Allow a user to pick one of the clocks by > > using the printk.time kernel parameter. Output the type of clock in > > /sys/module/printk/parameters/time so userspace programs can interpret the > > timestamp. > > > ISTR the reason that this was dropped was because of the a problem with > the way systemd read the kernel's timestamps. It got the attention of > Linus, and it was then pulled from the tree. > > I need to go back and review the entire thread as it's been several years > since we had the discussion although ISTR someone mentioning that doing two > timestamps would not be a problem for systemd. I guess that you talk about this thread https://lore.kernel.org/lkml/CA+55aFwUfA__6MgMgjENnx+_RYY2ZOOLiSx2ea1AvYhSZN+78A@mail.gmail.com/ > For example, > > [48551.015086] > > would be > > [48551.015086] m[xxxx.xxxx] > > for the monotonic clock timestamp, and > > [48551.015086] b[xxxx.xxxx] > > for the boottime clock, etc. This approach has several drawbacks: + Too long prefix might make it hard to see the real messages because of shrunken/wrapped lines. + Too long lines are problem with slow consoles. + More space will be necessary to store all the time stamps. + Userspace tools would need/want to parse the format. We would need to maintain it forever. Linus had an interesting idea to print all timestamps regularly. The frequency might be configurable. It might print, for example, the following line every 10 minutes or once a day: [48551.015086] System alive: b[xxxx.xxxx] m[xxxx.xxxx] It might be useful in general to see when the system was still alive before it froze. Would it be enough to sort messages printed with different clock sources? Best Regards, Petr