Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2291145pxb; Wed, 9 Feb 2022 15:19:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+FrSmsLPw0XDVgNuSvkFs9RIo2xre1tEkUju6KEEesghBPJq7YzZxtmdNYzxNNrgacQB5 X-Received: by 2002:a17:903:110c:: with SMTP id n12mr4850092plh.163.1644448758797; Wed, 09 Feb 2022 15:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644448758; cv=none; d=google.com; s=arc-20160816; b=bJTXzj1pUr20N25uGash7hxZ1xQPAzUHgTLlUri3vwVQIeYZ8Gg/+CRaT+vM15yMtn igr0X4ryImHfdIJrCT5JL1SYV6dVYQAt2WyHcx8MPt/gErad23Mrkb7mLDjfGrrOgVb8 8tD3wTP0XTyV6pMR2Nsj1bNE7rxnlQZsKSrLNUY8/ECs4kpNozxxHoVP90tQfYah/jsX lRLJy2UqU4hDL1bCthahDHtp0HwZEHEatULlsI5sORZxjOruJteKWjdVSsyZVva6uHh8 DjaOoawO5LiOEwZjlAxWW46ADptqr8Ube+uJiJaAzYl4FkHdXkXvscScZhgmSBsYr3OJ WKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=G4Vjp3ISdYeY8fzvSFlPeRWv5ed2FS1oG8JSf5nd0SI=; b=Pb+hyq8+HBlPR1CjriCUrpQ9ifxCqC6wa9B3H2OJXHGx3/A1kobUuHh4bMGL9Bqidn HnWxOOSJS5D48tLeHaAU/0XGSJdORosK48cWS5D4bFbSz7n6Y+Z7Avj1RDOB8N1iHiQ1 53ZEl1HXcUvjVcbXTQNn4Z8tX6maGrSlvy7T6WlaNcY93j3KbdwfhAaewndoGxjgo+X5 rgl+C8dFszra5ZMIeJB7N2Yr00txe/Uc/2O8FS2qOT2e6mHLEHIZD87x5J3CFNAytYSC uzdqeMgTkN4LpVbUQ3hFnjNNjGGTnVD3IshAe/NFDNrL2yVe8MwuOWgJHlNbgcRz2itA IUTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A2FS0a6d; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h23si17306945pgb.402.2022.02.09.15.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 15:19:18 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A2FS0a6d; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7F17E05381F; Wed, 9 Feb 2022 15:16:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234100AbiBIVyt (ORCPT + 99 others); Wed, 9 Feb 2022 16:54:49 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbiBIVyr (ORCPT ); Wed, 9 Feb 2022 16:54:47 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B9AD6C0F8692 for ; Wed, 9 Feb 2022 13:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644443689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G4Vjp3ISdYeY8fzvSFlPeRWv5ed2FS1oG8JSf5nd0SI=; b=A2FS0a6d2G9hm6VIn5H7aBkDn3D0hSlTMuygs6HOx2WK0rVx/x5v3d/cV+WuROBngCRn3t dGvVySRu9z1UhC07sJaoHifQPZAYhE+qjXyI5PZz8nVEJWGUnxpUQgVwyF4oTdpXtQCAuf a6iDl+ztYlzTuK/s8ggxTmmPKQpn9IQ= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-135-BF1fIRiiOum0U1YYNO03KQ-1; Wed, 09 Feb 2022 16:54:48 -0500 X-MC-Unique: BF1fIRiiOum0U1YYNO03KQ-1 Received: by mail-qt1-f198.google.com with SMTP id w25-20020ac84d19000000b002d2966d66a8so2758143qtv.18 for ; Wed, 09 Feb 2022 13:54:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=G4Vjp3ISdYeY8fzvSFlPeRWv5ed2FS1oG8JSf5nd0SI=; b=EOIgoP8Ngkb0lVvc9CoS3fo9vTpVhmh6IZFAv/GnoSL7prb9cvNRK70ZiGlE4Uji0E Dhwfz+aD6JKZYyRm2MVZrAIoPyQTk58+GWqJav3o1WVOeA1dvEnYSNA4oMdcvBoi7Gfk 0oYjMq6ZNI11tGtXiXhytaAtBx34/aXWkeUUAe3i1sNRG9UBLAosjSqFH599tH68DfNX 2OLHM8lR+xFxiBURXAPrQPWlvrS/6Q2y+aMbU3N73eOXDjtMK2DBWQH5CzA/tq2ImhaP SXAOccRVZou+GKlljjOV63eg0yqAItWtgSHBsL1F0EGwXaN39NiADcgcSgPtXjglLW0i G3FQ== X-Gm-Message-State: AOAM532389bZMflv1k/kn0jNM89IGOI5xHE6yuYheRoqKATztEI4Bm+y oG7thYD66jCiecos055eUKTdsEgFZNSztNcsjTaEa4XsVY1vP5PuT6ZAyOrPEYCgV7w+dU/Ic5D +APFDQzl7bKSCsZdwpDsu0UwE X-Received: by 2002:a05:622a:296:: with SMTP id z22mr2881541qtw.13.1644443688305; Wed, 09 Feb 2022 13:54:48 -0800 (PST) X-Received: by 2002:a05:622a:296:: with SMTP id z22mr2881528qtw.13.1644443688085; Wed, 09 Feb 2022 13:54:48 -0800 (PST) Received: from halaneylaptop (068-184-200-203.res.spectrum.com. [68.184.200.203]) by smtp.gmail.com with ESMTPSA id d11sm9667430qtd.63.2022.02.09.13.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 13:54:47 -0800 (PST) Date: Wed, 9 Feb 2022 15:54:44 -0600 From: Andrew Halaney To: Mark-PK Tsai Cc: rostedt@goodmis.org, matthias.bgg@gmail.com, akpm@linux-foundation.org, mhiramat@kernel.org, vbabka@suse.cz, wangkefeng.wang@huawei.com, linux@rasmusvillemoes.dk, keescook@chromium.org, valentin.schneider@arm.com, peterz@infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, yj.chiang@mediatek.com Subject: Re: [PATCH] init: Use ktime_us_delta() to make initcall_debug log more precise Message-ID: <20220209215444.sxuxutqwcyisbbld@halaneylaptop> References: <20220209053350.15771-1-mark-pk.tsai@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220209053350.15771-1-mark-pk.tsai@mediatek.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 09, 2022 at 01:33:50PM +0800, Mark-PK Tsai wrote: > Use ktime_us_delta() to make the initcall_debug log more precise than > right shifting the result of ktime_to_ns() by 10 bits. > > Signed-off-by: Mark-PK Tsai > --- > init/main.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/init/main.c b/init/main.c > index 65fa2e41a9c0..c8edcc3029b1 100644 > --- a/init/main.c > +++ b/init/main.c > @@ -1246,15 +1246,11 @@ trace_initcall_start_cb(void *data, initcall_t fn) > static __init_or_module void > trace_initcall_finish_cb(void *data, initcall_t fn, int ret) > { > - ktime_t *calltime = (ktime_t *)data; > - ktime_t delta, rettime; > - unsigned long long duration; > + ktime_t rettime, *calltime = (ktime_t *)data; > > rettime = ktime_get(); > - delta = ktime_sub(rettime, *calltime); > - duration = (unsigned long long) ktime_to_ns(delta) >> 10; > printk(KERN_DEBUG "initcall %pS returned %d after %lld usecs\n", > - fn, ret, duration); > + fn, ret, (unsigned long long)ktime_us_delta(rettime, *calltime)); > } > > static ktime_t initcall_calltime; > -- > 2.18.0 > I took this for a spin while playing around with other things today, cleans things up nicely imo. Reviewed-by: Andrew Halaney Tested-by: Andrew Halaney