Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3116219rwp; Fri, 14 Jul 2023 18:05:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+NpP00wiKff+2RTha0FExzDhgLspop6hrdg7lEIO5fCAxAVFY3Ne96YTJ6JdsTMQqs2Au X-Received: by 2002:a17:902:e54c:b0:1a6:6bdb:b548 with SMTP id n12-20020a170902e54c00b001a66bdbb548mr676249plf.1.1689383135929; Fri, 14 Jul 2023 18:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689383135; cv=none; d=google.com; s=arc-20160816; b=If7Z2IadhAhof8liSunro3z1FTnrYzqvcBfYZm/x53+gfXHqINwYQUSHgBvbBzhTfd llv3u9apDJqjj6rNdfvo1/qleJDCgBivdxVenJwuj0lvRzNn2E9UB2cy3/7QGT1UYi+J I2gA+ks5d743hG9T5OEG5DWOnUzHGqurtM32PUbBuq1kim7lkxE796yxpOLxLSneeDTd hfE7w3fyAHf2Yjn8psxlGQlapsINupJOTIMts7J5SRD25scR/t/WAWmy8fI+pu/bt5RL iXOANytPq/bNV/73LDYxOZJV8F+aLqBD3Ia+nVEAJNvuI1cWvloCV7mvoHx9LS4eBOrX Gxjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BaQZCie538sj4krllk6/qjbG50accgvQVGSms7oqFVs=; fh=UqIamuNEunWz7LMhPcBP+KrudFxxg+DBDz5aeZWaUjc=; b=PfE3YbhIbNyH8nAAH20TlA+zhLR/ABRCqOssssg+pO/qkNgMKDeNy4UugJEi2CDU1/ dwkvm9RRjC4p+h4nppvU2onv5T4Gdnj0B0h4eVPyPaMLLH1hkEqdRW86Uqp/qWTTVoZs /OWUUJ714nyhvA2w8h5lrvm5aJ7o6KsdIAIEW4d11PPJ5//smQfkEVrqxuCt3yJtNreB o9G9uGVchTN8qDc+as6Ujz52zcpcLuNzTE/GX6pgsJNI81ddgsAKxS5Pu2yEyC6ay+C4 cdxTdsVUj+vAEDDmGac6vH8YCwzzzwLCK2F9F7cT0bUcei5m70Wj/dX5qk3pxc562AKa xBIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=SqqRhesN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a170902d2c700b001b89b1bae72si8319563plc.528.2023.07.14.18.05.23; Fri, 14 Jul 2023 18:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=SqqRhesN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbjGOBDP (ORCPT + 99 others); Fri, 14 Jul 2023 21:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbjGOBC5 (ORCPT ); Fri, 14 Jul 2023 21:02:57 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B27713A9C for ; Fri, 14 Jul 2023 18:02:56 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b70bfc8db5so38734181fa.2 for ; Fri, 14 Jul 2023 18:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1689382975; x=1691974975; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BaQZCie538sj4krllk6/qjbG50accgvQVGSms7oqFVs=; b=SqqRhesNIM9U2HFUGXehPvzNYVQyZEYtbRbVRh1ZXiYBsNT4lrJZgwupXE+NNbs23N zVMKsDNT1QxOwO0gh585ZONx9DbQgh1s7TPH/U3KtA530+XDxC45FA76WyifbabVZmwy 5jqbm0tuFy3moCN33xVNMXdprmC8RzEDsKPa4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689382975; x=1691974975; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BaQZCie538sj4krllk6/qjbG50accgvQVGSms7oqFVs=; b=a2gJYbtXF/8MzGtwRHBZBlCEw2v4+xW6eFQNl3vGuvO/cTlKBb2Rpc4aPpfIpOiz6U eENiR0ynxUjgkwFRWFnjrHu8I9RnPzVU7LcnzZq70l32FJ2x6psH2zIpyLmh1iXkNspH b98aLIjlAD2YVRo5HApoLa2DRiqoymwfGMVXfLSm985gFxNf5Yha7PdHFTqzDKLpM/cF F+a8itFksz3u1nHXvmoUc6ylkxmsy/Vv+gBIFjg7vnLtdI23CjJN11vQuOHwSjTkz+yj 0ssC/pCv+petf7hiJpuAqgz3XCN7gbJcc11g66zCNxLbxIG8/9eY6F4oYUyGKWOpzxQd hzeQ== X-Gm-Message-State: ABy/qLYR/GRhyW9NP8VKWxHBTnrjr9PSJY2FFY0VorFL+4XUTuybuDXW Pof6veg1gbUKA47QsIsimIWP4+SOTdgzWie5g5Y45A== X-Received: by 2002:a2e:900c:0:b0:2b6:e7b7:a163 with SMTP id h12-20020a2e900c000000b002b6e7b7a163mr4858296ljg.27.1689382974779; Fri, 14 Jul 2023 18:02:54 -0700 (PDT) MIME-Version: 1.0 References: <20230714120852.23573-1-frederic@kernel.org> <20230714120852.23573-4-frederic@kernel.org> <9347e3d4-e774-f75f-22c4-6c2dba294423@joelfernandes.org> In-Reply-To: From: Joel Fernandes Date: Fri, 14 Jul 2023 21:02:43 -0400 Message-ID: Subject: Re: [PATCH 3/3] tick/nohz: Don't shutdown the lowres tick from itself To: Frederic Weisbecker Cc: Thomas Gleixner , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Fri, Jul 14, 2023 at 8:01=E2=80=AFPM Frederic Weisbecker wrote: > > On Fri, Jul 14, 2023 at 02:44:49PM -0400, Joel Fernandes wrote: > > On 7/14/23 08:08, Frederic Weisbecker wrote: > > One slight concern here though, where in the idle loop is the removed > > statement "tick_program_event(KTIME_MAX, 1);" happening if the tick was > > already stopped before? If it is happening in tick_nohz_stop_tick(), do= n't > > we early return from there and avoid doing that > > "tick_program_event(KTIME_MAX, 1);" altogether, if the tick was already > > stopped and the next event has not changed? > > > > /* Skip reprogram of event if its not changed */ > > if (ts->tick_stopped && (expires =3D=3D ts->next_tick)) { > > /* Sanity check: make sure clockevent is actually progr= ammed */ > > if (tick =3D=3D KTIME_MAX || ts->next_tick =3D=3D [...= ] > > return; > > [...] > > } > > Sure, if tick_program_event(KTIME_MAX, 1) was already called in the > previous idle loop iteration, then there is no need to call that again. > > Or am I missing something else? Just take it with a grain of salt but I think you need to still call tick_program_event(KTIME_MAX, 1) here for the case where the tick was previously stopped, and then when the next tick fires (say after a long time T), but that tick is a one-off and does not result in restarting the tick -- then there is no one to call "tick_program_event(KTIME_MAX, 1)". I think that's the concern Nick was addressing in [1] so that it resets the tick device correctly? [1] https://lore.kernel.org/lkml/165089105607.4207.3022534114716811208.tip-= bot2@tip-bot2/ > > > > Also just a nit, here you can remove indent by doing: > > > > if (unlikely(ts->tick_stopped)) > > return; > > hrtimer_forward(&ts->sched_timer, now, TICK_NSEC); > > tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1); > > > > Which is pretty much the original code except for the tick_program_even= t(). > > Either I remove an indent or I remove a statement. I guess it's a matter = of > personal taste. I don't mind either way :-) Ah true, in defense of the "less indent" way, the original code was also using that style. ;-) But I am also Ok with either way. :-) thanks, - Joel