Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3988886rwe; Mon, 17 Apr 2023 06:34:25 -0700 (PDT) X-Google-Smtp-Source: AKy350aH9LEj9mBwvng0ZDQqXJxp5mHVdFRSTsKXth3XP1fd/UwMTIZ4ZW6G4780X8G3LjAV65z+ X-Received: by 2002:a17:902:d4cd:b0:1a2:8770:bb17 with SMTP id o13-20020a170902d4cd00b001a28770bb17mr16136324plg.9.1681738464852; Mon, 17 Apr 2023 06:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681738464; cv=none; d=google.com; s=arc-20160816; b=nh0Z5ACHgxz4zGT1iyEJjDZP2rQJMUWzz07OSZnncQIzlQCGzBi0pg7ZCJ1U5o2k+e npVIO2WfQ4slDiXmjqfIYBVW0eLnjOfZNffPDj6VhqVcTcbZ6O3CDxsnRAyNcksIReww vey0Sm4NO/OCQoQZAq3N91UzDJaLEZQDsxaASeP6zIFA9mTcqzmzfBSiufbFo8LEqQCp O93iymip5Qef0W3RRp7YAhg2NfSw1aZGZ6RNIRZq5h9btaaZNe7PxEPyySrIBHucaMG4 U4v00vhnY/2f4mAanb4Yh3m3vHvc/ylOH4sPkeNO+FnTE/wJXsyi9ZR+XpcSy+PAHZtp 0PVQ== 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=uS/VZYStjpCouDuDNKXMPZSlNbzfSW58Ci85XQd26GA=; b=kxNI9Tu7Ps1vhmTeMwFOPIkcHBCqGHioQ0Nww62i3FYP2WqNA1QXrSW65KiN0xxoP5 /Y1pNb7j+TREBLFIcXu0VpX6cadXfRAFju6nmTA2Q13Qqc89odiE+R4oTmpBfA3D1KA1 /GqxhHNCkcNE4lHejYOTpNwVyiTbJTilqKr7Q6wLIYeYkRlYGkGW5RX5H09eEtuSe2P5 DvyquZD+CsSmpWEI+QdCWXsLL5t9B6p2N2rFW2n2l2ylUhFLos/RQKCTdiu+eu9NEYWR btHSW2xNM9eQFBHYLe6XTMh/v/+OY4DhaGZJbegbfSpNsWGLaw3JeQ97EJK0/0LvjROP JWFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="HAu84oc/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a170902c41100b001a6a06397d2si9666412plk.32.2023.04.17.06.34.12; Mon, 17 Apr 2023 06:34:24 -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=@kernel.org header.s=k20201202 header.b="HAu84oc/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229504AbjDQN2r (ORCPT + 99 others); Mon, 17 Apr 2023 09:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjDQN2p (ORCPT ); Mon, 17 Apr 2023 09:28:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AF905B9D for ; Mon, 17 Apr 2023 06:28:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A90A261B0B for ; Mon, 17 Apr 2023 13:28:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B01A4C433D2; Mon, 17 Apr 2023 13:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681738114; bh=QJ4rjxKkBe8PUyiMdUG5GutRvF2pBSJePJa+Im1ckzA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HAu84oc//dlmsniw847BFhIEEEujk6e5G91qY13ZuR4iQDOZCBD0J/MidE232Dx39 wXU6mhFFytYb+tlAoQrwr7IEQDD59jbyrJOnq6eo1EA4M5r1bN/CzA6vLR2iAkkAge APzPO/YXCIRhtSN5wj3k7P3YXrIl3O08Mi1qjcATIuTXX1fNq4W6QjsPbcx79S2qEG 9oJYBHeKZ0V1du3J+hm9zBqPqhhWLDTPTUS0WrxRa4TwlEAeYkw1Es2eGHBTtBkQ7N 5w5pS8waC4sARXYysFs71Y2TVtgwR1j9nYoSaTICbQDwqqt9pAcvgpOh6C0jw5nm0t rsdvHqS7sU6cw== Date: Mon, 17 Apr 2023 15:28:30 +0200 From: Frederic Weisbecker To: Thomas Gleixner Cc: Victor Hassan , fweisbec@gmail.com, mingo@kernel.org, jindong.yue@nxp.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tick/broadcast: Do not set oneshot_mask except was_periodic was true Message-ID: References: <20230412003425.11323-1-victor@allwinnertech.com> <87sfd0yi4g.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87sfd0yi4g.ffs@tglx> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Le Sat, Apr 15, 2023 at 11:01:51PM +0200, Thomas Gleixner a ?crit : > > * CPU 1 stop its tick, next event is in one hour. It calls > > tick_broadcast_enter() and goes to sleep. > > So there is already a broadcast device installed, right? Yes > > > * CPU 1 gets an interrupt that enqueues a new timer expiring in the next jiffy > > (note it's not yet actually programmed in the tick device) > > * CPU 1 call tick_broadcast_exit(). > > * CPU 0 registers new broadcast device and sets CPU 1 in tick_broadcast_oneshot_mask > > This lacks an explanation why CPU0 sets CPU1 in that mask. It does not > _set_ it explicitely, only implicitely by ORing the periodic broadcast > cpumask over. > > Now the question is why is CPU1 set in the periodic broadcast mask when > the CPU already switched over to NOHZ mode? > > That needs to be explained too. I probably got confused with that tick_broadcast_mask, so it's only set for periodic broadcast? Should it be renamed to tick_periodic_broadcast_mask to disambiguate my eternal confusion? > > > * CPU 0 runs the broadcast callback, sees that the next timer for CPU 1 > > is in one hour (because the recently enqueued timer for CPU 1 hasn't been programmed > > yet), so it programs the broadcast to that 1 hour deadline. > > * CPU 1 runs tick_nohz_idle_stop_tick() which eventually writes and program > > dev->next_event to next jiffy > > * CPU 1 runs into cpuidle_enter_state(), and tick_broadcast_enter() is ignored because > > the CPU is already in tick_broadcast_oneshot_mask, so the dev->next_event > > change isn't propagated to broadcast. > > * CPU 1 goes to sleep for 1 hour. > > Also please use tabular style to explain the parallel events as > explained in the documentation. Yeah my bad I asked Victor to integrate that scenario that popped out of me misunderstanding that code. Not even mentioning the form. Now to review your proposal. Thanks.