From nobody Sun Nov 24 10:49:28 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 C7AA32064E3; Wed, 6 Nov 2024 02:13:29 +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=1730859209; cv=none; b=bF5HH0MYSoq4rVb5aAfsG1VF+vijGa1HmZsoIm5yjfymkwnQfWF0GaMFJr2OpPWtkwluAZ5EOMnPntXbvtkRBtCwpo+fTcoqn+BExIOdwhibGicLtPSDvt1XD+Zbm75+m5687GP2XS/P+0lv5zdry3zP9WTQZ5F361S7NFR7pSA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730859209; c=relaxed/simple; bh=iqC+OPH3hLESQQrFbTP3lgm0j0c9WFR7tDyYA1IV99c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uio+jYAFw+74Omf63WD53fFnToJI4cprC08dv1O6w5TkMGWwrn2PIbbPPhV3WdchMluuA6gXakV521o6O8Vfiqg35KerVX6Igp/XZCJ+YFLIluGMf8Wi4pvXXqtLHves1QQPxuFiggmQkYMaR7AvE/JXdcH3RR2fQbHXxjFwpKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oZSIiHiS; 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="oZSIiHiS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE26C4CED2; Wed, 6 Nov 2024 02:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730859209; bh=iqC+OPH3hLESQQrFbTP3lgm0j0c9WFR7tDyYA1IV99c=; h=From:To:Cc:Subject:Date:From; b=oZSIiHiSdvaZ9jKFWzv6ogID36Or9YJVrT39hoaoIxT9WIJ5pTTXxyfpbuQawJq5w mBI1zRMBG9/KNbGlmoaLKHfkG5MSZ9PBWTwZWKPV+iC/O3ZIgpTOCc7Kiu7PlkNTX/ UWF6szF/yHot7NB/lI/XjQ++TIISDSGhtjk4rghskSrUo8VgzIBP5enWD0N76tqQKr quNmBsN77MBdjP64+TKSncdjVEa7D8899Q1K+8pJEKt1Bs1Hnukq8pL8lMwRCnem3c LQgCBisGwhRCQbCwCiwt+p1b4WLJk1y/5HpzdiolWJ7TdJKaAd1oFKKLMksId3PgVH 6qmoD1svtYmLQ== 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.4-stable tree Date: Tue, 5 Nov 2024 21:13:26 -0500 Message-ID: <20241106021327.183601-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.4-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