Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4476775imm; Wed, 30 May 2018 06:26:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKGO+401xM2z2b6vreIkuiEfovjNAsQdWA4wVw4RegV+8sryfGvhjp4BG1ngbmrTnn+6k4d X-Received: by 2002:a62:418b:: with SMTP id g11-v6mr2793113pfd.51.1527686796894; Wed, 30 May 2018 06:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527686796; cv=none; d=google.com; s=arc-20160816; b=vRpwW6cRjVS0Gjh6nr1w3G1xJgIHu4XN2mV3EfLhvaCnTP5Qjcvl0peti02fheuyU0 s5N04VbQLHhfRnC6bBrtIkRTs78+jvtak302gieSI9gvIN0cf6D6dKoG3LmCcLTm6N67 S9F3q7gCrms0JOh2cREStkv9JBBfmoo5dZx8dDxaj6fYBm17/8TLEg5VONygvpg5105/ xYV7GU9rWW5hhX2Q/3wzmIH+3GqsoLA1rZ3nu+ySvJT306lXd3qzQ7Zb27T9Krc4Gm/P jULQQNELcrgSPYDt3WUN69PhJnBqEDBNdcSurd2BR+SGeg7YrrmOxN+HWkyuc6PIUSS8 T9lw== 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=WVnJGcD6fYXuTR50ILJbL8YX61jWrNsVuoLq8+hAsS4=; b=l7eCzG4eeCOBbWHNC8rWorGbZ1tsfibVcrFEz4HvRhxgQOnT+Ilm7ktOj1yC3QmjrN I4FZ17nMOx+oNzRj+N+CJhrz+8cerSLSXGpIukeLPsarBTZlAay/7a+vxePPQwQATJg/ S8Qif/XzW3xLyC/6H6AtyWn1jwrIlZUSb4t3kCwoc8j05kzyICMZhFI/wRFnx2fcu9Ys 3TvJNFa/+NEGiimOcSlObL5tGrUNgixZmH4ZNZ4+IOxGdVNBmqXJrfsZTaOi5OZa7NxL 9IMgb+24QEfymIWJm1ONL03O31CgwQlLPf/AGHsYxi8fbSsao1KjanSGIdMCUckWITWD RDDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NPNMsgqv; 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 g10-v6si30118689plq.523.2018.05.30.06.26.22; Wed, 30 May 2018 06:26:36 -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=NPNMsgqv; 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 S1753311AbeE3NZL (ORCPT + 99 others); Wed, 30 May 2018 09:25:11 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:37633 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbeE3NZI (ORCPT ); Wed, 30 May 2018 09:25:08 -0400 Received: by mail-qt0-f195.google.com with SMTP id q13-v6so23174480qtp.4 for ; Wed, 30 May 2018 06:25:08 -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=WVnJGcD6fYXuTR50ILJbL8YX61jWrNsVuoLq8+hAsS4=; b=NPNMsgqvTr0vwmwN5XvLgwWFdyELXfruFNCGwSD/PmNX7l+e3N8PzEY4OCzKwSGDB7 fvxb6aspkHuHVUKuRZQgTXHPUM4sOgT4ZwVx6mI+WkkwpkUIuWKar5Tcw4fL3sASCEbY 2KAHNXZUe6SZcK2LXGmM9YW5rliOhKK8jgYM52VIWC5yjQSTWlvbeTt/GMYLZntvU3mH /JjOLXhsBjtLY3P5COJBTu/Xj0mn9rCTLZGLM6zZjGw2V6LtqPgmBTQiyk14KhCoP5if W5LaLmRIH9b5AXDRQ5DcIjLu6kjt34LVslL8ymzN0UoF+z4MJLWhyKOiV9KkFdCP9Oq0 l7yg== 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=WVnJGcD6fYXuTR50ILJbL8YX61jWrNsVuoLq8+hAsS4=; b=iyJfO4uQ4Xn3k9Ifmsb5Ywp3L76TGSAUHnrcT0EEMiTXSY1pEK8DCovBU8D5BQUweU i3MBdFyuwPUBaxLsuq1NvcLK/2bOaslpZrfXD3EqrG+1RWskLPzJ20yT66PUAxBWNDfn iePsJhO5i1G2rVevgDGEFS3shwLGwxO/y3NUzbh+HgrZ5xIWfLIdlkoPMotnNBh3nrli WJJgd6maq2HPFCgdR5/VHWdndAbHX/OBqgerKAvJB+iBgpXlocLw0hdqUANrW75Bu9um zuI5Q08SlW9CoLGo3GoilnCW3L0O5xjYJMWdlYL/Zov0mRqpjvGukw79jazlzoxMaFsg ZWjQ== X-Gm-Message-State: APt69E3SdWP7p7IGRrNXFhUmaQuHYQK/PVxVGxK8TAYOe/D/Kl04yJyb /lBDaETx7TmqCCS3WJwUPRXRaszW9xJFD4DmmBE= X-Received: by 2002:aed:2c43:: with SMTP id f61-v6mr2414607qtd.105.1527686708203; Wed, 30 May 2018 06:25:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9896:0:0:0:0:0 with HTTP; Wed, 30 May 2018 06:25:07 -0700 (PDT) In-Reply-To: <1527672059-6225-2-git-send-email-feng.tang@intel.com> References: <1527672059-6225-1-git-send-email-feng.tang@intel.com> <1527672059-6225-2-git-send-email-feng.tang@intel.com> From: Andy Shevchenko Date: Wed, 30 May 2018 16:25:07 +0300 Message-ID: Subject: Re: [RFC 2/2] x86, tsc: Enable clock for ealry printk timestamp 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: > 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. > + cur_tsc = rdtsc(); > + cur_tsc -= boot_tsc_offset; In one expression? > + 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. > + 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? -- With Best Regards, Andy Shevchenko