Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp571661rdb; Mon, 15 Jan 2024 06:41:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkJBLrSYU2RNsuaOgsyiA5WVl0fAgfWTvzD9sxeDph045cA9Kv8/O9VnXJmpUZWiDetj7r X-Received: by 2002:aa7:cf19:0:b0:558:f01f:6845 with SMTP id a25-20020aa7cf19000000b00558f01f6845mr987523edy.168.1705329702721; Mon, 15 Jan 2024 06:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705329702; cv=none; d=google.com; s=arc-20160816; b=tzYlJ06WQxHsZlsJp/e2qudTPqvvHm67J57hXnazq448hGKr9LUsqdCKZHE6G9sWce c84zStFukG4wxO2Y31+01JyYwHKY/hoRmS9r26O2d0eSovHNhOGQTVPeFML7OJQ6TCPR 62aUMiDr94jzRCN0ryOyCxXxurZbQBb/x9bjm7b/XzHE8Tg/U4gZFJXg3C0t/kp34r84 k5pJ9JtfrejoPEr/4OigRJ1nZGBtlHzEDJOVYDvFH4VYTxTzWMkdTmr9ygjDANpvh1dP A/vu+C+1p4XDGwsAMyHyE/hRy0F4zfudVIwqog8W2DnpVzvvrmXvKr1FrDkssG61y/gD XalA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=WgXCRky76cIAK5QBFsb3qOUmiS36hjINUCdmIygML+w=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=iPUa98Y6lRielOwww8w/+kMln7fyXa61bzs1HyUNvITHMAEArEdiq8vGwS85rsEdlC Kh06KqAVgNkos6vVJr8HgCFfzP/cYWBO8JipR1UfmMqpu+kIYqCj1OXCZDedenGz2PTE rGvBnMpi2No8gdfZeD1ItVG72QsJ2+1w8Yx6xHQUfdy/EsefHEK5GlvPbNs+CBwTobWc Se0oqkLNzrVbrPv9SRM0JOu6CT5ZMVCKMR/UrznMDth2uOHGS7M9PrjnZ5q9rN/ZxCK1 cvsY7gxw+NtoNJ6om4ioxpSN/VmCNBbTDBX6yoQXDh5kHlkZ/Zsr6ybWk3hBKC/KyL+4 wfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VJ0ZdCXs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=MHGgPXm8; spf=pass (google.com: domain of linux-kernel+bounces-26113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id es13-20020a056402380d00b00557766c0f78si4062664edb.77.2024.01.15.06.41.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 06:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VJ0ZdCXs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=MHGgPXm8; spf=pass (google.com: domain of linux-kernel+bounces-26113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 792261F22705 for ; Mon, 15 Jan 2024 14:41:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EC711947B; Mon, 15 Jan 2024 14:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="VJ0ZdCXs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MHGgPXm8" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 33CD418E1E for ; Mon, 15 Jan 2024 14:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705329492; 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=WgXCRky76cIAK5QBFsb3qOUmiS36hjINUCdmIygML+w=; b=VJ0ZdCXsTwC3rHgQvht3mFDy8gMSW7AsbulTkecRFJ2Z+Ju9JPZXmawgbflukXbt5vgBWe KoAdUAQiIYZj9c3G+ACdgevN3KtEj59A6YXhOwB3PxjpgD0w3wuOPKlr6g+G2vhRTCFTN0 KXDI2rTeKIjmNTpyNDzBBtDVqevBouoMOswftP5rL36OeUJAIEFu9YUdUUWggGpC7pwSIZ IIORwcCgDMWlkQ+mRZc0pvNWNNWj7hTiUqt1eBvTNfP8MohcZzchWXpz3DX8xGDQ6Iq+0L pjE+a4/quqWC/j7/TNb5IbGcfTmKB5R5LVodaUb7pwqqkShObFwWnxGH//uuMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705329492; 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=WgXCRky76cIAK5QBFsb3qOUmiS36hjINUCdmIygML+w=; b=MHGgPXm8qWbBjcbzLFlIsP+V77UUBvpMyV8XjM6R3228s7QVVTwUJQ0sqMlPvj3iFVm+Sn mBcwtPddeKZe2PCQ== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Srinivas Pandruvada , K Prateek Nayak , Anna-Maria Behnsen Subject: [PATCH v10 17/20] timers: Introduce function to check timer base is_idle flag Date: Mon, 15 Jan 2024 15:37:40 +0100 Message-Id: <20240115143743.27827-18-anna-maria@linutronix.de> In-Reply-To: <20240115143743.27827-1-anna-maria@linutronix.de> References: <20240115143743.27827-1-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-Transfer-Encoding: 8bit flag To prepare for the conversion of the NOHZ timer placement to a pull at expiry time model it's required to have a function that returns the value of the is_idle flag of the timer base to keep the hierarchy states during online in sync with timer base state. No functional change. Signed-off-by: Anna-Maria Behnsen --- v10: Fix fallout of 0day: Move function definition of timer_base_is_idle() into SMP && NO_HZ_COMMON ifdef section v9: new in v9 --- kernel/time/tick-internal.h | 1 + kernel/time/timer.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index ccf39befde85..7e3090109e33 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -165,6 +165,7 @@ extern void fetch_next_timer_interrupt_remote(unsigned long basej, u64 basem, unsigned int cpu); extern void timer_lock_remote_bases(unsigned int cpu); extern void timer_unlock_remote_bases(unsigned int cpu); +extern bool timer_base_is_idle(void); # endif #else /* CONFIG_NO_HZ_COMMON */ static inline void timers_update_nohz(void) { } diff --git a/kernel/time/timer.c b/kernel/time/timer.c index eb99297a96fe..3c49d8fdfd53 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2099,6 +2099,16 @@ void timer_lock_remote_bases(unsigned int cpu) raw_spin_lock(&base_local->lock); raw_spin_lock_nested(&base_global->lock, SINGLE_DEPTH_NESTING); } + +/** + * timer_base_is_idle() - Return whether timer base is set idle + * + * Returns value of local timer base is_idle value. + */ +bool timer_base_is_idle(void) +{ + return __this_cpu_read(timer_bases[BASE_LOCAL].is_idle); +} # endif /* CONFIG_SMP */ static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem, -- 2.39.2