From nobody Sun Nov 24 09:31:51 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 33A2E1DE4C9; Wed, 6 Nov 2024 02:11:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730859099; cv=none; b=cxF/DmcKFf0hWkoefWKxPG/JdIHj9gQtkWU+Yog7SpgEoFSx6o34a0T1DFmEsdEsTZv0kGVbKoGrtvkEq0s6W1t0tl2Lxxme2Ja+9fmo70HXt81v6ynRUwQcfkhN3QJMrNMSvgftz/DHEBQUxSIC/JvQU0gLgxWRGu3mxZ6iWKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730859099; c=relaxed/simple; bh=xpfYsoGlxVhND2ztvT5XWTblhW4LsQZd1d8BbO4mtvU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N6+fBQ/Nqv0RNd5xs7+Le91teBweBKsI7rMh3HdBounelmknYT7xsKBxaJ22nnAzqozMHsnTe8++AF9IQPgjIMIUymr2rd+0Z8luNhATtTgxiI65gDrMG6/d7HYH9yMYeQjWZ/Q3UlXqfe2QQvb5bgcbnF57kKTMdzvtXlzIr6s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=s2aXxIMM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="s2aXxIMM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C0D1C4CED2; Wed, 6 Nov 2024 02:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730859099; bh=xpfYsoGlxVhND2ztvT5XWTblhW4LsQZd1d8BbO4mtvU=; h=From:To:Cc:Subject:Date:From; b=s2aXxIMMJ8vAL4GAROU8WkcfQVKGuPrU+ZGQsS6iNMbe4k+vJU43V1S2P1MEYbpHh 6lI3o1gkaVi/zq0vgnnstZ7UlH+m5Tmi384kDi1WK2Tm/Bb9x2aW5kK92amva1dNT0 KHgnh+PP9nN/H34S7pDIvbUwJ83BndIVVCxGDIA1yoCR7pzZCaEOXsuq2xFdIO+gin fruNl2XUwbiAFQsAHjwIG/n+Iot6bZgyKM3urBkQNhyF5VIwOckBm8jhwJc6EumpnQ dze+Y1XPratYx2F4aLwr66M87+NBzR9AcBMMyTFqKSyfvHAMsLp7Tc7o9+bCPccuEa DhboCjEMwT+/Q== From: Sasha Levin To: stable@vger.kernel.org, bsegall@google.com Cc: Thomas Gleixner , Frederic Weisbecker , linux-kernel@vger.kernel.org Subject: FAILED: Patch "posix-cpu-timers: Clear TICK_DEP_BIT_POSIX_TIMER on clone" failed to apply to v5.15-stable tree Date: Tue, 5 Nov 2024 21:11:36 -0500 Message-ID: <20241106021136.182329-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The patch below does not apply to the v5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha Reviewed-by: Frederic Weisbecker ------------------ original commit in Linus's tree ------------------ From b5413156bad91dc2995a5c4eab1b05e56914638a Mon Sep 17 00:00:00 2001 From: Benjamin Segall Date: Fri, 25 Oct 2024 18:35:35 -0700 Subject: [PATCH] posix-cpu-timers: Clear TICK_DEP_BIT_POSIX_TIMER on clone When cloning a new thread, its posix_cputimers are not inherited, and are cleared by posix_cputimers_init(). However, this does not clear the tick dependency it creates in tsk->tick_dep_mask, and the handler does not reach the code to clear the dependency if there were no timers to begin with. Thus if a thread has a cputimer running before clone/fork, all descendants will prevent nohz_full unless they create a cputimer of their own. Fix this by entirely clearing the tick_dep_mask in copy_process(). (There is currently no inherited state that needs a tick dependency) Process-wide timers do not have this problem because fork does not copy signal_struct as a baseline, it creates one from scratch. Fixes: b78783000d5c ("posix-cpu-timers: Migrate to use new tick dependency = mask model") Signed-off-by: Ben Segall Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/xm26o737bq8o.fsf@google.com --- include/linux/tick.h | 8 ++++++++ kernel/fork.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/include/linux/tick.h b/include/linux/tick.h index 72744638c5b0f..99c9c5a7252aa 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -251,12 +251,19 @@ static inline void tick_dep_set_task(struct task_stru= ct *tsk, if (tick_nohz_full_enabled()) tick_nohz_dep_set_task(tsk, bit); } + static inline void tick_dep_clear_task(struct task_struct *tsk, enum tick_dep_bits bit) { if (tick_nohz_full_enabled()) tick_nohz_dep_clear_task(tsk, bit); } + +static inline void tick_dep_init_task(struct task_struct *tsk) +{ + atomic_set(&tsk->tick_dep_mask, 0); +} + static inline void tick_dep_set_signal(struct task_struct *tsk, enum tick_dep_bits bit) { @@ -290,6 +297,7 @@ static inline void tick_dep_set_task(struct task_struct= *tsk, enum tick_dep_bits bit) { } static inline void tick_dep_clear_task(struct task_struct *tsk, enum tick_dep_bits bit) { } +static inline void tick_dep_init_task(struct task_struct *tsk) { } static inline void tick_dep_set_signal(struct task_struct *tsk, enum tick_dep_bits bit) { } static inline void tick_dep_clear_signal(struct signal_struct *signal, diff --git a/kernel/fork.c b/kernel/fork.c index 89ceb4a68af25..6fa9fe62e01e3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -105,6 +105,7 @@ #include #include #include +#include =20 #include #include @@ -2292,6 +2293,7 @@ __latent_entropy struct task_struct *copy_process( acct_clear_integrals(p); =20 posix_cputimers_init(&p->posix_cputimers); + tick_dep_init_task(p); =20 p->io_context =3D NULL; audit_set_context(p, NULL); --=20 2.43.0