Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3785128rdb; Thu, 14 Sep 2023 02:30:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJMJ1pVC7ZCN4xAZlWLXl5OxFUtw4imvZKepcqB9iJ5Xt2SebqF1ZtkKz/vxgiNpGaF0KG X-Received: by 2002:a17:902:e743:b0:1b4:5699:aac1 with SMTP id p3-20020a170902e74300b001b45699aac1mr1884428plf.12.1694683819033; Thu, 14 Sep 2023 02:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694683819; cv=none; d=google.com; s=arc-20160816; b=tmd0ZTpaQtr8lSbSva1v0d1KeP+k4AV3m5jThpMI8kJ2ijIRBsizZCOlkejb79Lc8d QEsbF1rp0G8fY2qqKAciOk8gQ1/fX4PerKyqVNm9t8OFjkXqSkhbZi1I8B0LD/W5nbkm j2IlhRMZmixPG6JVmSv/YO/Yo2dzWYFDSgld6SvF9TIyCdLcn9N0Kx/RtEGn9YCONkpa dwichccuxDAEAiofwlHgy3w1QLTtVMfwfeZ8Pi2vWLp9mGYQUL+0JnSivoeoWsD3Hp6k CEPiF8jytwHd/1J2Y3fPYHJdxwpCXk/Xr7AubmFHJWOB8Q/UlBGl4yLL/2+BUGGd+NU8 axUQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=cO++JbQUXG06P5eAMI444lmBkoIO96NpVEjYTJ1zDYc=; fh=A93cwBkDjhcPbQ98rmuT8dbnYk1wwbb8X4Yya3f2Klc=; b=QaczngDjl+3LoXj35u1zs2CYKOw/FyMvcnECyQM2GGOe++DKgG8BJIk8N/OCDnHVMK Gm1N1aYODPUQbvWN/IcSwX64+uDQJRGZZY0QMm+QwVZYhNbw6JWXGDFKB1SsKuzfmD9k 8S+gXUeJIV3kS9b6vV9rOUfEzAgT2IUDod6n0SAHBjULAnRRLNTL6z0NpW5sO0SYp2Q6 Nj+3hdXUCQ5Sc+yvHqidwy+aA1VPuAz/YFR+iX6jDpmjE/pMsULONz3kts1xKjXdHHDa npYCX31W4wcQdx+lXKZP41ATGGpmGDKB+65UaMYIhbcL0CDGMCn60ooRtroFJabFHsjr y1gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MT9Pe9pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id kv16-20020a17090328d000b001b8b4330585si1225297plb.510.2023.09.14.02.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 02:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MT9Pe9pS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E4D97832A060; Thu, 14 Sep 2023 02:29:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236830AbjINJ3s (ORCPT + 99 others); Thu, 14 Sep 2023 05:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234427AbjINJ3r (ORCPT ); Thu, 14 Sep 2023 05:29:47 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE1ACF3 for ; Thu, 14 Sep 2023 02:29:43 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2F06C433C8; Thu, 14 Sep 2023 09:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694683783; bh=gUaeuzg5Lsnt+jFoiVND+TSHnUACWUT2IpD58sScFbw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MT9Pe9pS7XbHKPDTCmHX6UzV/a1wI1T+Gu9msNwrIS51ZxJO+KUvVYBNosdvU+39n DVe5RoCMo5uPViwUp67fFicn00HDLPoszDuWrhKlLoUSegXOfIl4MJmUYeADmKWk9X oDklVNTpNf6Fa23UP9u64nEvAeCzwBesxiPgRf5mr2uMXe7DQ86pNzuCH81/QviHvm GXYla8PNCFR/+3+JuS1Q5PP8K5pwfe942NAshMgs3Zfu+eBVZ3eDlSr6j5m2Wedean UJhiO9z/R8sigqOLLihhn72+7KzMaZCYFsaaPDUeohQmGETtLGpybX/x9CI8c8ysEi kCew1BCEApsAg== Date: Thu, 14 Sep 2023 11:29:40 +0200 From: Frederic Weisbecker To: Joel Fernandes Cc: LKML , Thomas Gleixner , vineethrp@gmail.com, Nicholas Piggin Subject: Re: [PATCH 3/5] tick/nohz: Don't shutdown the lowres tick from itself Message-ID: References: <20230912104406.312185-1-frederic@kernel.org> <20230912104406.312185-4-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 02:29:50 -0700 (PDT) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email On Wed, Sep 13, 2023 at 09:17:21PM -0400, Joel Fernandes wrote: > On Tue, Sep 12, 2023 at 6:44 AM Frederic Weisbecker wrote: > > > > In lowres dynticks mode, just like in highres dynticks mode, when there > > is no tick to program in the future, the tick eventually gets > > deactivated either: > > > > * From the idle loop if in idle mode. > > * From the IRQ exit if in full dynticks mode. > > > > Therefore there is no need to deactivate it from the tick itself. This > > just just brings more overhead in the idle tick path for no reason. > > > > Fixes: 62c1256d5447 ("timers/nohz: Switch to ONESHOT_STOPPED in the low-res handler when the tick is stopped") > > Signed-off-by: Frederic Weisbecker > > If on some weird hardware, say ts->next_tick = KTIME_MAX but a > spurious timer interrupt went off and tick_nohz_handler() did get > called (yeah weird hypothetical situation), then in > tick_nohz_stop_tick() we might early return from: > > /* Skip reprogram of event if its not changed */ > if (ts->tick_stopped && (expires == ts->next_tick)) > > without no "eventual" reprogramming. > > Maybe we should also reprogram with KTIME_MAX in such a situation? > Then we can get rid of it from tick_nohz_handler() for the common case > as you are doing. > > So for weird hardware, with this patch we are not doing an extra > tick_program_event(KTIME_MAX, 1); like Nick was doing. That makes me a > tad bit nervous. So when a tick happens, ts->next_tick is reset to 0 (in tick_sched_handle()). This way if a timer interrupt fires too early, and that includes also timer interrupts when next_tick is KTIME_MAX, the timer is always reprogrammed upon the next idle loop iteration. So this shouldn't happen. Thanks.