From nobody Mon Dec 1 23:05:39 2025 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E79C633121C for ; Fri, 28 Nov 2025 16:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764346018; cv=none; b=WZWd9xw3HnydzEQkxGNNll/pxC2/4qFQpZl5aaJ2lDtJcfrpUBLXRBDKM/fx/cZ5YHwOKRyQNHCsRkpfICigT/VglRGmtm43X2DlwMx7Gl/t6rF2Unyw8dm/mmsEpLNt8WEB0l3O3PfxxAB36ZzGsxoQxn9lQk5NaDs0C7X3bUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764346018; c=relaxed/simple; bh=e1DK8j+FiXmlj1eFN8Izgd5UcqsQJns59AycqwDqK3Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=sME5ZYMrAxfJl8KAUoDZtOMK03Qa9TlIlCtpCPZMRpHEZbuuBI2TNfnZWiKBBkNJZCYzqR6zGf1+vFMu4AVQaBCKfNR1qm0r/mtXU3kgPvOoMt/k7mQAsZa+dNSs3iXpOgbXI7Qb28jfVVrnVa9bWqZDvD8Y82BONs7ebSba7qI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LSnVXrK4; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LSnVXrK4" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7b8bbf16b71so2530610b3a.2 for ; Fri, 28 Nov 2025 08:06:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764346016; x=1764950816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UGmuQqZjeUhbRmxIHTmmKtGFb/p0zxMormCTfTuA8dI=; b=LSnVXrK4JYlK6lRi5kmSnpAEVKJ3fgpaHieT6TZE7N0mgytIO/j70w4IlnjO6dfhpx gy8/koJ1ahOd/dk0FX2m8mCUxD7JuFETywbRf2NGWfhHnuNU5PbBKopK+82HytLYAsN9 WivnVxOHNZHbwXLGlv3bI/tzi94Ok77hoKVwqBNxwosi4NxN3YWBBqPwwF8AnE/IEuXe 5shUCM4+3PVWPLRE9K1ceAjr522rn+er6XW5NjA+ZDZW4JaA7oJe5swMEq3nx1ytDTrO AM63RH6OPXazZsZkN6ijLctn8qt+oIDBR3dfx7yTzcHBO5OKJiWV+50rBV/Nx2518gAQ cPsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764346016; x=1764950816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UGmuQqZjeUhbRmxIHTmmKtGFb/p0zxMormCTfTuA8dI=; b=YKhyIi6v5wrjAwaYXNATUm3kKpe3VEJ2pvJTcV569EskEEzk4/BLHiDoL3Ll8pucNa Iu9xLMlVNhNygN9qnHcnq3Eez8S5j2pZo3rmTBRWPfv+3RVYMGpYRYq5lCvqfUyXTsLR 7gGpmci1UBM1G9tBZ7Uft4uyciO3Sn5XE9miMyz8bA5uhIH5kgStBH7fm4H0aG9/k3L6 KiAlKggSujN2A9sknpK2oVsJY4nfQ0yjjbhOswz/+jA3jKKBHEk+AkSRSEdgEYYOa1ek bXNwSGZD2rEzPQovvd3Ga2aV9DLMclTHBIae9S2PjDZFCCTy23AXR9aVwnh9KTRCoufD bnKQ== X-Forwarded-Encrypted: i=1; AJvYcCUGvpcmKlTof5b+BF8DYART9abrJC1WBQ0HeFIy2xNx2jmk3inK4p1npCsWD08MiMcX1w2505p0FK98vkA=@vger.kernel.org X-Gm-Message-State: AOJu0YztF9CZeqX8/5CubKrPobx6KIxoCzBDhFZsrLxwQF09x7n+7QaW v+D4T5hdlI/nXphfF2/yZUA25Nmb4RYwAYwmkRUdn7rQT1RSR2xEUrZR X-Gm-Gg: ASbGncsUPndIEKffz5woRoyKmHqunrP/M0l2uKL3RLmTIp0FL/ApW7oYzFHZysWqPc1 UBhtVG29tUFS518eNjVVXScapHfHW/caSjb4Y9zPYT+/0fi+gdTRxOAYQzEuxbb7L7WI4UZZr78 vck60DIDTHhcvBFvE4++/loZO8wAtMChFa8qVgOP8o5zsGOGZzgqb9ND8wb/Z1TJkwFeo78Tcge cN1hrCmRjG3T/miVdCdtT+JL7gEjMXYVRsT7T3tMyOxuGpewJCoi4Mek3mEC/JxPqUGzGXzEB4x N6bepMNIsLrBpdce5H95yVcS2SAfA4JfDqs9RgG2XEdad3PAECy+dVINyx5hBX7hzdQvkXFb4dN NbMO5FA/9KsLSGV3oF7G+ZYphVwsw/GZdLqHzsj/BvKnhYHM2hPFtAps5YJHCz6Pudt8//Vm6nt nLnv7eq+rQSW26G9XS6174bCeZdLxaydjiTHGrbA== X-Google-Smtp-Source: AGHT+IGqQi/OiFjS5pDqCveMxUEGU2hbXLOMS4pWdjHOTPjXEVY9szwG71GV7vAeUueeEkA+Bqs+sw== X-Received: by 2002:a05:6a21:33a3:b0:35e:4b35:3669 with SMTP id adf61e73a8af0-3614ed962d0mr30665526637.31.1764346016068; Fri, 28 Nov 2025 08:06:56 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.186.233]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7d15f26f11fsm5408499b3a.50.2025.11.28.08.06.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Nov 2025 08:06:55 -0800 (PST) From: Jeongjun Park To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, tglx@linutronix.de, Julia.Lawall@inria.fr, akpm@linux-foundation.org, anna-maria@linutronix.de, arnd@arndb.de, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, linux@roeck-us.net, luiz.dentz@gmail.com, marcel@holtmann.org, maz@kernel.org, peterz@infradead.org, rostedt@goodmis.org, sboyd@kernel.org, viresh.kumar@linaro.org, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.15.y 13/14] timers: Update the documentation to reflect on the new timer_shutdown() API Date: Sat, 29 Nov 2025 01:05:38 +0900 Message-Id: <20251128160539.358938-14-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251128160539.358938-1-aha310510@gmail.com> References: <20251128160539.358938-1-aha310510@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: "Steven Rostedt (Google)" [ Upstream commit a31323bef2b66455920d054b160c17d4240f8fd4 ] In order to make sure that a timer is not re-armed after it is stopped before freeing, a new shutdown state is added to the timer code. The API timer_shutdown_sync() and timer_shutdown() must be called before the object that holds the timer can be freed. Update the documentation to reflect this new workflow. [ tglx: Updated to the new semantics and updated the zh_CN version ] Signed-off-by: Steven Rostedt (Google) Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221110064147.712934793@goodmis.org Link: https://lore.kernel.org/r/20221123201625.375284489@linutronix.de Signed-off-by: Jeongjun Park --- Documentation/RCU/Design/Requirements/Requirements.rst | 2 +- Documentation/core-api/local_ops.rst | 2 +- Documentation/kernel-hacking/locking.rst | 5 +++++ Documentation/translations/zh_CN/core-api/local_ops.rst | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Docum= entation/RCU/Design/Requirements/Requirements.rst index 546f23abeca3..49387d823619 100644 --- a/Documentation/RCU/Design/Requirements/Requirements.rst +++ b/Documentation/RCU/Design/Requirements/Requirements.rst @@ -1858,7 +1858,7 @@ unloaded. After a given module has been unloaded, any= attempt to call one of its functions results in a segmentation fault. The module-unload functions must therefore cancel any delayed calls to loadable-module functions, for example, any outstanding mod_timer() must be dealt -with via timer_delete_sync() or similar. +with via timer_shutdown_sync() or similar. =20 Unfortunately, there is no way to cancel an RCU callback; once you invoke call_rcu(), the callback function is eventually going to be diff --git a/Documentation/core-api/local_ops.rst b/Documentation/core-api/= local_ops.rst index a84f8b0c7ab2..0b42ceaaf3c4 100644 --- a/Documentation/core-api/local_ops.rst +++ b/Documentation/core-api/local_ops.rst @@ -191,7 +191,7 @@ Here is a sample module which implements a basic per cp= u counter using =20 static void __exit test_exit(void) { - timer_delete_sync(&test_timer); + timer_shutdown_sync(&test_timer); } =20 module_init(test_init); diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kerne= l-hacking/locking.rst index c447d55fa080..3bbb11ba647a 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -1007,6 +1007,11 @@ calling add_timer() at the end of their timer functi= on). Because this is a fairly common case which is prone to races, you should use timer_delete_sync() (``include/linux/timer.h``) to =20 +Before freeing a timer, timer_shutdown() or timer_shutdown_sync() should be +called which will keep it from being rearmed. Any subsequent attempt to +rearm the timer will be silently ignored by the core code. + + Locking Speed =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 diff --git a/Documentation/translations/zh_CN/core-api/local_ops.rst b/Docu= mentation/translations/zh_CN/core-api/local_ops.rst index 22493b9b829c..eb5423f60f17 100644 --- a/Documentation/translations/zh_CN/core-api/local_ops.rst +++ b/Documentation/translations/zh_CN/core-api/local_ops.rst @@ -185,7 +185,7 @@ UP=E4=B9=8B=E9=97=B4=E6=B2=A1=E6=9C=89=E4=B8=8D=E5=90= =8C=E7=9A=84=E8=A1=8C=E4=B8=BA=EF=BC=8C=E5=9C=A8=E4=BD=A0=E7=9A=84=E6=9E=B6= =E6=9E=84=E7=9A=84 ``local.h`` =E4=B8=AD=E5=8C=85=E6=8B=AC ``asm-g =20 static void __exit test_exit(void) { - timer_delete_sync(&test_timer); + timer_shutdown_sync(&test_timer); } =20 module_init(test_init); --