From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753875AbdK1Snu (ORCPT ); Tue, 28 Nov 2017 13:43:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbdK1Sns (ORCPT ); Tue, 28 Nov 2017 13:43:48 -0500 Subject: Re: [RFC patch 7/7] timekeeping: Hack to use fine grained timestamps during boot To: Petr Mladek , Thomas Gleixner References: <20171115181531.322572387@linutronix.de> <20171115182657.703928462@linutronix.de> <20171123125823.gnhwtnx6bxd3tb4q@pathway.suse.cz> Cc: LKML , Linus Torvalds , Mark Salyzyn , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches From: Prarit Bhargava Message-ID: <205229e2-fab4-31cb-60cd-f36bc2228804@redhat.com> Date: Tue, 28 Nov 2017 13:43:46 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20171123125823.gnhwtnx6bxd3tb4q@pathway.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 28 Nov 2017 18:43:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/23/2017 07:58 AM, Petr Mladek wrote: > On Wed 2017-11-15 19:15:38, Thomas Gleixner wrote: >> For demonstration purposes only. >> >> Add a disgusting hack to work around the fact that high resolution clock >> MONOTONIC accessors are not available during early boot and return stale >> time stamps accross suspend/resume when the current clocksource is not >> flagged with CLOCK_SOURCE_SUSPEND_ACCESS_OK. >> >> Use local_clock() to provide timestamps in early boot and when the >> clocksource is not accessible after timekeeping_suspend(). In the >> suspend/resume case this might cause non monotonic timestamps. > > I get the non-monotonic times even during boot: > > [ 0.026709] smp: Bringing up secondary CPUs ... > [ 0.027973] x86: Booting SMP configuration: > [ 0.028006] .... node #0, CPUs: #1 > [ 0.004000] kvm-clock: cpu 1, msr 1:3ff51041, secondary cpu clock > ^^^^^^^^ > [ 0.032097] KVM setup async PF for cpu 1 > [ 0.032766] kvm-stealtime: cpu 1, msr 13b00dc40 > [ 0.036502] #2 > [ 0.004000] kvm-clock: cpu 2, msr 1:3ff51081, secondary cpu clock > ^^^^^^^^ > [ 0.040062] KVM setup async PF for cpu 2 > [ 0.040576] kvm-stealtime: cpu 2, msr 13b20dc40 > [ 0.041304] #3 > [ 0.004000] kvm-clock: cpu 3, msr 1:3ff510c1, secondary cpu clock > ^^^^^^^^ > [ 0.048051] KVM setup async PF for cpu 3 > [ 0.048554] kvm-stealtime: cpu 3, msr 13b40dc40 > > > To be honest, I do not feel experienced enough to decide which > solution is acceptable. I would say that only few people care > about timestamps during boot. On the other hand, some tools It is extremely important to know what happened and how long it took. I agree with Petr, we should figure out a way to guarantee that the timestamp is monotonic. P.