Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4527077imm; Wed, 30 May 2018 07:16:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKunOErYwrF/rELU1+hsythGvIirgyWK4J916xNidzmsQy9pWigktkj9M7zDsiu3O00J9XR X-Received: by 2002:a63:6bc7:: with SMTP id g190-v6mr2399323pgc.230.1527689801156; Wed, 30 May 2018 07:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527689801; cv=none; d=google.com; s=arc-20160816; b=aAb+bRRjCz4UpFgctTSUj97yYxM8I8UBHBE0gEe08ivFmIH8Gi5vdy0WizgVtCf2Xb JBUlsLAv/XOork2Q2Zo7YDTTHimSx2lIZLLtwELluR7tUb2vZkuMJ7F2yW2cAoq6khGz 4y2W256MUPseVoKVaeweMTpSCRT6j3rD5bIDTFAHkoxUD87pOT+xLDswB/psRl0BhbGR vlYCsh4BRP05+wvmr6CXP/HHqfd2TcepUEwYOrxwy5w+04tJEx0nNuuXSINIwUw2eW1x /qirI9ow6FRZpSCIPt1Lz8IdenukVx1Kj1jU+/X5nlwRnRDv23sjPMIh02sg3YFBzLxc v/Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/7c1Ucin5NZJ0v96FN155nGgzmGRpZYQP0NA+AyYT24=; b=InqDb5TY7MXFh4WCvk7ZCPhEy7e4q/vnKB19sCucJ31jlH0Ps614r41fWg7wvKnUSb B+UjlS8/zVGh7Fu/K8wMFxyZ9Xd7SMQQQdA6NR7L7budqjGgcS02X1nlAIqdnbPOy+Mf 82xGTJCfxKNuC65owFdXDrlu2mw/zawn2RQwu8k2vdYhkYIh7p6m1mbhrRVKWsZP2ICe NRMtfnNDuQH/kmLPHK9f5T3/XuVwxpTWCZ7TNo9DzL3E7kq0aCt2xRCljht3KbQYVEml qHr6kmqNAD5ZKT/6/l7GyqwFE+fEeRovZ5noTtsZVfOUw8yL+8leoMXrDx/DV0lPKE8a Eq2A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si33895811plw.299.2018.05.30.07.16.25; Wed, 30 May 2018 07:16:41 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753041AbeE3OP6 (ORCPT + 99 others); Wed, 30 May 2018 10:15:58 -0400 Received: from mga03.intel.com ([134.134.136.65]:16177 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbeE3OP5 (ORCPT ); Wed, 30 May 2018 10:15:57 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 May 2018 07:15:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,460,1520924400"; d="scan'208";a="58915787" Received: from shbuild888.sh.intel.com (HELO localhost) ([10.239.146.239]) by fmsmga004.fm.intel.com with ESMTP; 30 May 2018 07:15:55 -0700 Date: Wed, 30 May 2018 22:17:29 +0800 From: Feng Tang To: Andy Shevchenko Cc: Petr Mladek , Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , Alan Cox , Peter Zijlstra , Linux Kernel Mailing List , alek.du@intel.com Subject: Re: [RFC 2/2] x86, tsc: Enable clock for ealry printk timestamp Message-ID: <20180530141729.5xulqmhjibynbm5d@shbuild888> References: <1527672059-6225-1-git-send-email-feng.tang@intel.com> <1527672059-6225-2-git-send-email-feng.tang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, Thanks for the review. On Wed, May 30, 2018 at 04:25:07PM +0300, Andy Shevchenko wrote: > On Wed, May 30, 2018 at 12:20 PM, Feng Tang wrote: > > To show time info in kernel log earlier and help optimizing kernel > > boot time, printk adds a debug hook "boot_printk_clock_fn()" for > > capable platform which has accurate clock in early boot phase. > > > > This patch will add early param setup option, so that user can > > chose to provide a tsc based early printk clock simply by adding > > in command line: "boot_tsc=xxxxM" (xxxxM is the stable TSC freq). > > > + > > This line is not needed. Ok, will remove it. > > > + cur_tsc = rdtsc(); > > + cur_tsc -= boot_tsc_offset; > > In one expression? Agree > > > + if (!p) > > + return -EINVAL; > > + > > I'm not sure it's needed at all. > > > + boot_tsc_mhz = div64_u64(tsc_hz, 1024 * 1024); > > Hmm... 1024*1024 != 1000 * 1000. So, hz -> mhz here (as by suffixes) > looks weird. The memparse is mostly for memory stuff which takes 1M as 1024*1024, but for TSC frequency 1M means 1000*1000, and the code is trying to do some awkward translation. But you are right, this code will break if user doesn't use expression with 'm". > > > + if (boot_tsc_mhz == 0) > > + return -EINVAL; > > > + pr_info("TSC has run for %lld us\n", > > + div64_u64(boot_tsc_offset, boot_tsc_mhz)); > > + > > + /* Setup the early printk clock */ > > + boot_printk_clock_fn = boot_tsc_clock; > > > + pr_info("TSC: Setup early printk timestamp with %lldM TSC.", > > + boot_tsc_mhz); > > Perhaps remove period (above doesn't have it) and move this to one line? You mean merge the two pr_info line? yes, we can do that. Thanks, Feng