Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4028618rdb; Thu, 14 Sep 2023 09:36:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQiVlCJuDHtEr5c81IUk5EK41nbwjTouMd+NmYJvU13hqBysYFe8kUMTA+5Uusl20rItAY X-Received: by 2002:a05:6a00:24d4:b0:68a:5395:7aa5 with SMTP id d20-20020a056a0024d400b0068a53957aa5mr6303429pfv.17.1694709369660; Thu, 14 Sep 2023 09:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694709369; cv=none; d=google.com; s=arc-20160816; b=LWl0MRlwJNWDjPdc0k0a+LnsDC0BeffgSlMPvhmSZz7LifymLt5zfppIB4e0tCxtZJ A78pj+GhDBWinnGvy6rE5zxV1Uu+odKIoQhqOvGTK4IxqfRPPHHSkXJo4G3n5G6aMigt MlFfKI3SN4aDc0DS/Cz5GlpDGlFe6ImdDtFUprIpF0xNSdn5oVKa9Orlkeliugf62rDy JoSK0AmDcBjWV18fqOuEev8kDb21gGMX4lOzySZ4Ysx8aff9pWFNuZc0tseg54of7RRT OIIc0e02Op3pj86P1JcO7i7Mi/EwgXIQ2OdXxpDo9eRSalHQ/EoXosBu+JVj4j+2j6Qm YDMw== 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=ltHqz7sJ0v4Q+i/Z4aqTT31SnmE06twy+6dA1CwyTLk=; fh=iw1uKfqAciuZALm2/481G9WvEyYB9hO2v/ZM5BdwrBY=; b=MioTkdE95/aeFFdHzHA+CU42UhVr7xKANV2m/S5yDHRKvpxKABYgdyvVKgm+JRWg7i 8biJM8SK5UeKSIicH51abVKF6STxzYqNWsh51Og2F4VKoVMegw62Y+Zf5sxsH/gJDvft lbg43mYfbR2/b3RmORdki3JALikPHnQGHEhamltif1QFyRmACnzTxP0yvHrLwOgTfNtQ jSeNSBOzhhVlrmCFG6qmN7wVluLG/2BFDQZbTpCFQszIjPNVOEMkWTSVBIEBTB96bgLe 9DL37zFJizPTf10ne2+mBJeNYUrCzes1X7Pka6814Y5Z5SuKZO1M6Ww0oZsFosqNCqI3 jBIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=rtZFztPw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id by6-20020a056a00400600b0068fb7e4c4fesi1841092pfb.38.2023.09.14.09.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 09:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=rtZFztPw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 41D2180FCE35; Thu, 14 Sep 2023 06:27:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238934AbjINN1G (ORCPT + 99 others); Thu, 14 Sep 2023 09:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235397AbjINN1F (ORCPT ); Thu, 14 Sep 2023 09:27:05 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B191BEF for ; Thu, 14 Sep 2023 06:27:01 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2ba1e9b1fa9so14991761fa.3 for ; Thu, 14 Sep 2023 06:27:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1694698019; x=1695302819; darn=vger.kernel.org; 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=ltHqz7sJ0v4Q+i/Z4aqTT31SnmE06twy+6dA1CwyTLk=; b=rtZFztPw4h/mSEQGqUEa4pDAKZyf22VNuosysvFOrd/r2PHZMZ5+1DqDFyPyUNrkeM TMa3f5F5+h91ROod8sqGTGaqvZReTjIr71Vb/KLXR0cjszbq+40BC5RKs6nM+DJDgCuD QDZ0jidcCmZNiKnho+Yzetat3Rn1hpEg06fgI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694698019; x=1695302819; 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=ltHqz7sJ0v4Q+i/Z4aqTT31SnmE06twy+6dA1CwyTLk=; b=gtk2A9OnJUKfKfw9guWu61kHmTtbXKOfOBxHeRt3f6xg9BIuX2o+SdQuO48495H30F v2DI4gfSw6aHUrnfAiYCW0J/3ldshrQi12OVuQpa+wo8M8xzwlQh5pChtbokuyMa1VAD GLLWTfkBNIQaVP5pylLYrf1aQPYGxZ5bRsuCCGPYLPRS+krmDxVnuR1EwimMXx+zNTbl rq9Q+bKRsJnQvSLCzQmDzMxV9v2kckj9hfJimDPMyQ9HtHxI7iXe/7dIlALizLFw5kiL lND70ACl4zAPKIcfNlcySrBqL7FwhksnjQ0d0b5Uu5nW4TBeOBKzuiroiRDIkwCwaDAm 9XRw== X-Gm-Message-State: AOJu0YxnrlFb5oFX6qUy71j7iqSQ8iXIXGRd2C5JSAKmiX66DPNiRTVX aLe4Bc1cXzCCqd83K/o9NqKtavHv1hDkxj7FlMFzZA== X-Received: by 2002:a2e:8887:0:b0:2bd:1fee:aacb with SMTP id k7-20020a2e8887000000b002bd1feeaacbmr5319566lji.14.1694698019603; Thu, 14 Sep 2023 06:26:59 -0700 (PDT) MIME-Version: 1.0 References: <20230912104406.312185-1-frederic@kernel.org> <20230912104406.312185-4-frederic@kernel.org> In-Reply-To: From: Joel Fernandes Date: Thu, 14 Sep 2023 09:26:48 -0400 Message-ID: Subject: Re: [PATCH 3/5] tick/nohz: Don't shutdown the lowres tick from itself To: Frederic Weisbecker Cc: LKML , Thomas Gleixner , vineethrp@gmail.com, Nicholas Piggin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 (agentk.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:27:07 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 agentk.vger.email On Thu, Sep 14, 2023 at 5:29=E2=80=AFAM Frederic Weisbecker wrote: > > On Wed, Sep 13, 2023 at 09:17:21PM -0400, Joel Fernandes wrote: > > On Tue, Sep 12, 2023 at 6:44=E2=80=AFAM Frederic Weisbecker wrote: > > > > > > In lowres dynticks mode, just like in highres dynticks mode, when the= re > > > 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. Thi= s > > > just just brings more overhead in the idle tick path for no reason. > > > > > > Fixes: 62c1256d5447 ("timers/nohz: Switch to ONESHOT_STOPPED in the l= ow-res handler when the tick is stopped") > > > Signed-off-by: Frederic Weisbecker > > > > If on some weird hardware, say ts->next_tick =3D 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 =3D=3D 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 tim= er > interrupts when next_tick is KTIME_MAX, the timer is always reprogrammed = upon > the next idle loop iteration. So this shouldn't happen. Ah you are right, I missed that. So then I am good with it: Reviewed-by: Joel Fernandes (Google) thanks, - Joel