From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87506C43387 for ; Wed, 9 Jan 2019 16:32:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 412F22054F for ; Wed, 9 Jan 2019 16:32:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="hZRaa5lV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726469AbfAIQco (ORCPT ); Wed, 9 Jan 2019 11:32:44 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:40683 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbfAIQcn (ORCPT ); Wed, 9 Jan 2019 11:32:43 -0500 Received: by mail-it1-f195.google.com with SMTP id h193so11850996ita.5 for ; Wed, 09 Jan 2019 08:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IBIo32ByRPmxBTL9AaGtSZq85lohSWTcbPLNjN16JkQ=; b=hZRaa5lVc+882BwwPaUmtGmcyGuGKCN1RnSJ+GP0rMtoChXxCXX20WV253RdBGQuoW ZIxuIVDSfaNk/0Iw4anXOVRxAiNba52FpWFYmO36xpe8X/N1w0mpuYl+H1VHp6qDhup3 pbg8da8ScdtkJxBlV7tcg+eq9AYUM7Rj6CaR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IBIo32ByRPmxBTL9AaGtSZq85lohSWTcbPLNjN16JkQ=; b=j9pvgLAjM8drcvwat2pGPsCaeTB8YdbTTKF1EzWzVHRWaej0qGOmLlXnCfAIsjI2QX ddYRo3N8MCDXAlPq7o5FCX01RptG8aKSk2Za5r59qQiszzVg3bwRNeacQJ85tZK5goPq hVr5RdXgyWFmBqpOaf6zeSmcK04Jg01VYE/sFjSicQ7UmRpKdbPpjcP9tdiDrufeeDbD 7rc68hs0uHxFif4nMLqBBIQV7iGoO5RR12sZj9wVF2vW1fi+Wnu2hI8CGZzg5Xcndl+g +o1DK09Mm0x/slNDeRnNVr8jzBVJiN3Jbxod7QukOyhNjlvhwFSdDY3Rz0glES6U4oO1 f4Lw== X-Gm-Message-State: AJcUukcfUzbc0ZSu84mE5MTLYxRVXXLMtR+9bIJhRx+99wemefB2nCWX CU2rKposQ11aVBBvXjFHE7BT3JhUyzEDfPB6SjgtFg== X-Google-Smtp-Source: ALg8bN6JMmbuEHes8OSnSxkfO1p8jaIA83uecfDTyCj/WWccLAgugf2bKV3i49L/2T2UcFUhHnKKqVYQOSsu8y9wOLk= X-Received: by 2002:a02:6019:: with SMTP id i25mr4669057jac.137.1547051562293; Wed, 09 Jan 2019 08:32:42 -0800 (PST) MIME-Version: 1.0 References: <20190108155354.GL5544@atomide.com> <20190108213743.GN5544@atomide.com> <20190109014218.GA8363@linaro.org> <20190109111703.GA28605@lenoch> <20190109115824.GA1353@lenoch> <20190109133337.GA13579@lenoch> <20190109160736.GA7416@lenoch> In-Reply-To: <20190109160736.GA7416@lenoch> From: Vincent Guittot Date: Wed, 9 Jan 2019 17:32:31 +0100 Message-ID: Subject: Re: Regression in v5.0-rc1 with autosuspend hrtimers To: Ladislav Michl Cc: Tony Lindgren , "Rafael J. Wysocki" , Ulf Hansson , "open list:THERMAL" , linux-kernel , LAK , linux-omap@vger.kernel.org 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, 9 Jan 2019 at 17:07, Ladislav Michl wrote: > > On Wed, Jan 09, 2019 at 03:12:25PM +0100, Vincent Guittot wrote: > > Please keep all thread list when replying :-) > > Ahh, sorry for that... > [snip] > > On Wed, 9 Jan 2019 at 14:33, Ladislav Michl wrote: > > > I agree, but it doea all the magic correctly, so you won't need > > > to touch that code is ktime_t changes (I know, unlikely..) > > > > But the current implementation doesn't care of any changes in ktime_t > > as it uses raw ns > > Fair enough, so let's go back to: This one looks good for me > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > index 70624695b6d5..e61ee9b47a26 100644 > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -121,7 +121,7 @@ static void pm_runtime_cancel_pending(struct device *dev) > * Compute the autosuspend-delay expiration time based on the device's > * power.last_busy time. If the delay has already expired or is disabled > * (negative) or the power.use_autosuspend flag isn't set, return 0. > - * Otherwise return the expiration time in jiffies (adjusted to be nonzero). > + * Otherwise return the expiration time in nanoseconds (adjusted to be nonzero). > * > * This function may be called either with or without dev->power.lock held. > * Either way it can be racy, since power.last_busy may be updated at any time. > @@ -129,24 +129,21 @@ static void pm_runtime_cancel_pending(struct device *dev) > u64 pm_runtime_autosuspend_expiration(struct device *dev) > { > int autosuspend_delay; > - u64 last_busy, expires = 0; > - u64 now = ktime_to_ns(ktime_get()); > + u64 expires; > > if (!dev->power.use_autosuspend) > - goto out; > + return 0; > > autosuspend_delay = READ_ONCE(dev->power.autosuspend_delay); > if (autosuspend_delay < 0) > - goto out; > - > - last_busy = READ_ONCE(dev->power.last_busy); > + return 0; > > - expires = last_busy + autosuspend_delay * NSEC_PER_MSEC; > - if (expires <= now) > - expires = 0; /* Already expired. */ > + expires = READ_ONCE(dev->power.last_busy); > + expires += NSEC_PER_MSEC * (u64)autosuspend_delay; > + if (expires > ktime_to_ns(ktime_get())) > + return expires; /* Expires in the future */ > > - out: > - return expires; > + return 0; > } > EXPORT_SYMBOL_GPL(pm_runtime_autosuspend_expiration); > > Which gives for arm: > 00000480 : > 480: e92d41f0 push {r4, r5, r6, r7, r8, lr} > 484: e5d030d1 ldrb r3, [r0, #209] ; 0xd1 > 488: e3130004 tst r3, #4 > 48c: 0a00000c beq 4c4 > 490: e59030e4 ldr r3, [r0, #228] ; 0xe4 > 494: e3530000 cmp r3, #0 > 498: ba000009 blt 4c4 > 49c: e28050e8 add r5, r0, #232 ; 0xe8 > 4a0: e8950030 ldm r5, {r4, r5} > 4a4: e59f2030 ldr r2, [pc, #48] ; 4dc > 4a8: e0e54392 smlal r4, r5, r2, r3 > 4ac: ebfffffe bl 0 > 4b0: e1550001 cmp r5, r1 > 4b4: 01540000 cmpeq r4, r0 > 4b8: e1a06004 mov r6, r4 > 4bc: e1a07005 mov r7, r5 > 4c0: 8a000001 bhi 4cc > 4c4: e3a06000 mov r6, #0 > 4c8: e3a07000 mov r7, #0 > 4cc: e1a00006 mov r0, r6 > 4d0: e1a01007 mov r1, r7 > 4d4: e8bd41f0 pop {r4, r5, r6, r7, r8, lr} > 4d8: e12fff1e bx lr > 4dc: 000f4240 .word 0x000f4240 > > And x86: > 0000000000000230 : > 230: 8b 87 a4 01 00 00 mov 0x1a4(%rdi),%eax > 236: 53 push %rbx > 237: 85 c0 test %eax,%eax > 239: 78 1e js 259 > 23b: 48 63 d8 movslq %eax,%rbx > 23e: 48 8b 97 a8 01 00 00 mov 0x1a8(%rdi),%rdx > 245: 48 69 db 40 42 0f 00 imul $0xf4240,%rbx,%rbx > 24c: 48 01 d3 add %rdx,%rbx > 24f: e8 00 00 00 00 callq 254 > 254: 48 39 c3 cmp %rax,%rbx > 257: 77 02 ja 25b > 259: 31 db xor %ebx,%ebx > 25b: 48 89 d8 mov %rbx,%rax > 25e: 5b pop %rbx > 25f: c3 retq > > 00000000000002a0 : > 2a0: f6 87 91 01 00 00 04 testb $0x4,0x191(%rdi) > 2a7: 74 02 je 2ab > 2a9: eb 85 jmp 230 > 2ab: 31 c0 xor %eax,%eax > 2ad: c3 retq > 2ae: 66 90 xchg %ax,%ax > > > [snip] > > > Well, main concern was not to call ktime_get at the beginning of function > > > as it is not too cheap. > > > > Doesn't the compiler optimize that to just before the test ? > > No (compare with above). And it is also almost certain that someone will run > script and send "...do not needlesly initialize..." patch :) > > gcc version 8.2.1 20181130 (OSELAS.Toolchain-2018.12.0 8-20181130) > > 00000110 : > 110: e92d41f0 push {r4, r5, r6, r7, r8, lr} > 114: e1a06000 mov r6, r0 > 118: ebfffffe bl 0 > 11c: e5d630d1 ldrb r3, [r6, #209] ; 0xd1 > 120: e3130004 tst r3, #4 > 124: 0a00000d beq 160 > 128: e596c0e4 ldr ip, [r6, #228] ; 0xe4 > 12c: e35c0000 cmp ip, #0 > 130: ba00000a blt 160 > 134: e28630e8 add r3, r6, #232 ; 0xe8 > 138: e893000c ldm r3, {r2, r3} > 13c: e1a05001 mov r5, r1 > 140: e1a04000 mov r4, r0 > 144: e59f002c ldr r0, [pc, #44] ; 178 > 148: e0010c90 mul r1, r0, ip > 14c: e0926001 adds r6, r2, r1 > 150: e0a37fc1 adc r7, r3, r1, asr #31 > 154: e1550007 cmp r5, r7 > 158: 01540006 cmpeq r4, r6 > 15c: 3a000001 bcc 168 > 160: e3a06000 mov r6, #0 > 164: e3a07000 mov r7, #0 > 168: e1a00006 mov r0, r6 > 16c: e1a01007 mov r1, r7 > 170: e8bd41f0 pop {r4, r5, r6, r7, r8, lr} > 174: e12fff1e bx lr > 178: 000f4240 .word 0x000f4240 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BDBBC43387 for ; Wed, 9 Jan 2019 16:32:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDBFC2054F for ; Wed, 9 Jan 2019 16:32:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QSVMnjJA"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="hZRaa5lV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDBFC2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nitw9QPKOsAW2Y3loyFv67FWnJ0GTJyMc6Whb8nsQyE=; b=QSVMnjJAXq/iFm 7LDALZI4tsdlfNMdKTH+Oclkg+OzFo6f+KiEQDmyErn0fC9EoZIljtT5YktKWGhOt6uNn64bI2guy hbJnwNy1P3qgcf/9tt8FfRPGk7p97OM6JMckiAL3bgVSJbcA4xZnmuj698ouoznT/7noxxo8jDIe2 DXDatwqyx3tvUZNP7vNeputV/bGyCxinF8kk0oxR74RM7sIwDNRjsXbat99BGldvRXlwmzqM8SDaT AXedNiAA7mmQDF701CIZykCsKcVY/8ZMrPq7wRBJkGMLaTlO5Fvu+mg5UmO49iw87j1s1MpDaT4vH +njqHOe0VuxzmjwdzZdQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghGmd-0003n6-Ae; Wed, 09 Jan 2019 16:32:47 +0000 Received: from mail-it1-x144.google.com ([2607:f8b0:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghGmZ-0003mc-Ub for linux-arm-kernel@lists.infradead.org; Wed, 09 Jan 2019 16:32:45 +0000 Received: by mail-it1-x144.google.com with SMTP id h193so11850995ita.5 for ; Wed, 09 Jan 2019 08:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IBIo32ByRPmxBTL9AaGtSZq85lohSWTcbPLNjN16JkQ=; b=hZRaa5lVc+882BwwPaUmtGmcyGuGKCN1RnSJ+GP0rMtoChXxCXX20WV253RdBGQuoW ZIxuIVDSfaNk/0Iw4anXOVRxAiNba52FpWFYmO36xpe8X/N1w0mpuYl+H1VHp6qDhup3 pbg8da8ScdtkJxBlV7tcg+eq9AYUM7Rj6CaR8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IBIo32ByRPmxBTL9AaGtSZq85lohSWTcbPLNjN16JkQ=; b=W1x+q6ZK7lly2mB9f3leJgGzctOQPPn/0oXP+50APsI7jxSJHShkY9xWS5XMy30A73 505EnaaZsJRi5MnIMGdo1pEhd8IIYbLK5u+6I/RKn39UeRcGBvqk8AKRsw7SQMH2FniN bzpc7Q1geh7N+szaLjQnig5Bc+Q5lkLgkcBpdnE4T6rwyPfGZKPqnzgLV2XVrnEtMPph B5yASGlpIN6t2L2AoUtkZhq96lgAEE0/GMfIudrQBJvQXtaJVjq6XSwlTKlu+V18TJHz Mkck49Zd60BYlwdYWomWFxMaE0Wdq8+thLDVkvMQbNNGJplP4bJ0NzCqTG0OIFBnQ5vX cXRQ== X-Gm-Message-State: AJcUukddK6RGmws5lNZKJonKhy5zVAbX40rUkmHrI1pImuNe1TmGhlfB 9LGWz0pfNxxfnXY7VnWADlCIyPbA6j9ItZwta8Z9jA== X-Google-Smtp-Source: ALg8bN6JMmbuEHes8OSnSxkfO1p8jaIA83uecfDTyCj/WWccLAgugf2bKV3i49L/2T2UcFUhHnKKqVYQOSsu8y9wOLk= X-Received: by 2002:a02:6019:: with SMTP id i25mr4669057jac.137.1547051562293; Wed, 09 Jan 2019 08:32:42 -0800 (PST) MIME-Version: 1.0 References: <20190108155354.GL5544@atomide.com> <20190108213743.GN5544@atomide.com> <20190109014218.GA8363@linaro.org> <20190109111703.GA28605@lenoch> <20190109115824.GA1353@lenoch> <20190109133337.GA13579@lenoch> <20190109160736.GA7416@lenoch> In-Reply-To: <20190109160736.GA7416@lenoch> From: Vincent Guittot Date: Wed, 9 Jan 2019 17:32:31 +0100 Message-ID: Subject: Re: Regression in v5.0-rc1 with autosuspend hrtimers To: Ladislav Michl X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190109_083244_005210_DD1617F1 X-CRM114-Status: GOOD ( 24.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , "open list:THERMAL" , Tony Lindgren , "Rafael J. Wysocki" , linux-kernel , linux-omap@vger.kernel.org, LAK Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 9 Jan 2019 at 17:07, Ladislav Michl wrote: > > On Wed, Jan 09, 2019 at 03:12:25PM +0100, Vincent Guittot wrote: > > Please keep all thread list when replying :-) > > Ahh, sorry for that... > [snip] > > On Wed, 9 Jan 2019 at 14:33, Ladislav Michl wrote: > > > I agree, but it doea all the magic correctly, so you won't need > > > to touch that code is ktime_t changes (I know, unlikely..) > > > > But the current implementation doesn't care of any changes in ktime_t > > as it uses raw ns > > Fair enough, so let's go back to: This one looks good for me > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > index 70624695b6d5..e61ee9b47a26 100644 > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -121,7 +121,7 @@ static void pm_runtime_cancel_pending(struct device *dev) > * Compute the autosuspend-delay expiration time based on the device's > * power.last_busy time. If the delay has already expired or is disabled > * (negative) or the power.use_autosuspend flag isn't set, return 0. > - * Otherwise return the expiration time in jiffies (adjusted to be nonzero). > + * Otherwise return the expiration time in nanoseconds (adjusted to be nonzero). > * > * This function may be called either with or without dev->power.lock held. > * Either way it can be racy, since power.last_busy may be updated at any time. > @@ -129,24 +129,21 @@ static void pm_runtime_cancel_pending(struct device *dev) > u64 pm_runtime_autosuspend_expiration(struct device *dev) > { > int autosuspend_delay; > - u64 last_busy, expires = 0; > - u64 now = ktime_to_ns(ktime_get()); > + u64 expires; > > if (!dev->power.use_autosuspend) > - goto out; > + return 0; > > autosuspend_delay = READ_ONCE(dev->power.autosuspend_delay); > if (autosuspend_delay < 0) > - goto out; > - > - last_busy = READ_ONCE(dev->power.last_busy); > + return 0; > > - expires = last_busy + autosuspend_delay * NSEC_PER_MSEC; > - if (expires <= now) > - expires = 0; /* Already expired. */ > + expires = READ_ONCE(dev->power.last_busy); > + expires += NSEC_PER_MSEC * (u64)autosuspend_delay; > + if (expires > ktime_to_ns(ktime_get())) > + return expires; /* Expires in the future */ > > - out: > - return expires; > + return 0; > } > EXPORT_SYMBOL_GPL(pm_runtime_autosuspend_expiration); > > Which gives for arm: > 00000480 : > 480: e92d41f0 push {r4, r5, r6, r7, r8, lr} > 484: e5d030d1 ldrb r3, [r0, #209] ; 0xd1 > 488: e3130004 tst r3, #4 > 48c: 0a00000c beq 4c4 > 490: e59030e4 ldr r3, [r0, #228] ; 0xe4 > 494: e3530000 cmp r3, #0 > 498: ba000009 blt 4c4 > 49c: e28050e8 add r5, r0, #232 ; 0xe8 > 4a0: e8950030 ldm r5, {r4, r5} > 4a4: e59f2030 ldr r2, [pc, #48] ; 4dc > 4a8: e0e54392 smlal r4, r5, r2, r3 > 4ac: ebfffffe bl 0 > 4b0: e1550001 cmp r5, r1 > 4b4: 01540000 cmpeq r4, r0 > 4b8: e1a06004 mov r6, r4 > 4bc: e1a07005 mov r7, r5 > 4c0: 8a000001 bhi 4cc > 4c4: e3a06000 mov r6, #0 > 4c8: e3a07000 mov r7, #0 > 4cc: e1a00006 mov r0, r6 > 4d0: e1a01007 mov r1, r7 > 4d4: e8bd41f0 pop {r4, r5, r6, r7, r8, lr} > 4d8: e12fff1e bx lr > 4dc: 000f4240 .word 0x000f4240 > > And x86: > 0000000000000230 : > 230: 8b 87 a4 01 00 00 mov 0x1a4(%rdi),%eax > 236: 53 push %rbx > 237: 85 c0 test %eax,%eax > 239: 78 1e js 259 > 23b: 48 63 d8 movslq %eax,%rbx > 23e: 48 8b 97 a8 01 00 00 mov 0x1a8(%rdi),%rdx > 245: 48 69 db 40 42 0f 00 imul $0xf4240,%rbx,%rbx > 24c: 48 01 d3 add %rdx,%rbx > 24f: e8 00 00 00 00 callq 254 > 254: 48 39 c3 cmp %rax,%rbx > 257: 77 02 ja 25b > 259: 31 db xor %ebx,%ebx > 25b: 48 89 d8 mov %rbx,%rax > 25e: 5b pop %rbx > 25f: c3 retq > > 00000000000002a0 : > 2a0: f6 87 91 01 00 00 04 testb $0x4,0x191(%rdi) > 2a7: 74 02 je 2ab > 2a9: eb 85 jmp 230 > 2ab: 31 c0 xor %eax,%eax > 2ad: c3 retq > 2ae: 66 90 xchg %ax,%ax > > > [snip] > > > Well, main concern was not to call ktime_get at the beginning of function > > > as it is not too cheap. > > > > Doesn't the compiler optimize that to just before the test ? > > No (compare with above). And it is also almost certain that someone will run > script and send "...do not needlesly initialize..." patch :) > > gcc version 8.2.1 20181130 (OSELAS.Toolchain-2018.12.0 8-20181130) > > 00000110 : > 110: e92d41f0 push {r4, r5, r6, r7, r8, lr} > 114: e1a06000 mov r6, r0 > 118: ebfffffe bl 0 > 11c: e5d630d1 ldrb r3, [r6, #209] ; 0xd1 > 120: e3130004 tst r3, #4 > 124: 0a00000d beq 160 > 128: e596c0e4 ldr ip, [r6, #228] ; 0xe4 > 12c: e35c0000 cmp ip, #0 > 130: ba00000a blt 160 > 134: e28630e8 add r3, r6, #232 ; 0xe8 > 138: e893000c ldm r3, {r2, r3} > 13c: e1a05001 mov r5, r1 > 140: e1a04000 mov r4, r0 > 144: e59f002c ldr r0, [pc, #44] ; 178 > 148: e0010c90 mul r1, r0, ip > 14c: e0926001 adds r6, r2, r1 > 150: e0a37fc1 adc r7, r3, r1, asr #31 > 154: e1550007 cmp r5, r7 > 158: 01540006 cmpeq r4, r6 > 15c: 3a000001 bcc 168 > 160: e3a06000 mov r6, #0 > 164: e3a07000 mov r7, #0 > 168: e1a00006 mov r0, r6 > 16c: e1a01007 mov r1, r7 > 170: e8bd41f0 pop {r4, r5, r6, r7, r8, lr} > 174: e12fff1e bx lr > 178: 000f4240 .word 0x000f4240 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel