From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933559AbdKPH7N (ORCPT ); Thu, 16 Nov 2017 02:59:13 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:46938 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933004AbdKPH7E (ORCPT ); Thu, 16 Nov 2017 02:59:04 -0500 X-Google-Smtp-Source: AGs4zMYT74pXcNRKiKVZD/VD2Y8tTi8ucZixA+uqr67I5BU+AipsWtfJpZK11Q/NVt+FKggrPMmVOQ== Date: Thu, 16 Nov 2017 16:58:59 +0900 From: Sergey Senozhatsky To: Thomas Gleixner Cc: LKML , Linus Torvalds , Prarit Bhargava , Mark Salyzyn , Petr Mladek , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches Subject: Re: [RFC patch 3/7] printk: Use clock MONOTONIC for timestamps Message-ID: <20171116075832.GA464@jagdpanzerIV> References: <20171115181531.322572387@linutronix.de> <20171115182657.383713029@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171115182657.383713029@linutronix.de> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Thomas, On (11/15/17 19:15), Thomas Gleixner wrote: > local_clock() cannot be reliably correlated to CLOCK_MONOTONIC, which is > used by user space, e.g. systemd, to create correlation timestamps. > > There are multiple reasons: > > - CLOCK_MONOTONIC is NTP adjusted, local_clock() not. Depending on the > calibration accuracy and uptime significant drift can be observed. > > - CLOCK_MONOTONIC does not advance across suspend/resume for historical > reasons. local_clock() might or might not depending on the properties of > the underlying hardware counter. > > Use the NMI safe accessor to clock MONOTONIC instead of local_clock(). The > access might be slower than local_clock(), but printk is not such a > performance critical hotpath that it matters. > > Visible change: > > The early boot timestamps are jiffies based longer than with local_clock() > depending on the platform. During suspend/resume the timestamp may become > stale when the underlying clocksource hardware is not flagged with > CLOCKSOURCE_SUSPEND_ACCESS_OK. > > A horrible follow up patch demonstrates how that could be mitigated. > > Signed-off-by: Thomas Gleixner > --- > kernel/printk/printk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > a silly nitpick, I suppose we can do -#include +#include -ss