Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp307341imm; Thu, 31 May 2018 00:19:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJpNL/yganHr+sxc46sguZQe/tCQg3d0LUzPMIuFojIMyVPr/6xciZekGL8XaMWYyQM5SpB X-Received: by 2002:a63:714e:: with SMTP id b14-v6mr4577124pgn.73.1527751182153; Thu, 31 May 2018 00:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527751182; cv=none; d=google.com; s=arc-20160816; b=AqUev4KQz00BxbsccY29FhzRiB7gD8WC/Hn2X5jvcH8MmRjjowKg5c10hwa9cXOPm1 43aWjFaPf0kt2BqC835L+XXZwdrmhhq8uWJSyPmCf4BgSqgE9H47+Yiv0+ODB0F5kmSh ILvsfQmD+COWH4dUKe6UVoDkBpq9ktsHnAuwmdsvEZWxKqabBr01r/7F/Cegz8TMGU9F 1P80djowM/K2ZNLQVafxXkCsD1yWD6TKeEDCT2DakdfbErEH0q9aGRU8QjykTUERnYIm 5MFFGYbjKAIA0comzsSm887pk2xyOIZeCneJz/bp1UDhD/WGRH5D/gEyKiKLCggcfdhi v1pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=l/cpKEmJuUFOJ92SPeHmFfe4RS2Llc2nUWf3gQf3zEI=; b=jsmz5MuXk0neqnyXcC9IQrQtu0NCAdo7WMrTH7ezcZmYOhhMTClxSQOCX4rxem7XRc hNy/fny9+TVe313wFPI0QHnrlmo5yXxoHHnyTXljLQfQYVoXsP52PJy2n0pjQnQhPVxT yWJb3n3O2XrS4mBqgTK4xNxfXB9IROCJm2W55o+YTJFOj9zKTCNe+9KR/j/o5cTdIsjK TFkOGrG00DY4XBrvucXVdOh33ntLY30u292wF01ZQ6HWoMIeBqmjoGFnhIKXyngxXm56 9LAWEP45kMQL6lhrK69vJWcFu9zH0oEWEJbQ+M/ZnuW0n3vcTsgRbmfgc7+nrGYICt7T YncA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qXeuuNQv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si36766133plb.213.2018.05.31.00.19.28; Thu, 31 May 2018 00:19:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qXeuuNQv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754017AbeEaHSs (ORCPT + 99 others); Thu, 31 May 2018 03:18:48 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44637 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753946AbeEaHSr (ORCPT ); Thu, 31 May 2018 03:18:47 -0400 Received: by mail-qt0-f195.google.com with SMTP id d3-v6so26669919qtp.11 for ; Thu, 31 May 2018 00:18:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=l/cpKEmJuUFOJ92SPeHmFfe4RS2Llc2nUWf3gQf3zEI=; b=qXeuuNQvfyBuPKpugf/7NPYqfhntsydIm9sv56DxWTROPGy/0QjKoLzeHNG9AUlh32 Q1FonVsWsPpXEdw7ZZmSSX2cwheGSzWjduUt+/qt5wlL26ZTRf/ISm3rY6dtMXY3z4x9 84+jmh+rPQqBcWgBvoETUsetl6RivP/LqrUeB2CecY04GR4FgPo61yn9VnS84XKELvEf 4HRNiFozZ7z/ptmGPhMr/yWolC2Zuh3dSIUT5pcs/xN30MLepQtWa12WCz5xVvc8uHQ3 GMJEyNSKup6phfgXA6EKe+3/W1aXqR3wLEq+UeTfDB6tcSgesz+A7HU72QdOeTdNllaJ 3P7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=l/cpKEmJuUFOJ92SPeHmFfe4RS2Llc2nUWf3gQf3zEI=; b=Wt2V1WClFWzPA3n7h128S2US8AKPxS7FdOb0Dn1XdSjemT9s0dUFlWcaRfE4L0RL5M u/teTc+apAvlXJpHXWHy0IwkJkFNxSM6rr/0hwPeKMNoyJmY0ebUuzdDilEoXUBUZAZw +gQLOTSZCgXPOOFMdKgKTRCa6bR9bdbyh7ibrlq8u1xfxvgBwawONAAb7swAILwBSfQL e9EQB+l8wqeHEDRKGrnes8CvG9ToaJIkW6whPsC7S/jX9ATZxv4Y9cH/QsyBoukCQaTs M3PoUt8Z2AkwZd0EppgBNhF/QkQA0h2CfFibA4OOBlYaAz0kAvuZ8z/WZOZigMmsZxLj mExg== X-Gm-Message-State: APt69E1DHJup64Xi+IQ3kHc6Fw/VpDRpI8u5gfUYcc9Wp+Yhlqy09kGq fZfA8YJR8iRnBO3iT+/w9KTh8lXw5ZrQnkr/AM8= X-Received: by 2002:ac8:201:: with SMTP id k1-v6mr5592508qtg.220.1527751126661; Thu, 31 May 2018 00:18:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9896:0:0:0:0:0 with HTTP; Thu, 31 May 2018 00:18:46 -0700 (PDT) In-Reply-To: <1527672059-6225-1-git-send-email-feng.tang@intel.com> References: <1527672059-6225-1-git-send-email-feng.tang@intel.com> From: Andy Shevchenko Date: Thu, 31 May 2018 10:18:46 +0300 Message-ID: Subject: Re: [RFC 1/2] printk: Enable platform to provide a early boot clock To: Feng Tang Cc: Petr Mladek , Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , Alan Cox , Peter Zijlstra , Linux Kernel Mailing List , alek.du@intel.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 30, 2018 at 12:20 PM, Feng Tang wrote: > Currently printk timestamp mostly come from the sched_clock which > depends on the clock setup, so there are many kernel logs started > with "[ 0.000000] " before the clock is calibrated. > > This patch will provide an debug option for specific platform to > provide a early boot time clock, so that we can have time info in > kernel log much earlier, which can show the time info for the early > kernel boot, and make boottime tuning/optimization easier (boot time > is critical for phone/tablet and embedded devices). > > Capable platform only need to setup the "boot_printk_clock_fn" > which could return time in nano seconds. > > Together with a TSC patch on x86 system, we have easily captured > some early boottime killer like unwind_init() which takes about > 300ms in boot phase. > +static u64 printk_clock(void) > +{ > + /* If platform provides early boot printk clock, then use it */ > + if (unlikely(system_state == SYSTEM_BOOTING && boot_printk_clock_fn)) > + return boot_printk_clock_fn(); > + else > + return local_clock(); 'else' is redundant. > +} -- With Best Regards, Andy Shevchenko