From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933360AbdKOS2U (ORCPT ); Wed, 15 Nov 2017 13:28:20 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:42854 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932439AbdKOS2C (ORCPT ); Wed, 15 Nov 2017 13:28:02 -0500 Message-Id: <20171115181531.322572387@linutronix.de> User-Agent: quilt/0.63-1 Date: Wed, 15 Nov 2017 19:15:31 +0100 From: Thomas Gleixner To: LKML Cc: Linus Torvalds , Prarit Bhargava , Mark Salyzyn , Petr Mladek , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches Subject: [RFC patch 0/7] printk: Switch to CLOCK_MONOTONIC and store extra time stamps Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following up on yesterdays discussion about adding support for reliably correlatable time stamps to the printk ringbuffer entries, I split up that draft patch from yesterday, addressed review feedback and actually tested it. There are a few things which are visible changes: 1) The fine grained time stamps start later in the boot process because local_clock() is initialized before a high resolution clocksource is installed. 2) During suspend/resume between timekeeping_suspend() and timekeeping_resume() the NMI safe accessors return a stale timestamp, i.e. the timestamp which was captured in timekeeping_suspend() Mitigation: #1 Can be mitigated by a horrible hack, which I added as last patch in the series. It uses local_clock() in early boot up to the point where a proper clocksource providing fine grained CLOCK_MONOTONIC is available. That's actually not that bad, because time won't drift apart. #2 Can be mitigated at least for clocksources which are safe to access past timekeeping_suspend(). There are patches which enable that for TSC when the TSC_NONSTOP_SUSPEND cpu feature bit is enabled. For clocksources which cannot be accessed past timekeeping_suspend() the workaround #1 can be used (see last patch^Whack). Though this might cause time inconsistencies (non monotonic time stamps). Not sure if any of this is a real problem, because not all local/sched_clock() implementations are functional past timekeeping_suspend(). I left all 3 time stamps in the patch for now so people can actually play with that. Thanks, tglx