From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756809AbdKNWKn (ORCPT ); Tue, 14 Nov 2017 17:10:43 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:43485 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbdKNWKe (ORCPT ); Tue, 14 Nov 2017 17:10:34 -0500 X-Google-Smtp-Source: AGs4zMYbkuUQxOyiY040/0+vCqJ/xXn5eRuzr7odpVoi+QSIYh7x+jNVRNmXf/HtqTKydKYKDAk7Jg== Subject: Re: [GIT pull] printk updates for 4.15 To: Linus Torvalds Cc: Thomas Gleixner , Petr Mladek , LKML , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Prarit Bhargava , Sergey Senozhatsky , Steven Rostedt References: <20171114100336.uil744pxmbsawq63@pathway.suse.cz> <7d23f705-1479-7874-7918-f2af9ec02c86@android.com> From: Mark Salyzyn Message-ID: <7f0e0165-2b22-f2cf-ce6e-8db3d7325973@android.com> Date: Tue, 14 Nov 2017 14:10:30 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/14/2017 01:29 PM, Linus Torvalds wrote: > And then maybe you can send a single patch that changes *ONLY* > print_time(), with an explanation of how Android uses > CONFIG_PRINTK_TIME and would like that to be realtime instead of the > monotonic clock that we traditionally use. I would be pleased to be educated. print_time() uses msg->ts_nsec; and AFAIK that needs to be in reference to the timebase. You can not after the fact acquire the correct synchronization and corrections between boottime and localtime/monotonic for example, it has to be landed at point of logging, not reconstructed at time of printing? [TL;DR] We would need to land the at-time-of-logging correction factor(s) for the timebase for each logged entry for print_time() to provide a correct fixed value when dumped. eg I would also need these values handy in the msg structure: tk->xtime_sec; tk->wall_to_monotonic->tv_sec tk->wall_to_monotonic->tv_nsec tk->raw_time.tv_sec; tk->raw_time.tv_nsec tk->tkr_raw.shift tk->tkr_raw.xtime_nsec; tk->tkr_raw.mult; rk->tkr_raw.shift tk->tkr_mono.xtime_nsec tk->tkr_mono.xtime_nsec; tk->tkr_mono.mult; tk->tkr_mono.shift; tk->tkr_mono.mask; tk->tkr_mono.cycle_last; tk->offs_boot; (or live with it your way, klogd grabbing the 'relatively correct' entries ASAP, but then dmesg output will differ) Having a periodic message with a hint for correction factors helps (which we have used in a prototype dmesg tool), but drift puts us in the ms region (which I was satisfied with, but some of our partners were not) when they would have liked us (or ns) time precision. For Android, periodic correction prints at time disruptions is good enough, I am merely advocating for some of the partners needs. -- Mark