From nobody Fri Jun 19 02:05:08 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6932C433EF for ; Sat, 9 Apr 2022 20:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240554AbiDIUZC (ORCPT ); Sat, 9 Apr 2022 16:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbiDIUYo (ORCPT ); Sat, 9 Apr 2022 16:24:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F67814023; Sat, 9 Apr 2022 13:22:35 -0700 (PDT) Date: Sat, 09 Apr 2022 20:22:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649535754; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=flmJT8g3LkPf5OFtHiIqbiCsqW93S7VEn9FZTSp2FNs=; b=HHrFZRwepn6Z8zLuwababzH3L73AgF95BfVXPNLtdDjC+uKWNZZelJhk8GHW7TR6ov+S8M WszoWZl91loxRyCLvvmXO3akJXw7q+UnOP9rzh3gny2Sa9rJO8dgE0G5Nd9oU1Q3SJwZ8j OXNRrlyf3g9REnkjOfRF82Mzoa5UjVaK80GA6HvA0NiA6gfTcrtGKb+sMslRWi+Ibv9guw wcXxQo7aHxBKRPqsmNI3s7Wz9NNm4/PGsDHQ9vYWzQ6QsvijXuhaxH+gRUrQvGlpQwgNRf 8oCkEsavrUtC1rlEYO7rYXsFU8WnOkebmcbP+g4ndI01fUuSmaaIqGQzEQtv6Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649535754; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=flmJT8g3LkPf5OFtHiIqbiCsqW93S7VEn9FZTSp2FNs=; b=14Sz1roVOUAcxj4ffYhAjQ/EDeD3x0A4HoUyKV6Dea6cAKweVXDS3TIIV75WeIx6ijOZJ0 jEmaSClh7QpSsFDQ== From: "tip-bot2 for Anna-Maria Behnsen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Fix warning condition in __run_timers() Cc: Johannes Berg , "Anna-Maria Behnsen" , Thomas Gleixner , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220405191732.7438-3-anna-maria@linutronix.de> References: <20220405191732.7438-3-anna-maria@linutronix.de> MIME-Version: 1.0 Message-ID: <164953575293.4207.16304445982254847122.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: c54bc0fc84214b203f7a0ebfd1bd308ce2abe920 Gitweb: https://git.kernel.org/tip/c54bc0fc84214b203f7a0ebfd1bd308ce= 2abe920 Author: Anna-Maria Behnsen AuthorDate: Tue, 05 Apr 2022 21:17:32 +02:00 Committer: Thomas Gleixner CommitterDate: Sat, 09 Apr 2022 22:17:47 +02:00 timers: Fix warning condition in __run_timers() When the timer base is empty, base::next_expiry is set to base::clk + NEXT_TIMER_MAX_DELTA and base::next_expiry_recalc is false. When no timer is queued until jiffies reaches base::next_expiry value, the warning for not finding any expired timer and base::next_expiry_recalc is false in __run_timers() triggers. To prevent triggering the warning in this valid scenario base::timers_pending needs to be added to the warning condition. Fixes: 31cd0e119d50 ("timers: Recalculate next timer interrupt only when ne= cessary") Reported-by: Johannes Berg Signed-off-by: Anna-Maria Behnsen Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20220405191732.7438-3-anna-maria@linutronix= .de --- kernel/time/timer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 85f1021..9dd2a39 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1722,11 +1722,14 @@ static inline void __run_timers(struct timer_base *= base) time_after_eq(jiffies, base->next_expiry)) { levels =3D collect_expired_timers(base, heads); /* - * The only possible reason for not finding any expired - * timer at this clk is that all matching timers have been - * dequeued. + * The two possible reasons for not finding any expired + * timer at this clk are that all matching timers have been + * dequeued or no timer has been queued since + * base::next_expiry was set to base::clk + + * NEXT_TIMER_MAX_DELTA. */ - WARN_ON_ONCE(!levels && !base->next_expiry_recalc); + WARN_ON_ONCE(!levels && !base->next_expiry_recalc + && base->timers_pending); base->clk++; base->next_expiry =3D __next_timer_interrupt(base);