Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp78517rdb; Wed, 20 Dec 2023 06:50:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCJSxduFnKVj/yu1MAxkrgAEHgHEHqbf3SHWL2CujTxgfOq24AnqVetftZdaFuj/rXi71m X-Received: by 2002:a17:90a:9707:b0:28b:83aa:202a with SMTP id x7-20020a17090a970700b0028b83aa202amr3009670pjo.24.1703083806840; Wed, 20 Dec 2023 06:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703083806; cv=none; d=google.com; s=arc-20160816; b=M47YEDZbAaj4Fn107lJdPjNzah4gn9QrFp6N5FMykywfhYuAz46Ss3aWVx5nI4KtJ2 AwDyPRBzfZdFpLJKP+Msu1LKnaICt7dt/G6mnm+UpQu6G+9SyQ/b81a+TK+gmcBN+M5h KW/opn5IAh24573wuMwoZmUVAikmcGgLbwxrObksn4E7w8Ms6je/uY7tVA75QRaPupMT dEXkwYqsspP522UIrgphy2VbzeD/uSX4WUVtYWl1ouR3oDv6GOgLqoQpfcR99YvoZfmI yJW4N27h6a0dqJ97AwEJPIkzkHv5PQDwpkF+DIJ0esZlHlr3y1J8TNBsi+wWQkwn86Yx l1sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=X3lzvB/x6TcPIrSDGKRhFaL56TxMXg7OJ8IbA0dg3ac=; fh=rlwn4pxNjzZxzAe0OFpEm5XldgGOhioyoE/W5GSrSmE=; b=acY+IguTt5D8AoL1l+RMyP3KKQnzt5E1TBlTdlr52LxZqPIhpaLETcfyIrulKUuCdm at2a01YzrdSiTJxsMgHpQ762gtnTzSQpYrlJBHvWNTXlrMRoOnGJPnFQA/zhvJfKkGQx UyjNBEI4gP307nyyi7Au4fL0r9f1oSry5eCI8r0uqBG954LE+GDkt2dzv44MVvvbFMdM AWGc9zDRCUpwDQxhXC/fuyU8WmXfS5ZCQX5hEEsGuS7Ckl/tJT6RAdByYtWsZ5UtVMnq ov1Z5PzYoesycl/MQjEcy8jsVFh8Z51FWnGD5A66jl0zcN/peyklo7gNOfSG/bN023vz +nfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iQXOr7gz; spf=pass (google.com: domain of linux-kernel+bounces-7084-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kx6-20020a17090b228600b0028b24e56588si3218466pjb.64.2023.12.20.06.50.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 06:50:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7084-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iQXOr7gz; spf=pass (google.com: domain of linux-kernel+bounces-7084-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CD8E2286C44 for ; Wed, 20 Dec 2023 14:50:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78F5C3D96F; Wed, 20 Dec 2023 14:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iQXOr7gz" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB3323D965 for ; Wed, 20 Dec 2023 14:49:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 950C0C433C8; Wed, 20 Dec 2023 14:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703083799; bh=Iv/cIaQAPXm2RUPeVXr5JzCDgj9SXoRlobSmJJOPQFY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iQXOr7gzagqoaj5/1+PdA2Hp8Q8tB74zmovhZnKW5X1u6IErFzsn4NiwJ3cgusHgL xVImRMLHcjHDIqrJHjp8ovC5DgW40EQSyiw+ndonkABdiJo1qIOmz1G69MdcVfP1Gj +qJK5W7DLGx2V2CeY5FwFRaIl+aIE/qEw5sqH+SdFT65YXOPKWDCNJ0RycorNoPrZj eUqHKRvi5OVeBsSfpNZ/RgNRGQJMYVHk41CyOgHFgfsR5Aj6z/AguhEeW2jaO/3s7W QHv873dVj77M8BXMkgBysH9Wtj459T5hHpg8ZhM3W3g0LUxM7ZHuOzyQb2qHMJAJwG +9I/TOgzMNueg== Date: Wed, 20 Dec 2023 15:49:55 +0100 From: Frederic Weisbecker To: Anna-Maria Behnsen Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak Subject: Re: [PATCH v9 12/32] timers: Fix nextevt calculation when no timers are pending Message-ID: References: <20231201092654.34614-1-anna-maria@linutronix.de> <20231201092654.34614-13-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231201092654.34614-13-anna-maria@linutronix.de> Le Fri, Dec 01, 2023 at 10:26:34AM +0100, Anna-Maria Behnsen a ?crit : > When no timer is queued into an empty timer base, the next_expiry will not > be updated. It was originally calculated as > > base->clk + NEXT_TIMER_MAX_DELTA > > When the timer base stays empty long enough (> NEXT_TIMER_MAX_DELTA), the > next_expiry value of the empty base suggests that there is a timer pending > soon. This might be more a kind of a theoretical problem, but the fix > doesn't hurt. This solves a real issue. I suggest removing the last sentence and add instead: If the CPU sleeps in idle for a bit more than NEXT_TIMER_MAX_DELTA (~12 days in HZ=1000) and then an interrupt fires, upon going back to idle get_next_timer_interrupt() will still return KTIME_MAX but incorrectly set is_idle to false. Therefore the CPU will keep the tick stopped and go back to sleep though further remote enqueue of timers to this CPU will fail to send an IPI. As a result the timer will remain ignored. Reviewed-by: Frederic Weisbecker