Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp570466rdb; Mon, 15 Jan 2024 06:39:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFquTil0XMlYKSsfwIZDp9bCpvNR2Luijb11gkaw26lz4/IOmzhWcI6CoQA7hK6mhUNG8GI X-Received: by 2002:a05:6512:530:b0:50e:2a39:9cfc with SMTP id o16-20020a056512053000b0050e2a399cfcmr2341906lfc.48.1705329565572; Mon, 15 Jan 2024 06:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705329565; cv=none; d=google.com; s=arc-20160816; b=RfojisMl5s3bEUP7//Fppk04mGmn8cMXT8HRXfj3LvgZaPn5LhUJP8cDe2bNgT+8NY CM5+dfJYNSR/bTHety6I0HZtcBqOdnV7wBXjD73tRs6p2uwws6rKMyCwoLyrPSW+cgzb rhEDMxpQ6W8IqFraCnCrVVslXspJL6jNsD/gz4vna9l1nG5GtE7fEazulnlWwwQYnHuq vhXPb8lczrmhLdRCQx/5KWE4lRBmxMEgEmYV9kn4vdZZVhfxn/qepKVT7Fz5n0/xeg4Q rtqhH9q1qjF0UlQkw7EjFYyFVKwDY5ALDKoe5+xSIp410ugefj130K8NkAh6RxustTe/ LOog== 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=ID/05caAQ7viG6IvKvJwH4SWuLM7iMQOtASJkbsjYUE=; fh=PG6uS4TiiUSDyl8D/joYkWbwCgDm4ug0ir2h7tHBJXQ=; b=pQB/FipujNXiN+zRecJCq+z7DncCCVjdoGyLGgvSs2MhetpRpL2lLSp8P1EQewugYA IY0QwQbhO//HPRNTg1cd4NEJ3KuLCgvQEhc9wFDwLruCKmSsW+wpPML/f+2G7vYeWgKq yAB/Nqmo581dAeW52rGcVMXkxdrru4OGyGy15bAoxAascm1/ap5gvRf3jp4cnYAi/n6D s3PFxcqYzCMZon6jkyum1PBuZvvKVN0DxhBu0qe8eput5Aea/q7xGNRDE4GYetYt9aK8 jVxOBuVSC7P5SeWJuWIuGYFB5usg7Dw8296S7RybU8SjA6Ma7B0pAQJh9pBnrcM2+8nQ vxZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Kd6kcmWr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-26103-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26103-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 p13-20020a05640243cd00b0055946387477si989083edc.605.2024.01.15.06.39.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 06:39:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26103-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=Kd6kcmWr; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-26103-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26103-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 48E2B1F210C3 for ; Mon, 15 Jan 2024 14:39:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D992C1802B; Mon, 15 Jan 2024 14:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Kd6kcmWr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NJleEKH8" 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 68F96179AD for ; Mon, 15 Jan 2024 14:38:08 +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=1705329486; 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=ID/05caAQ7viG6IvKvJwH4SWuLM7iMQOtASJkbsjYUE=; b=Kd6kcmWrMdGquSj5bS/s2WvOQTwxrPJ29PzQN8y3YkLHLxB8kkZYrV0QHBCCkD3W8/SUJ+ CvCmeqwAR8j5N5psDYLVrIspyBcre5NiN1VDnxxPczpjh274XKrO6Putyl9p8bpYevuSyi MhKXjwjPJmUFV9OfUePjAjZI3eFB/D3ZzeVzlM5uWusnWfYMSzt20rnurcXZiCM5mpf9Ff gHquLdZkSPZL2tTWjih6hj+Uw2d2Nw/Dq20Hzmzq20zei053PApLVeVDdYJFOAcQ4Oi6+M lw2UuXQuWUolN1qXre4fomZA5Mi57m9FRoCFSTOq3i/B/3ybnN7ykOuwcLCYnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705329486; 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=ID/05caAQ7viG6IvKvJwH4SWuLM7iMQOtASJkbsjYUE=; b=NJleEKH8Ghy/Gbl6g2GgfGmK8C28DDGE4e44xPDO+2QBqPAAAdluGRrg4G0VbHCGvYR03Y Y2/ELZ67he0XRhAA== 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 07/20] timers: add_timer_on(): Make sure TIMER_PINNED flag is set Date: Mon, 15 Jan 2024 15:37:30 +0100 Message-Id: <20240115143743.27827-8-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 set When adding a timer to the timer wheel using add_timer_on(), it is an implicitly pinned timer. With the timer pull at expiry time model in place, TIMER_PINNED flag is required to make sure timers end up in proper base. Add TIMER_PINNED flag unconditionally when add_timer_on() is executed. Signed-off-by: Anna-Maria Behnsen Reviewed-by: Frederic Weisbecker --- kernel/time/timer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 3cf016d6fa59..fc4c406c9ec7 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1284,7 +1284,10 @@ EXPORT_SYMBOL(add_timer_global); * @timer: The timer to be started * @cpu: The CPU to start it on * - * Same as add_timer() except that it starts the timer on the given CPU. + * Same as add_timer() except that it starts the timer on the given CPU and + * the TIMER_PINNED flag is set. When timer shouldn't be a pinned timer in + * the next round, add_timer_global() should be used instead as it unsets + * the TIMER_PINNED flag. * * See add_timer() for further details. */ @@ -1298,6 +1301,9 @@ void add_timer_on(struct timer_list *timer, int cpu) if (WARN_ON_ONCE(timer_pending(timer))) return; + /* Make sure timer flags have TIMER_PINNED flag set */ + timer->flags |= TIMER_PINNED; + new_base = get_timer_cpu_base(timer->flags, cpu); /* -- 2.39.2