Message ID | 20221025135850.51044-3-anna-maria@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1023398wru; Tue, 25 Oct 2022 07:01:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/1OjE2kcSgCQmAojIsirJokp24h9kA+W/Uv8XmdIjqoBXY3PBPocWawQlUrJRp7AGgn3C X-Received: by 2002:a17:902:70c4:b0:178:54cf:d397 with SMTP id l4-20020a17090270c400b0017854cfd397mr37718578plt.24.1666706481665; Tue, 25 Oct 2022 07:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666706481; cv=none; d=google.com; s=arc-20160816; b=t5EZRGcYzl0mvpxZmup2ITn9+xECgwDE5CFUKny9wK3qMkp1yJJWQff6j4Igdgl7PJ iq+HLoPKkfQb9ftqX1oltglPqPK4ES0rWF6xdm5tk8daWaBWru6BLgYn94ZurAc1BuLt mEfCsL3KG6wR2jdIwr3FALvGWvtVuV9GtdwqmeTtuezRL3AmWxAJbqLw4Aajz63rsNJ5 4je8oyQzxFlGKmFyFWQ5RUnzdkLW9m6+lkXvij1VF83Qf4qdFcgVV+5W1uSKBA4aWVz1 dwA1juQIMIPvHtL5bed7ZJfXiGt3Aek1+SoNz0afh35PKuX1Oh2zeY9NeDh/7jlil0ev ep0g== 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 :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=Qg194zTnM1JYpSXcqxwvHVSZ+y39iQ+5387UWMyWJM0=; b=xVNbhYjW/7Oa4Yf9TpZ4tBB51silLhX0tXfYx9xOt4LyK0pacIbfqQFI3YvBrjGfr9 uwcpRWqsrcfnuRdBqxybhEJzDnTW7MZAwm0ChmTjzaMP0A16+TCjgUpDRkWgrcSB/Ty4 gAfv6wH/HmC9H8SVu2CvpkNUijdWeF6oJwm+goZYfjRWJsPtXorNZqiallOA9Hz8nqzS K01s/kwTVjyd3dk210PQboVclcLf6mGEjBaHGAqfmjzVA7xke4j+6kym7qUsp3FSYOIA DsLbYtzAZI1G1SzNN02CP+8+1SPLJvRrp32sFefwZLsafIg6B4+MCxhjLaIwpM96lwKL 14Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=i74phoyz; dkim=neutral (no key) header.i=@linutronix.de header.b=dms6+CSW; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a170902e54200b0017f580f646fsi3398280plf.304.2022.10.25.07.00.39; Tue, 25 Oct 2022 07:01:21 -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=@linutronix.de header.s=2020 header.b=i74phoyz; dkim=neutral (no key) header.i=@linutronix.de header.b=dms6+CSW; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbiJYN7a (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Tue, 25 Oct 2022 09:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230158AbiJYN7Y (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Oct 2022 09:59:24 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC1917EF36; Tue, 25 Oct 2022 06:59:23 -0700 (PDT) From: Anna-Maria Behnsen <anna-maria@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666706361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qg194zTnM1JYpSXcqxwvHVSZ+y39iQ+5387UWMyWJM0=; b=i74phoyzJ529cxBcKmjz7fM1pp+F2ytguqNCUXKngOtOhAl5ikabmbj0G2xsBlh+oMOx7d yZT1v59aOeghY/7nlmWWXhWmxf/CxeZwhAeAzIf7uMtePetZ0wvpUl2UQXIGluFq4PiMoa h/3WVY41ZuhxuacCiTr5dpASf/0BCLRW7xldXsJwqApek8jYwtqCoNhHUSYTbL1XK7fXyj V63XrkfcsCp/s5dwzrDUMwrAGi2uD1def+NDKWvDM/d/2OCme+2uW0JLBlwxHi0V7d+SL2 GssFArUyQNGg3cWKl9NZu4xROF7UlTYGF9Bo43zwvgr0yXUsYCfEpyu4qlgXSA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666706361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qg194zTnM1JYpSXcqxwvHVSZ+y39iQ+5387UWMyWJM0=; b=dms6+CSWDUlibiggCdS5Fp5rB/0PriZtqDiV/BUtimWZoMauPplPbqXMjtu3bHU8hadOy7 vP4cY8PJNSmuXnDg== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra <peterz@infradead.org>, John Stultz <john.stultz@linaro.org>, Eric Dumazet <edumazet@google.com>, Thomas Gleixner <tglx@linutronix.de>, "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, linux-pm@vger.kernel.org, Arjan van de Ven <arjan@infradead.org>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Frederic Weisbecker <fweisbec@gmail.com>, Rik van Riel <riel@redhat.com>, Anna-Maria Behnsen <anna-maria@linutronix.de> Subject: [PATCH v3 02/17] tick-sched: Warn when next tick seems to be in the past Date: Tue, 25 Oct 2022 15:58:35 +0200 Message-Id: <20221025135850.51044-3-anna-maria@linutronix.de> In-Reply-To: <20221025135850.51044-1-anna-maria@linutronix.de> References: <20221025135850.51044-1-anna-maria@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747668415675233408?= X-GMAIL-MSGID: =?utf-8?q?1747668415675233408?= |
Series |
timer: Move from a push remote at enqueue to a pull at expiry model
|
|
Commit Message
Anna-Maria Behnsen
Oct. 25, 2022, 1:58 p.m. UTC
When the next tick is in the past, the delta between basemono and the next tick gets negativ. But the next tick should never be in the past. The negative effect of a wrong next tick might be a stop of the tick and timers might expire late. To prevent expensive debugging when changing underlying code, add a WARN_ON_ONCE into this code path. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> --- kernel/time/tick-sched.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On Tue, Oct 25, 2022 at 03:58:35PM +0200, Anna-Maria Behnsen wrote: > When the next tick is in the past, the delta between basemono and the next > tick gets negativ. But the next tick should never be in the past. The > negative effect of a wrong next tick might be a stop of the tick and timers > might expire late. > > To prevent expensive debugging when changing underlying code, add a > WARN_ON_ONCE into this code path. > > Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> > Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> > --- > kernel/time/tick-sched.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > index b0e3c9205946..7ffdc7ba19b4 100644 > --- a/kernel/time/tick-sched.c > +++ b/kernel/time/tick-sched.c > @@ -826,6 +826,8 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) > * If the tick is due in the next period, keep it ticking or > * force prod the timer. > */ > + WARN_ON_ONCE(basemono > next_tick); > + > delta = next_tick - basemono; > if (delta <= (u64)TICK_NSEC) { > /* > -- > 2.30.2 >
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index b0e3c9205946..7ffdc7ba19b4 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -826,6 +826,8 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) * If the tick is due in the next period, keep it ticking or * force prod the timer. */ + WARN_ON_ONCE(basemono > next_tick); + delta = next_tick - basemono; if (delta <= (u64)TICK_NSEC) { /*