Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp835243pxb; Fri, 22 Apr 2022 12:11:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLvoNcU1B9oFBKDh/KO98AGQH4luSSDvHQnqp863W5j/WuXhmGdewUXYvr3XMcOx8x4HgM X-Received: by 2002:a17:902:a581:b0:154:8c7d:736a with SMTP id az1-20020a170902a58100b001548c7d736amr6107360plb.74.1650654717000; Fri, 22 Apr 2022 12:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650654716; cv=none; d=google.com; s=arc-20160816; b=JC1r1aB5WvqJ89dZX+mzfqMWdsgkncoj9Gd9HcETWW440Rp0L7hHf0t4+HsiREsk7e 9UjFI2oHBJTD7H0h915jR9N8E6UanoBamWs9/OOE2tRmlP7Nxf/TKPz0Q/Yz+XvKad6h VqVI1WIntl96he8GLYHZjM/9nDHw93OlAachbD+n8BltUJ6pyuVmyf9c5kBsDHX96CRs 3RmkcKkOqm8QsLuVuPyAAxIbIONMfvINGtRJx0uS62T4Hz2nLTOW5qsgvCD6G+Syi2iU wD2an5xWd3XPtZlZMt02pk3EZVCd4o6Ck/1Gj6aomFmZH/8RTmtXBpBlTqntaWHvQ12y DYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c607+vfb+DlI+OEYL+rnX8gutKXnrbYIVxk/8YvQH8c=; b=JwEutlJJ8oq2/Cp0rCTtLEbEQGbJkDjTLo19F/fEfFg1HPlyFlskGoDOloGLnTzDuD zqaAQZp2D60KhX/JeT+9rt/0MkYXkOXdqYVqTn4Y0Z8OsSNbuxZ511L/It8ULK/V/RSq RDZbwqWx4NSH67yvbgfHqUXbWa1sfPgee1s4/ENAKXLi8N7Rt0eQntrNc+hOgh/PfJCz VpjrxRbYlbYT8k/AysAbM4MqJpyPVVMu6AUE9kNlYuv3B5gylmYb4eAyfiY36+vc96cc 4hcYH9BQHD7r5xYLLVyDB0i3tDiBtG2XrVvRXlaJwmCWlYvD3aVeDGV01VtemxLg2cnL DN9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bIs2yQXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c10-20020a170903234a00b00158a978a3b5si9630313plh.14.2022.04.22.12.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:11:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bIs2yQXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B1BD10F2B7; Fri, 22 Apr 2022 11:29:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242845AbiDRNTM (ORCPT + 99 others); Mon, 18 Apr 2022 09:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242574AbiDRNAK (ORCPT ); Mon, 18 Apr 2022 09:00:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3891D2612A; Mon, 18 Apr 2022 05:41:39 -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 C811560FB6; Mon, 18 Apr 2022 12:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D458AC385A1; Mon, 18 Apr 2022 12:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650285698; bh=+bJHROMegmTVcDWC4ZKfPap8cszGveXnm0W1xWIE8ko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIs2yQXUL950qWWOD6vFsCwuWgJSS572j/OVpjHNknOS3StKy3MfjRt0Faj56HVo8 mj0vQ6E0J+DUdDex9CLxw48ou9oGgs9KN1JCwm78JWnl/5bq1ztshNZC+n3WAosJGl xZWTGqW3EYxQ8iSKukisSkHwo0rjrnjo+g3HWD38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Anna-Maria Behnsen , Thomas Gleixner , Frederic Weisbecker Subject: [PATCH 5.10 094/105] timers: Fix warning condition in __run_timers() Date: Mon, 18 Apr 2022 14:13:36 +0200 Message-Id: <20220418121149.304352708@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121145.140991388@linuxfoundation.org> References: <20220418121145.140991388@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 From: Anna-Maria Behnsen commit c54bc0fc84214b203f7a0ebfd1bd308ce2abe920 upstream. 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 necessary") 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 Signed-off-by: Greg Kroah-Hartman --- kernel/time/timer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1738,11 +1738,14 @@ static inline void __run_timers(struct t time_after_eq(jiffies, base->next_expiry)) { levels = 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 = __next_timer_interrupt(base);