From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (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 23B9834DCD1 for ; Thu, 19 Feb 2026 17:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521201; cv=none; b=VjavZxzX2SlsHF5rM94ad5WpniQ5SFaSoU81S4JEqMtDNi/DDbYybeV2p8HAWd8J4rHFBhqlJc0vsToRwLAL7gWrPLX9KwOJyS9xelC5oxY8JUYFXmDTeE+ytBAb6qqHg7QKeBb1V8km27tqwN0UCgZ4Svf8ft2/RV8K97Sw+z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521201; c=relaxed/simple; bh=BfuWtJpHFnoUxb8s7xJBVcBtioNVHYkElOeeOAD1d8Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lQCTJc9Wr3p1SSewqSspSz3LApNsD6DGWzxZnSIz4oPoeL760d3h8W2J5DFLL4ErwSZZHFCGuQDBZaEyec0Q3z9DGDOyXJZidEQosswcLX0YAd32w8yhOLj8McWdG1HI5iq9vvJ8POVQi6ahNIFy8oXIgKjPgu1nPQjVNoj49Rs= 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=fhm5+CsQ; arc=none smtp.client-ip=209.85.210.195 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="fhm5+CsQ" Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-824a9348603so494454b3a.2 for ; Thu, 19 Feb 2026 09:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521199; x=1772125999; 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=rGAsWoT0ij2AF8u7lzQ99aTp0zEqYgQwfONKoWXhuNs=; b=fhm5+CsQ011ZwA//aWYGTjUA62K/WCYqJGHfvR5IrgA+HqQl1FZ4ODO0vHZbYrTlwV 2gkScdkOKK8l7mVWYvqh+NTqDbwXtlQmwH2adQiMN+i1wY+9fieH/+JPHS/xOcahjOXL AC4w2y3vdDeoaYOhOquVEBH1CLyIVEirjBh00V+6tVt+yFW1ZJZb3zt6xl0QbNbVKNuV iIJ8wxqin1PbUtwrHQk0lxPQGd/GLYw0PEdO4EYwk590TNARvescSTIj6iUWkXk5BWQ1 S/yfU2ESOD1XlF9J07B8e+gdpMg9DbaxevNIC7KFaj3m0HFq+F+Ub65t0oq/gDtKaMe6 NMmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521199; x=1772125999; 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=rGAsWoT0ij2AF8u7lzQ99aTp0zEqYgQwfONKoWXhuNs=; b=Z6mMYqqak348sncS+VPjWuaWVJ8Y7ww8Wa+te8Gg9lC03GRHB0mIL5QwolVCz2tFaU Paw1kV7rc9QqTRehT6qxzyKy/HNdN+tWQWq5sr8uaNLK6i6anNLrXFLQYi1YkND0Ff0O xdJarCFSgSzMw/yaRvwuQeejPRP4krN8GZE8KB2cm3Q2iFu1N6vOE/1VjX7kdMCi+yye XAIekXXJDDiaYffTJLHKf3oHvGhwoPBlFuhF+LH8HtVa+bvAcj6X4N+vOHajkybdZC0f SxqsOyApnShliw/65Jy1FKKlqX6E/03P8gx5TUBvLlruBq3DzElce46k5lvvyYHX8wy7 yBYA== X-Forwarded-Encrypted: i=1; AJvYcCWfH4PFZy0yFT1hmWLvHtqsMydyoOzEN8cpTy08F/RbPQXAq0uRoR9F5tN+1WwEp82NzMKBN8ATIpre9EE=@vger.kernel.org X-Gm-Message-State: AOJu0YyQ4keTwm2EeU9QsPuR2rM9yHn4VlUWPgPjkNWy6Y9EWXgn9dl1 MhfUO6LnPU/OQeswNguuXFZmGqs5vpqCW2faBuc+TgZBtKh8JFHiyQFk X-Gm-Gg: AZuq6aKuSdlYivEi96OBXWE57OEb68EuNdaQNFF6HPlByoJxnZdS1SbWC3dkxtNgHei JQF9jnGevU36YeMgFyWMwCDJ3RRPNbzKpXyXM1dkoNchQtGb7OYFWQNh6uQOurfgulHtEkmTSmV FRiPi0L7931UgNW31MzMB+dOX+FFh0EVe5tXzk3WTlB0okkClH/joGYTe3Hp+gN+4LCIEePnw0N F/fyFGWC/2x7qcy4BUxkPjkW2/MRLX5vuz35k6pO3LmP8MtVZayd7MSNLi3eVi7I0BZsaZWf+dc PxvzKzYqUqjZWHw4NcMtVNtUJ/7JK3o5eiLW/EEYhOrH7FBtaFhrgGbD8Ug1rRN8aSkKtji4KQx 41uT7UoYH6tpYv4iPkoIIqN8c2MxrUTDFL0vsMo/LAfwjEwqg8WwwANhMq9eFNPlmT/U5jN9Y2k B5sw5h6tiz37at1MBv8g8piFoDY3rkJTPcpiE3lci6ENpImpoSucJvKWATMaoB X-Received: by 2002:a05:6a20:d81a:b0:366:14af:9bb4 with SMTP id adf61e73a8af0-3946c96fef3mr21545093637.62.1771521199469; Thu, 19 Feb 2026 09:13:19 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:19 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 01/15] Documentation: Remove bogus claim about del_timer_sync() Date: Fri, 20 Feb 2026 02:12:56 +0900 Message-Id: <20260219171310.118170-2-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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: Thomas Gleixner [ Upstream commit b0b0aa5d858d4d2fe39a5e4486e0550e858108f6 ] del_timer_sync() does not return the number of times it tried to delete the timer which rearms itself. It's clearly documented: The function returns whether it has deactivated a pending timer or not. This part of the documentation is from 2003 where del_timer_sync() really returned the number of deletion attempts for unknown reasons. The code was rewritten in 2005, but the documentation was not updated. Signed-off-by: Thomas Gleixner Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201624.452282769@linutronix.de Signed-off-by: Jeongjun Park --- Documentation/kernel-hacking/locking.rst | 3 +-- Documentation/translations/it_IT/kernel-hacking/locking.rst | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kerne= l-hacking/locking.rst index 6805ae6e86e6..b26e4a3a9b7e 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -1006,8 +1006,7 @@ Another common problem is deleting timers which resta= rt themselves (by calling add_timer() at the end of their timer function). Because this is a fairly common case which is prone to races, you should use del_timer_sync() (``include/linux/timer.h``) to -handle this case. It returns the number of times the timer had to be -deleted before we finally stopped it from adding itself back in. +handle this case. =20 Locking Speed =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/= Documentation/translations/it_IT/kernel-hacking/locking.rst index 51af37f2d621..eddfba806e13 100644 --- a/Documentation/translations/it_IT/kernel-hacking/locking.rst +++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst @@ -1027,9 +1027,7 @@ Un altro problema =C3=A8 l'eliminazione dei temporizz= atori che si riavviano da soli (chiamando add_timer() alla fine della loro esecuzione). Dato che questo =C3=A8 un problema abbastanza comune con una propensione alle corse critiche, dovreste usare del_timer_sync() -(``include/linux/timer.h``) per gestire questo caso. Questa ritorna il -numero di volte che il temporizzatore =C3=A8 stato interrotto prima che -fosse in grado di fermarlo senza che si riavviasse. +(``include/linux/timer.h``) per gestire questo caso. =20 Velocit=C3=A0 della sincronizzazione =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D -- From nobody Fri Apr 3 09:52:01 2026 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 6F28534D393 for ; Thu, 19 Feb 2026 17:13:24 +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=1771521205; cv=none; b=NVbUR/9tVrrwC5Q1Nc29CouAAajN+tZHMoPXkH69i8yZDoRnLe+Nv6OFxIIRrSiHe3DbIqm0oRkpl+aDcN/TciZjUl8KLTnud7JRS3RyshqYapEwOQEfsVaiJHpdpoRGG1KFAWc3Zj9HydzJ2jDsxhHD0bOXBz/Z4UR+39J6gnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521205; c=relaxed/simple; bh=FgQfbLiyDT66S+sNI1wE/oslfO+pvzybNJFnYppNieM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PSEJo/gbYG4xX2iZye8SA+wkmlGbql6o/PSl7AKLRNNZatGIuiDgdZFmXdm54Af460rUNuLsiYrgSJ9uWdrSz1R+Hg70ltmbgbDMP9sBNeUpgujm3zvPfysDproBQhE3IY8nEIstp3I9ry3QXo2oPStpyFuE4AQ73iu9uRMpgmU= 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=BH7VRoc1; 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="BH7VRoc1" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-82318b640beso616221b3a.0 for ; Thu, 19 Feb 2026 09:13:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521204; x=1772126004; 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=89KuTptWUmkm9h+FhspeGpsBdyDf36NNXIP8b7hhqek=; b=BH7VRoc1sc/CwuoO/dLbXTiwZb06cO+UinnRhpzQQzplqMSCxnzOaboHEfeop65UOv gnQq0L/DyPWVNYaIhlhQVQHYOtm5c0+THmf+fGS5kuWN3FDN+aBSVVp8mjRGBsZdvgNQ crFOQUGvnb7oW1aWIFOvtiHaK1/+y9tPXDM2Jp2TU5lFPW6MpfP2uX3DyH9bHKCR8P/8 1rRElxM4+lpNEhFGPIUHnwH5uGPKbvasBRXchUGCj7NKeFNmK7E0tzbdY5znZ924KDIJ 52eigSOJlS6C6njPOfINNVvBMl4St+KFab7fqraAHwRDDj7AaktvyRLhmD1BiEsaZJjS OW8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521204; x=1772126004; 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=89KuTptWUmkm9h+FhspeGpsBdyDf36NNXIP8b7hhqek=; b=JtYanU1Y2NI+3D5/rbNUHvDY40AvZYwvDNWaOFtaFAj775nJ0LSA0pTinwzIWtxzDe h4Ua75yWzPzW+zdKxylZ8x4AazLbEH/zwC/b7RiYuzR7jpdCZDaVBcogpxzISCTzqjvC cRzajSyrEZpssemWjoNN6eyxivxbIS+1OnNIkUoi2evHHv3XJbaDo/kun4nTV0KPQkmY hFX9WqIZdNsbFJBOTmlG1iN+3iZz4oU+U4LTfj18KbLF9oTcKuh+JDAFJqsu9BsTpkiM i7Cxp/piEh7yJBSfRWS3IZh6pAPAyCmMda2WuBPa7ATOn7D1+Dixqh+f00D8U4Q9PHlN mrvA== X-Forwarded-Encrypted: i=1; AJvYcCWawlQBu0RAxj+fHkaabu/ZYlHOUdCK7qYn2K+EGDpIvAp1QYwrBccdxlVdJ5SyDHTCYWa/N80Bn9F1NtE=@vger.kernel.org X-Gm-Message-State: AOJu0YwfG3KSsqmRDWbT/tO/ff3GjNetuetH3or9N1DzXkhEwrIw++cF wIEvB1/B9Mc1nnaPkyBLLfNcbdgO1atbGxoIdBaxwDSY/dgMzdIC5Yqo X-Gm-Gg: AZuq6aIBOKni2akw7bzMFNZitYZ4FjlGuZE3y+bteyijEy0FSOWhm0V/I9QZlJi92DH VVT+zLUISQPSszoWzsvz02KJZQygCfifCS2xN13jFwQCrn1G1y9bYQ7S94LPSgJSdv7fE9PZgbL Z3/a05Kcb8bhRXuo5FCh2xx9nGo5nNQvl2r8d4YbTm2iKOayWTQ6YX3prplliqOVQqZeIvS1YXE Y0BKn5F/wpZJ3VPVJVOraBBKE3U8zVEGlr7t8rLmwI7j/EcOoZZRH3x46OILHhPbk6nfTZenrfj X9x6wGQmoUp55Z3c6vUF5d/7k75tPE+6RmNAEOtgA2uQcyvZ+Y+e0L+pkyQXH+1n2I5WmTc0fdx ILWK4CEv1G47goKpM4gvEBsrkbKh+vr9Vz3ZE1bwR1pvaJwYiDxeeTfcQpO+RyDW2Mnyb2cv4cX qoIvhVpaHPBKrX8tfrCjYkyY4fjc68/XBN/b7dGzBk+OZ2A83Sww== X-Received: by 2002:a05:6a21:62c8:b0:366:5332:466 with SMTP id adf61e73a8af0-394fc2fd726mr5605743637.53.1771521203784; Thu, 19 Feb 2026 09:13:23 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:23 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 02/15] ARM: spear: Do not use timer namespace for timer_shutdown() function Date: Fri, 20 Feb 2026 02:12:57 +0900 Message-Id: <20260219171310.118170-3-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" [ Upstream commit 80b55772d41d8afec68dbc4ff0368a9fe5d1f390 ] A new "shutdown" timer state is being added to the generic timer code. One of the functions to change the timer into the state is called "timer_shutdown()". This means that there can not be other functions called "timer_shutdown()" as the timer code owns the "timer_*" name space. Rename timer_shutdown() to spear_timer_shutdown() to avoid this conflict. Signed-off-by: Steven Rostedt (Google) Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Acked-by: Arnd Bergmann Acked-by: Viresh Kumar Link: https://lkml.kernel.org/r/20221106212701.822440504@goodmis.org Link: https://lore.kernel.org/all/20221105060155.228348078@goodmis.org/ Link: https://lore.kernel.org/r/20221110064146.810953418@goodmis.org Link: https://lore.kernel.org/r/20221123201624.513863211@linutronix.de Signed-off-by: Jeongjun Park --- arch/arm/mach-spear/time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c index e979e2197f8e..5371c824786d 100644 --- a/arch/arm/mach-spear/time.c +++ b/arch/arm/mach-spear/time.c @@ -90,7 +90,7 @@ static void __init spear_clocksource_init(void) 200, 16, clocksource_mmio_readw_up); } =20 -static inline void timer_shutdown(struct clock_event_device *evt) +static inline void spear_timer_shutdown(struct clock_event_device *evt) { u16 val =3D readw(gpt_base + CR(CLKEVT)); =20 @@ -101,7 +101,7 @@ static inline void timer_shutdown(struct clock_event_de= vice *evt) =20 static int spear_shutdown(struct clock_event_device *evt) { - timer_shutdown(evt); + spear_timer_shutdown(evt); =20 return 0; } @@ -111,7 +111,7 @@ static int spear_set_oneshot(struct clock_event_device = *evt) u16 val; =20 /* stop the timer */ - timer_shutdown(evt); + spear_timer_shutdown(evt); =20 val =3D readw(gpt_base + CR(CLKEVT)); val |=3D CTRL_ONE_SHOT; @@ -126,7 +126,7 @@ static int spear_set_periodic(struct clock_event_device= *evt) u16 val; =20 /* stop the timer */ - timer_shutdown(evt); + spear_timer_shutdown(evt); =20 period =3D clk_get_rate(gpt_clk) / HZ; period >>=3D CTRL_PRESCALER16; -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 C34E834DB44 for ; Thu, 19 Feb 2026 17:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521211; cv=none; b=bptC7b9hCnVd+VaGM+E499dVa+cyyWqI8l/8A8cZbFVuPYJFpM+6lnp40AdDgAvR1dPsiLEZ5K6E5V0O+ksuGUFOz7c8hh9mZfrLjZ17arvx/IFk6SIw+AjaNJVZx9z302HMXZgXSrS8iJcdHxLeh6PIjD1kF6m4PuqqixTpIFE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521211; c=relaxed/simple; bh=YY7i+ekw8WEClpFqVZfbZbIPcOFXG9mqoVtYSHhdgrE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nWwKtnLFiQoYZDbEnSuO0e06aAJ6Wr+OiyQiLRS+5vTgTS0UosNP2yX+sn88kYkLsQLW6sjf0USX5Iygm8f9mjUFUHikSi+ryZkAWwCWoEIqBkZpcEVU1s2IUptGgwEWE44euq8zxeu9ahSpoBtZHCGjkVL5Mbnuqx8ca5gq+O0= 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=jR00ZLgb; arc=none smtp.client-ip=209.85.210.176 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="jR00ZLgb" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-823081bb15fso661530b3a.3 for ; Thu, 19 Feb 2026 09:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521208; x=1772126008; 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=Lru4V+cwKFfxLK/nzfZUd/f7wkQ+5dEE9KWoaatQVPo=; b=jR00ZLgbANM9QQcV6D1qJrZXE56WthEzEZ/6cBIiXYM3oppVe7F9M6qiq0g1aTyy2U 9RU3gzgybGUrlFOclauBaMFM8Pjri1YBXFs6zeIUMulSYXvkaxlRxVNUEqXz84QS1hlh ei43FJYHkEf/s/LyLMUYeAJT6UXdpxzPc0EFg273eS9dm2LNlyQzFehc+3Di0C8MLDdc LAdN6Nw14anWlSnNvDX90x23v4ntd2aZIhv/nj09v35hLvtXYDEGcTHweSxR+OIcqXy+ IUKj2uUNw0lwKvRbXY+z3/nqZEX+4oBXsmBsZmSSfwASZV5ZqWS++Oaj+JPn6iOUE0y4 uN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521208; x=1772126008; 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=Lru4V+cwKFfxLK/nzfZUd/f7wkQ+5dEE9KWoaatQVPo=; b=XWJPKNb8SR0R519EQuXDVW691sQ2NDexh1AsyqPJGsdq51S0H+NHAwt4iH4NpY8F0o HTqqdHrp7xMFtkdWPJYJONIAYJQz6YWNS9OXKh06WOmK/7coyLsw+0mzGUnK8B8wdN7j mON5XGX6cflwkeQ8EhA5Y4eZrD9BvPK2quXKVfU5GLIYVPwH5TqqHqThtc0zPMgA0ePs y/8Zjt4rZ1ug/wlojLo+AyunIWZCYPUO/X+p7GaVgSbIy8iH9g08s+fcGN6PMW0EW8Wz 3s1PRGBfL+TuW/To7BpXul6AwyFMpWp2Nzk9MlA48NBauFjswpm9XqdD+ZN7xdvEfqP1 jc9g== X-Forwarded-Encrypted: i=1; AJvYcCUZqbvlDmmTEzsX8MwQnxuwTbPnJzvlltSlqbcqL2LVB3G3U87FfnUm4BFg2/X7VMWNFwKcJB9nB5zi5yQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyEvauRT7NhlAVL/wv3GVFrLHEsuLQPMTXP5AhczzmPd2d3PHAD dIRbK4faNrSDtg1QeU0G69qS4itpgvUQcFzNQAe1//SSWvK+IdRnyf3k X-Gm-Gg: AZuq6aIqZj/dfT/Jx4eRHprEDLG3s9qMSV7te0ar3ll97q/ZvffMkNRYt93lJ4xyzNZ E9DP1d7ClqjFh4fVO2hcrtxnObwgKV1hgKPlZEmssWTsilI0XF4JU+x5rhi/dy3t0b3IoR3iGE7 OkKvIYAkhRRrtAoIHaFAzRpmWWggH0Hnfad2YXvaa1TJN7w0aQuBvWZU//oUeep5epwPYLT/Lox ns8WCk26dYdpO+nT8dyICsc0NcrxIvbGCm9NEPH6x8E1PCKMBhIxHiIpvvN/t+K50Y9l6AePl+s nbda7RqgSXC64HS7VPmnKbf4+sA5k6+ueQzAXJPZN0z9dqHPzOsTEqv4HNILe43XqGKDR0ti4w/ Kw/VkU7rvwcitAhVoN6gcY0LJKKS00S/IkFrduHPVSSy7IVr5ZgCgSom2aJF0nTTDjr1BgCnNHv x/LQcRHmcm2RAYPutaTwwIyUXiSWzT+h3qDqD6a3W91ifPBDJbBQ== X-Received: by 2002:a05:6a21:4c03:b0:38d:e9e8:25e0 with SMTP id adf61e73a8af0-39483897793mr17324026637.20.1771521208129; Thu, 19 Feb 2026 09:13:28 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:27 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 03/15] clocksource/drivers/arm_arch_timer: Do not use timer namespace for timer_shutdown() function Date: Fri, 20 Feb 2026 02:12:58 +0900 Message-Id: <20260219171310.118170-4-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" [ Upstream commit 73737a5833ace25a8408b0d3b783637cb6bf29d1 ] A new "shutdown" timer state is being added to the generic timer code. One of the functions to change the timer into the state is called "timer_shutdown()". This means that there can not be other functions called "timer_shutdown()" as the timer code owns the "timer_*" name space. Rename timer_shutdown() to arch_timer_shutdown() to avoid this conflict. Signed-off-by: Steven Rostedt (Google) Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Acked-by: Marc Zyngier Link: https://lkml.kernel.org/r/20221106212702.002251651@goodmis.org Link: https://lore.kernel.org/all/20221105060155.409832154@goodmis.org/ Link: https://lore.kernel.org/r/20221110064146.981725531@goodmis.org Link: https://lore.kernel.org/r/20221123201624.574672568@linutronix.de Signed-off-by: Jeongjun Park --- drivers/clocksource/arm_arch_timer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm= _arch_timer.c index fee1c4bf1021..ddcbf2b19651 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -687,8 +687,8 @@ static irqreturn_t arch_timer_handler_virt_mem(int irq,= void *dev_id) return timer_handler(ARCH_TIMER_MEM_VIRT_ACCESS, evt); } =20 -static __always_inline int timer_shutdown(const int access, - struct clock_event_device *clk) +static __always_inline int arch_timer_shutdown(const int access, + struct clock_event_device *clk) { unsigned long ctrl; =20 @@ -701,22 +701,22 @@ static __always_inline int timer_shutdown(const int a= ccess, =20 static int arch_timer_shutdown_virt(struct clock_event_device *clk) { - return timer_shutdown(ARCH_TIMER_VIRT_ACCESS, clk); + return arch_timer_shutdown(ARCH_TIMER_VIRT_ACCESS, clk); } =20 static int arch_timer_shutdown_phys(struct clock_event_device *clk) { - return timer_shutdown(ARCH_TIMER_PHYS_ACCESS, clk); + return arch_timer_shutdown(ARCH_TIMER_PHYS_ACCESS, clk); } =20 static int arch_timer_shutdown_virt_mem(struct clock_event_device *clk) { - return timer_shutdown(ARCH_TIMER_MEM_VIRT_ACCESS, clk); + return arch_timer_shutdown(ARCH_TIMER_MEM_VIRT_ACCESS, clk); } =20 static int arch_timer_shutdown_phys_mem(struct clock_event_device *clk) { - return timer_shutdown(ARCH_TIMER_MEM_PHYS_ACCESS, clk); + return arch_timer_shutdown(ARCH_TIMER_MEM_PHYS_ACCESS, clk); } =20 static __always_inline void set_next_event(const int access, unsigned long= evt, -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 085BD34DCD1 for ; Thu, 19 Feb 2026 17:13:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521214; cv=none; b=O1oodlHMCkUDZ2/sM1NfTna7ryRSf6gcvb9CBCPkHxl0zN5APaiQqoaLdDn0zTDWvTAeAfRBb20gJld6c/EdYQes8EaLrNGw8vmOct1Y0mPCwDRT6Yy4GyMISwynnxRYKBLsmoh37wCohcuhlMavDbw+6CTUx15guq+8kXaruWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521214; c=relaxed/simple; bh=kyxULOv2H236l1ucHIwcTRr5nnWT32c4Zye+wWGrJ6s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=araVMY8u3gT6z/5fNPm2pXSR8zURAkDH/ssKqhs+oyQ2QqdMJjqPT3+h2tyf8KD3iJ+l9qGGJZWbGc53IqYrOg4qd9yrA6hQ0aGJTr0Ql8FX/Rzku37LCrPHEccDOvkNKa3z0exgFu0p2DyAML5ZIAp82IA5ZuOuwzn13mVoFj8= 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=W3Bp0l3H; arc=none smtp.client-ip=209.85.210.174 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="W3Bp0l3H" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-8249fc726e9so609078b3a.2 for ; Thu, 19 Feb 2026 09:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521212; x=1772126012; 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=scjH6AQBXgOEyOguxVYTHq5LOFFjJgFpmI1fsS6Z7tY=; b=W3Bp0l3HAahee6jM1ZFsDQY48RFSKlrq9I2k1a0rW5Pr8PGi0dstQu6Ye4Pwlh//36 vyUFE2XWfsxvdUjrh3kFAWNcjJgBWHineh1GaJWMURPIlIPgyKh9KrSqcYQMkdLPrG5N HlHfPj2BGJ3H+I/JXIwjZzZH9gZTEkFMPrgomSWxZq+A6igRcS7FmKMnbh6K0DudrhPM TjLf/lqvebR+svC8AoIChIaxlUlM5H6bjQrRPFHPlM9lkluXqsq4gCA3Rn9z/9kXgUza py6/waBbNlDwJ00ON8OIXF8dV0lE7aKrJ0O5hOxnT6fL0EZRJWDKp/hOMVCVXgcM4wcv da7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521212; x=1772126012; 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=scjH6AQBXgOEyOguxVYTHq5LOFFjJgFpmI1fsS6Z7tY=; b=u/ZmoOHgJw7zgQmTKRrKFrs6dQYWFzZDSxKM9UZk6DHSlyoaxNsP+7BaoeiftbX276 dPZ7qJnU0zj2DgDhIsLT37un+ihBZUPluA6YTxG3BH6g4ozKJm9b3WHEAl/MBOuELxJK 8TY2JlzLwNTywm17mQO1aeghgO3gdMxK1PzrPvgcRvliIbgG0RLol89dWeT4TbroVtOH JDzu8TI74y0ycwFkuAa/hlReYcKDbtfNoqiY2tM0/GhyTYsc3An2APJQMItn8Q4L/IfR DtfJ5B+d1l+9zG3hO3AUThiJMAe1ckDT/Ax6H4gFizenGCgPaJg0bDCZOWF0FHtFrsqd mg0Q== X-Forwarded-Encrypted: i=1; AJvYcCXCHDIm/asOr4pHDktxKlV9TqSMjA2s9GS6epG/tR/AwyLXSF6BtwiLRApnoXPbqExMZ1lCiZ7MMLtYUhA=@vger.kernel.org X-Gm-Message-State: AOJu0YyqjTm09uCWeN0CBvWS4COrHRHb8W9GNfEcFn5hrQ0zFYwrWLnq NNdpvgMbO7e4a/CFKpS00wQvqQfVi9SUWnc9Q4a2atzHyWOtJalEWygF X-Gm-Gg: AZuq6aIGRlUvt38X+YhRDlbrIqqLFXaDj28+/Z0Qyz6t2+/+cx48LxxY8ZK6MSTL16q UI90Gs3dHxmKu/Lk2ja87/Y6rwVJwBG9DZ7w8plh9p9jwJK76pOWIfmEJS0G8AJkgEmUGhFD5T7 v5wGGwV1rL5g8nBkR1lJXTiLXUbVdEMvi1zicPQ8bzkj6pVJ1G0B4bmW5fWigZ/4KakncAJU7vY MV9ZB22yrnkyA3jkHcRSO1wyBVTn88bsqK7bkwZPemJa2/dyCSqaTT8Zzv9lsdCSjc+cbXznYyQ OUW9jj9Tjawop88eKVAVTKbdDnxSQqBEA/pTopmqhqQ8JgNB/l+VQ7JNA39elosGFvjCUSu1k0G xrU2fbFdB6297p82he8dZGMsqB+vYlEaWEFkebnPdyqRbho0mAsRgjrfsFIyOckkfnEeZboGpzP yY2beVfYFouMbo+NcPoZ8mMPvrym5a6v9pcqzMwJrQTU/QUq/37r5MFwp7Gpae X-Received: by 2002:a05:6a21:1645:b0:38d:f08d:b349 with SMTP id adf61e73a8af0-394839d554cmr16555786637.43.1771521212312; Thu, 19 Feb 2026 09:13:32 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:31 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 04/15] clocksource/drivers/sp804: Do not use timer namespace for timer_shutdown() function Date: Fri, 20 Feb 2026 02:12:59 +0900 Message-Id: <20260219171310.118170-5-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" [ Upstream commit 6e1fc2591f116dfb20b65cf27356475461d61bd8 ] A new "shutdown" timer state is being added to the generic timer code. One of the functions to change the timer into the state is called "timer_shutdown()". This means that there can not be other functions called "timer_shutdown()" as the timer code owns the "timer_*" name space. Rename timer_shutdown() to evt_timer_shutdown() to avoid this conflict. Signed-off-by: Steven Rostedt (Google) Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lkml.kernel.org/r/20221106212702.182883323@goodmis.org Link: https://lore.kernel.org/all/20221105060155.592778858@goodmis.org/ Link: https://lore.kernel.org/r/20221110064147.158230501@goodmis.org Link: https://lore.kernel.org/r/20221123201624.634354813@linutronix.de Signed-off-by: Jeongjun Park --- drivers/clocksource/timer-sp804.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-= sp804.c index e6a87f4af2b5..cd1916c05325 100644 --- a/drivers/clocksource/timer-sp804.c +++ b/drivers/clocksource/timer-sp804.c @@ -155,14 +155,14 @@ static irqreturn_t sp804_timer_interrupt(int irq, voi= d *dev_id) return IRQ_HANDLED; } =20 -static inline void timer_shutdown(struct clock_event_device *evt) +static inline void evt_timer_shutdown(struct clock_event_device *evt) { writel(0, common_clkevt->ctrl); } =20 static int sp804_shutdown(struct clock_event_device *evt) { - timer_shutdown(evt); + evt_timer_shutdown(evt); return 0; } =20 @@ -171,7 +171,7 @@ static int sp804_set_periodic(struct clock_event_device= *evt) unsigned long ctrl =3D TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE; =20 - timer_shutdown(evt); + evt_timer_shutdown(evt); writel(common_clkevt->reload, common_clkevt->load); writel(ctrl, common_clkevt->ctrl); return 0; -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 1EE4B34D922 for ; Thu, 19 Feb 2026 17:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521218; cv=none; b=YI2wN1WQOFUQ9i6qXGhCqxlzWMZdbP/hsQI84Rk3xQ3i7TOAD5IoGWt4Ws3kiO9eTZqkR7qPgytCLYTc3+va+jrKOQuWKrHKpKSt+l24i7ll5aNawrz05egVFnZkMpiefnDsnAqXXjA1iZyLnip2b1mEoNa2JgnhNcu1pZKGjAw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521218; c=relaxed/simple; bh=HhT6z2DVcZ8yTv/m6DHxcDKqHPAmK3H4JJhD4dhIVH0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RnYBFv4Z5SvB0nBEXpi4RMYGdGUyfpjjROKGmsEGW9qyvVfjWMAzEhuN7z3KkGo1BlecI8Efb9TZDyP7z55i6mcqIayTjs5+ehWfVKdb978Mh7NRhErJvKfTHoAMV4AZVO/3xlUFPE2SGcLWN+a8Lj1uRTABxw3ZKg31IfGL4O4= 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=iSqKh1Et; arc=none smtp.client-ip=209.85.210.177 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="iSqKh1Et" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-824ba8f0acaso802152b3a.1 for ; Thu, 19 Feb 2026 09:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521216; x=1772126016; 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=2Ivwth3bvYn00MIlpqUjU3pfVj9NAWsfF7rOKTWPDVU=; b=iSqKh1EtcQq3Vw7JlOgIlbG/jUIdobO7x/7X68R9/m/62XmQG6tIi4l913RcKGad/u ixrurEoIFtrSqU5NDv4klM4yFtm/Qa2NWFBu4Y6HDe9uRdXij2vCLmhXNPn2O6ddtfSk 0mX0osBfgp/93jWe+fRehNQ74bMml9qc4lAIusGSbdzpelqlZGt71UjSnIqIhl/gJT19 V+/1t+utSKktCRCyWbSLfs99k5i+bbkdI31jC589PB6cjQRQGia/ygRpAGmZ2ul6jCjo P/3z8fQltix+jnxd9iHgEVBvFN2mbgjg386NI0MrR5c1sAjcZ/ZsLwTz+VGxKm22erfM +rmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521216; x=1772126016; 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=2Ivwth3bvYn00MIlpqUjU3pfVj9NAWsfF7rOKTWPDVU=; b=IGakr/eqffEWqHwLB/bgrAFiQLNQpqR3BnSWHSFvZr8yvbcTyEwnJEGCtjuT1236Bm b/kfqlb9HjTvBLImseAftjy5SDjbNlpCNfCv+3rl7BRWR307IP04OPTy5Qj3RubY4Z+f y0GIb/ABCwwh6IJwnI8NNjrOzTarbgXIuPMZzMtGkjJaSCJotsM4mu7/4whuONhWOuaX D9xXEO9d+8RsHAb9AIyxycD9zIcCpK30Qrclk0/B/pF8ZOPeIag7Sxv/mTVvH5x2D+UB 3A+WydoSTgqlpDroZNeMLnBJrSzMWYDnQY5d8ehEHy9ZiM3THpNRl3I5ZDWilh6SzlIA kR+Q== X-Forwarded-Encrypted: i=1; AJvYcCWTP+ak4nRncorunD0l+bi9fDHrKR8le20QTUZDd9HWyAVgDNqqU7q8vEi6CI9XpHOYX9Ubk5dYuhsXais=@vger.kernel.org X-Gm-Message-State: AOJu0YyLDglUBN9MVGsEV69yK0Ec0NEH5Z/Np6MN3K7YM6JaVgoiCHTY wS4j2VgxnWh0AFcF5AAAcNI6TLe74EZSeTh7im89tNWvXTFbjht/CJS3 X-Gm-Gg: AZuq6aI3NGagNaMTecdFiCcjdxfZUlq8ZZsyv73eTMmsBMg26JxkXFqaGOMKbR6TUPI 7LcVqGzuzeYBcQ6bJk+awSClHDZNI3MEbpY/iwMbZi/9FHwK6XByI5Bwu828lhgMllfQ4BXbpsT VZtr9TbhXweA9Lr4Erx7+BF1HEmog7F6W04S4KPRJzVNiH34DyuVhAoZ1+m+0mh+2sUSVtUBr9Q uZJXLW82V44qjIC24ycXAAtfJgjC3oneWTxQ+5EQiZKDc//38NOevQpnfg8dH6hzBl1Dlo54MKT vT79UYfqOF/s5V4CWJHO3FurNMRyPeyN5LjdeTj/uazIQZTwwnu0OiJixxRDTedDXeheccCl34m GZlp/TfGq4k6RKZTEGJ7ekNEd0nqLW5l5gwZfZDGPMLzf2blwMczuBmw5+4Nlza18C33h6+mn65 nxaUu9GmNsv/e3qWiHOvWdZH58xNRjheSkxSa2oBpb+UPNml5rL7/z0Mi7wlG9 X-Received: by 2002:a05:6a21:6b05:b0:34f:b660:770d with SMTP id adf61e73a8af0-3946c95590dmr18861831637.55.1771521216447; Thu, 19 Feb 2026 09:13:36 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:35 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 05/15] timers: Get rid of del_singleshot_timer_sync() Date: Fri, 20 Feb 2026 02:13:00 +0900 Message-Id: <20260219171310.118170-6-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 9a5a305686971f4be10c6d7251c8348d74b3e014 ] del_singleshot_timer_sync() used to be an optimization for deleting timers which are not rearmed from the timer callback function. This optimization turned out to be broken and got mapped to del_timer_sync() about 17 years ago. Get rid of the undocumented indirection and use del_timer_sync() directly. No functional change. Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201624.706987932@linutronix.de Signed-off-by: Jeongjun Park --- drivers/char/tpm/tpm-dev-common.c | 4 ++-- drivers/staging/wlan-ng/hfa384x_usb.c | 4 ++-- drivers/staging/wlan-ng/prism2usb.c | 6 +++--- include/linux/timer.h | 2 -- kernel/time/timer.c | 2 +- net/sunrpc/xprt.c | 2 +- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-c= ommon.c index 56e56a09cc90..c3fbbf4d3db7 100644 --- a/drivers/char/tpm/tpm-dev-common.c +++ b/drivers/char/tpm/tpm-dev-common.c @@ -157,7 +157,7 @@ ssize_t tpm_common_read(struct file *file, char __user = *buf, out: if (!priv->response_length) { *off =3D 0; - del_singleshot_timer_sync(&priv->user_read_timer); + del_timer_sync(&priv->user_read_timer); flush_work(&priv->timeout_work); } mutex_unlock(&priv->buffer_mutex); @@ -264,7 +264,7 @@ __poll_t tpm_common_poll(struct file *file, poll_table = *wait) void tpm_common_release(struct file *file, struct file_priv *priv) { flush_work(&priv->async_work); - del_singleshot_timer_sync(&priv->user_read_timer); + del_timer_sync(&priv->user_read_timer); flush_work(&priv->timeout_work); file->private_data =3D NULL; priv->response_length =3D 0; diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-n= g/hfa384x_usb.c index 0d869b5e309c..8687e0bf3315 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -1116,8 +1116,8 @@ static int hfa384x_usbctlx_complete_sync(struct hfa38= 4x *hw, if (ctlx =3D=3D get_active_ctlx(hw)) { spin_unlock_irqrestore(&hw->ctlxq.lock, flags); =20 - del_singleshot_timer_sync(&hw->reqtimer); - del_singleshot_timer_sync(&hw->resptimer); + del_timer_sync(&hw->reqtimer); + del_timer_sync(&hw->resptimer); hw->req_timer_done =3D 1; hw->resp_timer_done =3D 1; usb_kill_urb(&hw->ctlx_urb); diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/= prism2usb.c index 4b08dc1da4f9..83fcb937a58e 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -171,9 +171,9 @@ static void prism2sta_disconnect_usb(struct usb_interfa= ce *interface) */ prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); =20 - del_singleshot_timer_sync(&hw->throttle); - del_singleshot_timer_sync(&hw->reqtimer); - del_singleshot_timer_sync(&hw->resptimer); + del_timer_sync(&hw->throttle); + del_timer_sync(&hw->reqtimer); + del_timer_sync(&hw->resptimer); =20 /* Unlink all the URBs. This "removes the wheels" * from the entire CTLX handling mechanism. diff --git a/include/linux/timer.h b/include/linux/timer.h index e78521bce565..3c166b4f704d 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -198,8 +198,6 @@ static inline int del_timer_sync(struct timer_list *tim= er) return timer_delete_sync(timer); } =20 -#define del_singleshot_timer_sync(t) del_timer_sync(t) - extern void init_timers(void); struct hrtimer; extern enum hrtimer_restart it_real_fn(struct hrtimer *); diff --git a/kernel/time/timer.c b/kernel/time/timer.c index d4ce3ebe2c8c..6cd908cfbad4 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1912,7 +1912,7 @@ signed long __sched schedule_timeout(signed long time= out) timer_setup_on_stack(&timer.timer, process_timeout, 0); __mod_timer(&timer.timer, expire, MOD_TIMER_NOTPENDING); schedule(); - del_singleshot_timer_sync(&timer.timer); + del_timer_sync(&timer.timer); =20 /* Remove the timer from the object tracker */ destroy_timer_on_stack(&timer.timer); diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 2db834318d14..2bccb5a90934 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1160,7 +1160,7 @@ xprt_request_enqueue_receive(struct rpc_task *task) spin_unlock(&xprt->queue_lock); =20 /* Turn off autodisconnect */ - del_singleshot_timer_sync(&xprt->timer); + del_timer_sync(&xprt->timer); } =20 /** -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 2E63334A3DA for ; Thu, 19 Feb 2026 17:13:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521223; cv=none; b=fzwHHnsfiHPDB/KWvfyT25blp/Z8RvkMPMIECKZh5aqyglZS8Gv5x7bUaKOei3umPYudlW9bpNDsa03p0lqa7cA2BQ3W299F/8sZA6ov6uaYa9LwifjBw7Ff4aL7ILU4t71uLUBkkGshduRmuriQ6uzkgPg89KqbNh83V1zeoME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521223; c=relaxed/simple; bh=p4TRIPhh7eCXg4oL8eEB5Ly0L/lmhP7XDzG06yVs7As=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e38tPazKo6bK4bkwHAMgo3QrTWRNncousEypW383vjybWnoTuMTROr2efxXxASs3rLf5ttdtLr4yZmIlxnLsjeTJRzmWEGCt+FnITDDqr2QY37BHnf5n8+NBlgsLQLhPL9Ud1Qp84IGmKupHZGo+MiOc8g+sEMmooR7KUHQNO/0= 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=FKrlFlES; arc=none smtp.client-ip=209.85.210.182 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="FKrlFlES" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-823c56765fdso560949b3a.1 for ; Thu, 19 Feb 2026 09:13:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521220; x=1772126020; 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=pWjvp+vOFGL8T/NXTev+NZf62jPu9HyIJqL4GkC+d9Y=; b=FKrlFlES6e6BGVghY8oWZK3LyO/CF2mkwPfSWj/5/7ziUBrV/6mOMLEE4QxJhCxaTH rYroFZ7raOj9l3ErtFIcEsYuf9wEeRGhKYtOGGPtYx03vQTwlWZ2qQLisyp9oblOJgmB nsBL3dek3d9pUUCuJui1cgLaAZFn+rH8uAHED239238h1tkqfP+c/OblFrIFd7cz/PbN 6wHvW+KpCBtAqEIgEVMMjfwfw5yNViW9z70tJ6nNTQ2EMAUq7Mn8Sgzg8cnjTylhvOTj +NpxcrorjQkmpHvYV6nlX0NQs6Mig/akS0/zKWfu2fVGPpKj5HKGNkrqW52dPflxiVvf WnQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521220; x=1772126020; 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=pWjvp+vOFGL8T/NXTev+NZf62jPu9HyIJqL4GkC+d9Y=; b=YTiFym0wK9RIVzL9K3C8XAXsqm6UQdxSZw38CMV1Tu+rH1gCMCzSU8xbP+VQchKcXD FO4Xbk7jnhEQaV6y2NQ1D1/+0/B0loRGKGl7rcBAHV78+S1lnJx6oSU5TcYsbuQVh4JR 2bf72BD3quhb+LznYAR7kqiZVMyVha2aJ6R8XB6GgIs8NZx++m8YxHwArgaT6jCK/pe0 R3D5nUVtghYQD//iaOBZqMwQei8Bb7tEZdm7XvMZl6LaWGOE2EtCzt/s8Tvo3VXxPaxf TbllSg3wE8z15097NCYYUcFjoBuPqW+GHhmZ2VMNMItFZICknt/JsOTT5wrPjmqooe1/ doRg== X-Forwarded-Encrypted: i=1; AJvYcCWdgXSBgpbhRpCxpHRc1h+yMqFChls2SU27xH0boX8Ur6vX6KvACopzz/v62YEb3SaqeOCgvVpbJyl76lg=@vger.kernel.org X-Gm-Message-State: AOJu0YwOUuXoR7Oi4Hxh5+ZbsHp6eDasL2PqS/mlH9ifCHWVvd+Ix4Tl GC8l5mdNWImrZWSXdxKFN6X0wx1E5598Np7j4aeNXR+ns/GxFHzwQhj2 X-Gm-Gg: AZuq6aLHPOd76FuKWCu1ZOPy+EWiouLlT2iJqsN0bf6E9ghq4szv0YMFa1Ay/7pDI23 T8GBUuGT6pZwZLuY1DIj7ZkhnsI783x56ieQ2GugL7M6mm7FsCu/fjOvASxPat2yCLp22AcaZyk GF+2pNjaB242BsvilQbSK5LXpmS02y/wlDV7VuQZhgjbT4xqlWCAdFzW5OZ6ih6Aa16JPU4ezPW Qq+3QTjYOwtT2iyCPRAEjThesC6aRaDmcZH4WsBSUbr9sUYibe8DJ1id7KEo2FKal1SCS4nUHr7 FOYHv4xcgX4GuwfNxHGdd2XfxgtysDdDR7dIehb4EbDAdZ2ZPm/KHbdK/pZRTcE+ZyZvVgxVwVO FfRKjolVFF5K/kiyhIn5o7IPMuSaCQTTiYJPDUX78gBjwSXoGcHLoFrAyGoDCtQJ4gI8F5NqCu3 lu5zTFLdkH7ZbcsOG0ShoZ0gJLxpXWwuSd8A0ZxJFkF0r74aau/A== X-Received: by 2002:a05:6a21:330b:b0:394:6023:a0f2 with SMTP id adf61e73a8af0-394fc21a2d7mr5528099637.21.1771521220510; Thu, 19 Feb 2026 09:13:40 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:39 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 06/15] timers: Replace BUG_ON()s Date: Fri, 20 Feb 2026 02:13:01 +0900 Message-Id: <20260219171310.118170-7-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 82ed6f7ef58f9634fe4462dd721902c580f01569 ] The timer code still has a few BUG_ON()s left which are crashing the kernel in situations where it still can recover or simply refuse to take an action. Remove the one in the hotplug callback which checks for the CPU being offline. If that happens then the whole hotplug machinery will explode in colourful ways. Replace the rest with WARN_ON_ONCE() and conditional returns where appropriate. Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201624.769128888@linutronix.de Signed-off-by: Jeongjun Park --- kernel/time/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index e09852be4e63..7094b916c854 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1208,7 +1208,8 @@ EXPORT_SYMBOL(timer_reduce); */ void add_timer(struct timer_list *timer) { - BUG_ON(timer_pending(timer)); + if (WARN_ON_ONCE(timer_pending(timer))) + return; __mod_timer(timer, timer->expires, MOD_TIMER_NOTPENDING); } EXPORT_SYMBOL(add_timer); @@ -1227,7 +1228,8 @@ void add_timer_on(struct timer_list *timer, int cpu) struct timer_base *new_base, *base; unsigned long flags; =20 - BUG_ON(timer_pending(timer) || !timer->function); + if (WARN_ON_ONCE(timer_pending(timer) || !timer->function)) + return; =20 new_base =3D get_timer_cpu_base(timer->flags, cpu); =20 @@ -2047,8 +2049,6 @@ int timers_dead_cpu(unsigned int cpu) struct timer_base *new_base; int b, i; =20 - BUG_ON(cpu_online(cpu)); - for (b =3D 0; b < NR_BASES; b++) { old_base =3D per_cpu_ptr(&timer_bases[b], cpu); new_base =3D get_cpu_ptr(&timer_bases[b]); @@ -2065,7 +2065,8 @@ int timers_dead_cpu(unsigned int cpu) */ forward_timer_base(new_base); =20 - BUG_ON(old_base->running_timer); + WARN_ON_ONCE(old_base->running_timer); + old_base->running_timer =3D NULL; =20 for (i =3D 0; i < WHEEL_SIZE; i++) migrate_timer_list(new_base, old_base->vectors + i); -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 3AF1934DCE3 for ; Thu, 19 Feb 2026 17:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521227; cv=none; b=J5aQxXFQSbp7/CE7ijptSRNNB6wSCJMD1gbpuMbxLRvSW9rzne4I5QsIABUzl8P9TE2NG1XpAz2uNLJf25KiCA+IcK7hRf4BCS3fpIht13mqjqa1Y5bVFx2f1USuSScD0DNpiH3ymci23zaDLyFfVJy/kHsYhCZL+EZ/jEdwgs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521227; c=relaxed/simple; bh=xUOfVR4rsP4k4iSxfTxt28P2aCRP7f27RFLz88rROqo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r/jHidgNaIMtLXcqS51fuHIeraQM5OzIw6G/Adw7N7OCUCx2qNnSwkEo7y8JoKH+q9ScWQVhkXAMlJCAy0HmCvIyabA9BnpPWL/4Psy44g/fvRqBWKIRXFOVAwlS+cR7NUNtwjQI8ceuXsJU8E2EGyUYuM5n2QlnvyPl+AGgTCI= 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=KY0zUH8m; arc=none smtp.client-ip=209.85.214.172 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="KY0zUH8m" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2ad617d5b80so5272245ad.1 for ; Thu, 19 Feb 2026 09:13:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521225; x=1772126025; 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=5aRj16inyvCNx7XEzEMiTg0hEspzqpDmbN1/ltb1rWU=; b=KY0zUH8m7Iw1psu1q0hzSqh8kVqUHFTaFcrn55/eQnUy11muGYTgFrCvWOrV5iJgnt lln5LEFtovSDb0HplHUBW3TsI9mEFiXzZRe3Vd9sAGVO1iSfaLsE1BmWJ3mUUllKl29x qAJZJBel5oaL0VoWEgo+XGDiBR+b8Tg6/JgF8PNZmHch+GikaexuW3jL8tLzchK5GJiC od7B33BMXba+EtDGtQIkkam1AcaTZR5R2UoEGpJ/0sPlc1h527IlL0H3rf2juRSd+b89 ZR5vk9cR8IQO/+5r8N9HKFpHmiydpeWQD2fW2TQ1blK0HFR9heN805WdC2QQJk0L7LRR X0Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521225; x=1772126025; 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=5aRj16inyvCNx7XEzEMiTg0hEspzqpDmbN1/ltb1rWU=; b=qnTKDchJLe7Xcp3l5jaS99GZVH68DENqSD5v3Fb4KSuX0wGn0WsHRHPPMYPRiykcWB k99rw5xSnp5bZbyEtweuEDJznd+3zRQZebZZGNcpMZNhaGl6WTD8HGnrnujsL/EDHpxA Z/z/T5cayLmqhgW1TqCV4vzPe4JJ1k0MvrAKvGowlxonNK4j/ZWZ0jXfXAz2Ww1FPnte YFN3a1jGAk+Ki4DFoAvH80wCWmSCUNdXBkZmDxQwvXSpVOwcSVxGwH3gNzZECiYHiuNj w3gFmtlc5SkJVid6eTe0uuM5jRJ04yZMaAlN08Ln4mEturJ6v9zWg3/tYWMVz7E3a4+x EY5w== X-Forwarded-Encrypted: i=1; AJvYcCXcn6JgLwqrQSW6qhOgb7UPwQVzN0etp7Gtk87+yoLK8AlGh2XvNm516zL2aHbYxEgziUq5Pj/fqfop590=@vger.kernel.org X-Gm-Message-State: AOJu0YzlRnLLrCzl/xaNp5HtLWIlipLivX77KWQlcsKP5zAGHjAhA2gi dpyqR393sGOxvlGkHCxps3DwGAK2srnoX/sCIqpDDKbXFAGO/FBTKs1u X-Gm-Gg: AZuq6aIU+CEog47ej6uuw4NoAunXx2Z/VcdTM7wSjeIPpVwhVsrDTJ3F0UZtclVuShH vAMiiHaiF9xaH6KThUaDbto62b9WxY+PmCE8aUspUFpFQXq00mNkarJCwAR8aBGdrqmMlzN7R8v 2AzMR/bM6XimK3PKjmAHZnphnasSLEd/WyQuDyyF4sQ4IJQWK9bgUH4EhLTWB6ylBOQQviQ2Yn4 LqPYtRmjPxMSH+4HPwz9M5yBb2ScSo5jekph+GK+Gi0Dkm/EKFYvewvU4y/4U2M4M47LHzmLr49 mIvai/yIEzhaqE9LqnnSrnhBAa41NlfQ+qKjKxIzMaJ+M67xAYe6Kefcluf6dGXQaFACHzND43x Fx6rK9bAFJbF5mMWo1Crr/Yn4SbdirLTsCWkthfl2ze3o1aHdRkMp5N0xBZ/oGkcWsRCWpy7jgl BDw+lc9PSGackg4kwJMWvwht5hQ5QtnsoGvqM/SaxQAU3ZIArXXEXWHzn8q9Q1 X-Received: by 2002:a17:903:2b0d:b0:2aa:d7a7:8091 with SMTP id d9443c01a7336-2ad5aed3fcemr29265505ad.12.1771521224611; Thu, 19 Feb 2026 09:13:44 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:43 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 07/15] timers: Rename del_timer() to timer_delete() Date: Fri, 20 Feb 2026 02:13:02 +0900 Message-Id: <20260219171310.118170-8-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit bb663f0f3c396c6d05f6c5eeeea96ced20ff112e ] The timer related functions do not have a strict timer_ prefixed namespace which is really annoying. Rename del_timer() to timer_delete() and provide del_timer() as a wrapper. Document that del_timer() is not for new code. Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Steven Rostedt (Google) Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201625.015535022@linutronix.de Signed-off-by: Jeongjun Park --- include/linux/timer.h | 15 ++++++++++++++- kernel/time/timer.c | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index 551fa467726f..e338e173ce8b 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -169,7 +169,6 @@ static inline int timer_pending(const struct timer_list= * timer) } =20 extern void add_timer_on(struct timer_list *timer, int cpu); -extern int del_timer(struct timer_list * timer); extern int mod_timer(struct timer_list *timer, unsigned long expires); extern int mod_timer_pending(struct timer_list *timer, unsigned long expir= es); extern int timer_reduce(struct timer_list *timer, unsigned long expires); @@ -184,6 +183,7 @@ extern void add_timer(struct timer_list *timer); =20 extern int try_to_del_timer_sync(struct timer_list *timer); extern int timer_delete_sync(struct timer_list *timer); +extern int timer_delete(struct timer_list *timer); =20 /** * del_timer_sync - Delete a pending timer and wait for a running callback @@ -198,6 +198,19 @@ static inline int del_timer_sync(struct timer_list *ti= mer) return timer_delete_sync(timer); } =20 +/** + * del_timer - Delete a pending timer + * @timer: The timer to be deleted + * + * See timer_delete() for detailed explanation. + * + * Do not use in new code. Use timer_delete() instead. + */ +static inline int del_timer(struct timer_list *timer) +{ + return timer_delete(timer); +} + extern void init_timers(void); struct hrtimer; extern enum hrtimer_restart it_real_fn(struct hrtimer *); diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 60e538b566e3..2b5e8c26b697 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1257,7 +1257,7 @@ void add_timer_on(struct timer_list *timer, int cpu) EXPORT_SYMBOL_GPL(add_timer_on); =20 /** - * del_timer - Deactivate a timer. + * timer_delete - Deactivate a timer * @timer: The timer to be deactivated * * The function only deactivates a pending timer, but contrary to @@ -1270,7 +1270,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -int del_timer(struct timer_list *timer) +int timer_delete(struct timer_list *timer) { struct timer_base *base; unsigned long flags; @@ -1286,7 +1286,7 @@ int del_timer(struct timer_list *timer) =20 return ret; } -EXPORT_SYMBOL(del_timer); +EXPORT_SYMBOL(timer_delete); =20 /** * try_to_del_timer_sync - Try to deactivate a timer -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (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 61B1C349B1F for ; Thu, 19 Feb 2026 17:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521230; cv=none; b=GZQ3pwaorgWytZadijhTidwCsANTd6mxYHQFkIAKjhrIxSyMtVUd4BkYxNXnMhYGcw/i80891+dfARzQtMbTHUEeE3X1Hc+3DMzDnT54Bn3Om/5K+zrb+8ifDqWx9o9aWaguJjvAIHmJ1Gpn0h6TR1kJq+Emcxgx65bXJmaC+F8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521230; c=relaxed/simple; bh=k6En+RE2oEi/aaa6/FdQNRaFuxL1eHAD2YO7U6RNZuY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=pSqqiOQKdlvNswhzJh+h1/9eqikKeDkN3mkntK8oPsEkDhjtDaP1DsMh0hEWBxqKyKB0SQLS2QYqBTyx4MhjRA5mN0715/T3Pz1mV7Yq9wrDO27Q97baxEAbrhcxOOWXZey1KjabatJwGyO2j+LoB2vnw858sFJFM4T4F9zmslI= 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=avz554fD; arc=none smtp.client-ip=209.85.215.194 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="avz554fD" Received: by mail-pg1-f194.google.com with SMTP id 41be03b00d2f7-c6541e35fc0so650265a12.3 for ; Thu, 19 Feb 2026 09:13:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521229; x=1772126029; 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=fXffZK0HVFgBoSDOar6/ghoDeSLCHeI4/7cALkB4cBE=; b=avz554fDOj5t4gD6HzwzZvW1Q/5Og6Zl0BE73q5KQrxCqB4K3dgR3owYJdhBXPfCqr BjuBNqtxXfxP319WQMn62s4TL/EUe/hZB+Fus4LvKnv4c1O4808lkRHnV2tkcxC4r3Ue X6prBEXYz1fOncRT/5NgPSticPLrzYrbOhSozZZU+kkGmIs5Wu2Koki8CqTw9eZRAx1i yxbrNBM/7f9HMHH+HL0U9EE9Zm4Lisl4PL8aRkMFuU7C+XOqrKGd79bin6nrSEEd7FLA WZv8lQAwVFqK8ljMPFyiCEOFqDHp0wBypigEm6L42lyQMhAdCMqw13fVqfcqaAHJWpbt DS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521229; x=1772126029; 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=fXffZK0HVFgBoSDOar6/ghoDeSLCHeI4/7cALkB4cBE=; b=rYGmRXXVrictMOad7fyE3isMG10av6TW6pS2K+Q7Qg2MYFQFmCcWsDkWR+fUv3alq7 9KmJv0KsiIGS10Z0r1bzANtz4Cw1spygCFDRYvo/MftQB61GJDf6F/EsNcksV1AhtTRL hlJsA3+HkCQe1hL5I31IiBzrwlaoGJw/nbTY2MkGdioKo3VUvgrvyoB9TinOeSYoRrDg cTmxxYAXXBTd2QYipbpXUP2Gep1QUh/QpmPMbKbC+TK0wAO5bbwwdvHJr0Voivz21GwR 4efw+WBeuZb1e91rs7WNfEIp08dv9c4k/8UOpBHwZm+FHrIznT5AQawmLJXshSFRbwDD rpNQ== X-Forwarded-Encrypted: i=1; AJvYcCXJZujbxwOaes4QvslXlmdY7F3TD7OhFJycLgEM4nmpWNUitnGhnNIKYSDzNkS5ADXL4Cnd77HskN0FUNc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/E4dMou7VFXakE4bwxqSO7GWhybIsEkfj1N3dPNJHu8nEIFsi KpE4iyOxmMFwWoYfHluCz9UMAVBid7f52vj2jMZWAB0+JE00ncPcdQ1f X-Gm-Gg: AZuq6aKVKwgNuPubD58MJ9zQuQVDftiI0CZVnKA9poSe1uwWb97YmBDFieLpUOO562H tmkGG69XDxVOPsAFtjVkQtFckwgVrYp16t+IfdAk9B2M7VObvN8ZF3wSvka6xg5RkkDuPhAeYdC QLWrW7OqAi00DLrhtDnMtCmH+wq8PDKG9E7pYFPS/oM+FDqYPi8kyi/31kUnuRT4+7CqeitHrGR GGDBk8W+M8b5qxfVEAuON378YejAPdiM1xc2sMeQGn/HmeKdLlngRITdKpo7cizrD3Mn+0Wgw8k 70EqDuxqhFEC6Ot/HpAOxOBhJH7/DwP0hT86ucxixG9ClOM/JzSlo2l+gQ1PRqA3TtDrsvfFPxN 4Jeh64gyQ4aCnmY/PgTYfdn3tJa+YrSLLxV2MqkCbsWfF5SkJjoqcamIZNlSFRs3sx31cT8mQOw M0T5503jLNOp/14SCY+7aa3vWmrcvZstiRSxGXP24q8zmMq9zwSQ== X-Received: by 2002:a05:6a21:328d:b0:38e:c789:4f39 with SMTP id adf61e73a8af0-394fc339e83mr4954575637.49.1771521228655; Thu, 19 Feb 2026 09:13:48 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:48 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 08/15] Documentation: Replace del_timer/del_timer_sync() Date: Fri, 20 Feb 2026 02:13:03 +0900 Message-Id: <20260219171310.118170-9-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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: Thomas Gleixner [ Upstream commit 87bdd932e85881895d4720255b40ac28749c4e32 ] Adjust to the new preferred function names. Suggested-by: Steven Rostedt Signed-off-by: Thomas Gleixner Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/r/20221123201625.075320635@linutronix.de Signed-off-by: Jeongjun Park --- .../RCU/Design/Requirements/Requirements.rst | 2 +- Documentation/core-api/local_ops.rst | 2 +- Documentation/kernel-hacking/locking.rst | 11 +++++------ Documentation/timers/hrtimers.rst | 2 +- .../translations/it_IT/kernel-hacking/locking.rst | 10 +++++----- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Docum= entation/RCU/Design/Requirements/Requirements.rst index 1ae79a10a8de..ad2cc20131ec 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 ``del_timer_sync()`` or similar. +with via ``timer_delete_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 2ac3f9f29845..a84f8b0c7ab2 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) { - del_timer_sync(&test_timer); + timer_delete_sync(&test_timer); } =20 module_init(test_init); diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kerne= l-hacking/locking.rst index c43204b99df7..86ac2f4d24f7 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -976,7 +976,7 @@ you might do the following:: =20 while (list) { struct foo *next =3D list->next; - del_timer(&list->timer); + timer_delete(&list->timer); kfree(list); list =3D next; } @@ -990,7 +990,7 @@ the lock after we spin_unlock_bh(), and then try to free the element (which has already been freed!). =20 This can be avoided by checking the result of -del_timer(): if it returns 1, the timer has been deleted. +timer_delete(): if it returns 1, the timer has been deleted. If 0, it means (in this case) that it is currently running, so we can do:: =20 @@ -999,7 +999,7 @@ do:: =20 while (list) { struct foo *next =3D list->next; - if (!del_timer(&list->timer)) { + if (!timer_delete(&list->timer)) { /* Give timer a chance to delete this = */ spin_unlock_bh(&list_lock); goto retry; @@ -1014,8 +1014,7 @@ do:: Another common problem is deleting timers which restart themselves (by calling add_timer() at the end of their timer function). Because this is a fairly common case which is prone to races, you should -use del_timer_sync() (``include/linux/timer.h``) to -handle this case. +use timer_delete_sync() (``include/linux/timer.h``) to handle this case. =20 Locking Speed =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D @@ -1343,7 +1342,7 @@ lock. =20 - kfree() =20 -- add_timer() and del_timer() +- add_timer() and timer_delete() =20 Mutex API reference =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D diff --git a/Documentation/timers/hrtimers.rst b/Documentation/timers/hrtim= ers.rst index c1c20a693e8f..7ac448908d1f 100644 --- a/Documentation/timers/hrtimers.rst +++ b/Documentation/timers/hrtimers.rst @@ -118,7 +118,7 @@ existing timer wheel code, as it is mature and well sui= ted. Sharing code was not really a win, due to the different data structures. Also, the hrtimer functions now have clearer behavior and clearer names - such as hrtimer_try_to_cancel() and hrtimer_cancel() [which are roughly -equivalent to del_timer() and del_timer_sync()] - so there's no direct +equivalent to timer_delete() and timer_delete_sync()] - so there's no dire= ct 1:1 mapping between them on the algorithmic level, and thus no real potential for code sharing either. =20 diff --git a/Documentation/translations/it_IT/kernel-hacking/locking.rst b/= Documentation/translations/it_IT/kernel-hacking/locking.rst index cfd0bbabb113..adb17d3ab67a 100644 --- a/Documentation/translations/it_IT/kernel-hacking/locking.rst +++ b/Documentation/translations/it_IT/kernel-hacking/locking.rst @@ -1000,7 +1000,7 @@ potreste fare come segue:: =20 while (list) { struct foo *next =3D list->next; - del_timer(&list->timer); + timer_delete(&list->timer); kfree(list); list =3D next; } @@ -1013,7 +1013,7 @@ e prender=C3=A0 il *lock* solo dopo spin_unlock_bh(),= e cercher=C3=A0 di eliminare il suo oggetto (che per=C3=B2 =C3=A8 gi=C3=A0 stato eliminato= ). =20 Questo pu=C3=B2 essere evitato controllando il valore di ritorno di -del_timer(): se ritorna 1, il temporizzatore =C3=A8 stato gi=C3=A0 +timer_delete(): se ritorna 1, il temporizzatore =C3=A8 stato gi=C3=A0 rimosso. Se 0, significa (in questo caso) che il temporizzatore =C3=A8 in esecuzione, quindi possiamo fare come segue:: =20 @@ -1022,7 +1022,7 @@ esecuzione, quindi possiamo fare come segue:: =20 while (list) { struct foo *next =3D list->next; - if (!del_timer(&list->timer)) { + if (!timer_delete(&list->timer)) { /* Give timer a chance to delete this = */ spin_unlock_bh(&list_lock); goto retry; @@ -1036,7 +1036,7 @@ esecuzione, quindi possiamo fare come segue:: Un altro problema =C3=A8 l'eliminazione dei temporizzatori che si riavviano da soli (chiamando add_timer() alla fine della loro esecuzione). Dato che questo =C3=A8 un problema abbastanza comune con una propensione -alle corse critiche, dovreste usare del_timer_sync() +alle corse critiche, dovreste usare timer_delete_sync() (``include/linux/timer.h``) per gestire questo caso. =20 Velocit=C3=A0 della sincronizzazione @@ -1384,7 +1384,7 @@ contesto, o trattenendo un qualsiasi *lock*. =20 - kfree() =20 -- add_timer() e del_timer() +- add_timer() e timer_delete() =20 Riferimento per l'API dei Mutex =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 815BF34F481 for ; Thu, 19 Feb 2026 17:13:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521235; cv=none; b=A2ByPdUUC0Sw3/dX4mqJTubJjzfY0l90BOZB9vntNwi718X0CNyc6K7HTDlDe8WcyxQxE40XRpnnyeXmgf7J5qwE9jaOoHyvISqjxYb9IEd0QBy1XH7l/AaMbkkIh3hyT8sYo7ue74VvfLbsNEcMTMAh/H2aa0VV+MkV2JDyxSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521235; c=relaxed/simple; bh=A7NZvw6BwM3JH9LFTZM0pkj7MM2Mf/KMJNxtIByaxbs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gKJawA5ozW7+x/NpK3VbOErchS835CT7aU3v0BieAUIkg1ar94hDCi8ybkMDgzvERZoKQjxrprvgB09MDLbi3GqqhZE7cJMvk8H60siRqRDvaY+AnZ21ny8Mc7ojpSXZAJaj8vjD2Q8N5YKjUYUU16YrDKJSTsRHCCiTUhH4JeA= 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=A2xIpNTa; arc=none smtp.client-ip=209.85.214.178 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="A2xIpNTa" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2ad22a5e245so8655455ad.2 for ; Thu, 19 Feb 2026 09:13:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521234; x=1772126034; 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=HIvAwaANSEMHidUC241SU/ATL2QFU3HABzkGaIq1H88=; b=A2xIpNTaLKxPgBBGcN7gM2nJb/aWDGI9cNvUQkur9JkNOee0EuGzRETI/ppS17MYur glmusF6Gm3bRj6nHs5A7YwxyUlmBngZF2WHobQiLXQDR1fH/7OZK03JIBUC7xmOFsQ6v dSiOyobgS44PRCE8qnggOyruqnmgYF27gpDfAn484nDXSKetDkjRxx7311dIlRIDAXln Yy3EhFpHjbmR2ddGF+s4kJHKGfrrhe5++axQv7pnGMztP9m1dwf+gWgjhnaWQQdLLkJr st9mfTebci4PV5GJdYO9eVEgTS8RwZwh/eaEwqQMgWANCRAZIJkZxKN27f1aMhulHOwg A3pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521234; x=1772126034; 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=HIvAwaANSEMHidUC241SU/ATL2QFU3HABzkGaIq1H88=; b=mfad4ODSX5iOXCe3xi/Aju/kOAZUomdi23GDq9EL3IA3qQi+22xF141LFh8b5WgcSh ocH2QvG04E1O/KjgnWqwatvVCWl0Gk3jy03eOEtkmZ9BimGXf4Kktqe2HBUErLI+5wo5 WHy5UPacGljZHAeGvwfPZF2D9s7aDqiVn7QBmzSjJE8XqL75ioPmHeOb2h59DEn5Sas1 TGWYqW4OKQ5o3eclRLg0aapavL5TDdy1IKRf6JeCwoh2VzklcoiMM00XbVdab1DgmhBM fnabUdxqomrTv3hKSJMF1KXxP1wJcBvKUQYiNoDhCNyQLCC/yAb2pXFF8JqimgiUvk2n R3eg== X-Forwarded-Encrypted: i=1; AJvYcCU4ZLC08GqJMvsQqNMgc2DNjX/Wcz0lmNHuV+Yl/qHX7MPKJjA9IhGA4RN5A4x8AL3WYisybG73BgRCYbU=@vger.kernel.org X-Gm-Message-State: AOJu0YyeaB3x4moxKrvAymThY1NpfQC84a++UwjkZxDBBVTIn/Cxnhke sNk2Y/SFfBQcGqlrLGmCMTIX5/FNSBRrlU9HeFSsoJ5DKDHePHgNZO7D X-Gm-Gg: AZuq6aK1JDuRJBJTI0tmiSdRy1zgmDmc5AVdJQI8EbOjNhghZV+RmW6DVA91Fle0PuL 8+L3yvQ2AXvhUZQDr7rraMGNBkGkMyh9la6kF7sxDJRc3knvWPD+8yDKsYc4JC9oPmlqC2p0tEL fqoCB0i6LxHebZH16CbO3/6Ym5PqORnhjIf8Ds5xF74VmsTsqbmkp/YSKTp60gLOyVMgCLXGrOe MnKvdNKYU8wIut64w3EzvUuRMNRY1LU8qE/t2Ia36fc27W+izkDhD+vJMd4+OM81TiXMcEEU7fN WH8AY/3cowCJGKxnu1U1Lh1byvfJC0qACutvCHaHoA48+vYH5vG+I1tbeUog0TUKwRlLbaxvM2m QQ41go/tn7kIkUImw7AUjBIuN4K7Ab/VCP+hmykpwB1IAK4+x2fRd5GUKGYmKmVt5sK3E85pmkw qyCG0+mi+O5Sh1EeXG9V5i168xbnTdmkavEZvONcwRLga52silnND7r4DmPyzd X-Received: by 2002:a17:902:db01:b0:2a0:d629:903f with SMTP id d9443c01a7336-2ad50e76db9mr47242025ad.9.1771521233834; Thu, 19 Feb 2026 09:13:53 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:52 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 09/15] timers: Silently ignore timers with a NULL function Date: Fri, 20 Feb 2026 02:13:04 +0900 Message-Id: <20260219171310.118170-10-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit d02e382cef06cc73561dd32dfdc171c00dcc416d ] Tearing down timers which have circular dependencies to other functionality, e.g. workqueues, where the timer can schedule work and work can arm timers, is not trivial. In those cases it is desired to shutdown the timer in a way which prevents rearming of the timer. The mechanism to do so is to set timer->function to NULL and use this as an indicator for the timer arming functions to ignore the (re)arm request. In preparation for that replace the warnings in the relevant code paths with checks for timer->function =3D=3D NULL. If the pointer is NULL, then discard the rearm request silently. Add debug_assert_init() instead of the WARN_ON_ONCE(!timer->function) checks so that debug objects can warn about non-initialized timers. The warning of debug objects does not warn if timer->function =3D=3D NULL. = It warns when timer was not initialized using timer_setup[_on_stack]() or via DEFINE_TIMER(). If developers fail to enable debug objects and then waste lots of time to figure out why their non-initialized timer is not firing, they deserve it. Same for initializing a timer with a NULL function. Co-developed-by: Steven Rostedt Signed-off-by: Steven Rostedt Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org Link: https://lore.kernel.org/r/87wn7kdann.ffs@tglx Signed-off-by: Jeongjun Park --- kernel/time/timer.c | 57 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 7094b916c854..3b6624cd9507 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1017,7 +1017,7 @@ __mod_timer(struct timer_list *timer, unsigned long e= xpires, unsigned int option unsigned int idx =3D UINT_MAX; int ret =3D 0; =20 - BUG_ON(!timer->function); + debug_assert_init(timer); =20 /* * This is a common optimization triggered by the networking code - if @@ -1044,6 +1044,14 @@ __mod_timer(struct timer_list *timer, unsigned long = expires, unsigned int option * dequeue/enqueue dance. */ base =3D lock_timer_base(timer, &flags); + /* + * Has @timer been shutdown? This needs to be evaluated + * while holding base lock to prevent a race against the + * shutdown code. + */ + if (!timer->function) + goto out_unlock; + forward_timer_base(base); =20 if (timer_pending(timer) && (options & MOD_TIMER_REDUCE) && @@ -1070,6 +1078,14 @@ __mod_timer(struct timer_list *timer, unsigned long = expires, unsigned int option } } else { base =3D lock_timer_base(timer, &flags); + /* + * Has @timer been shutdown? This needs to be evaluated + * while holding base lock to prevent a race against the + * shutdown code. + */ + if (!timer->function) + goto out_unlock; + forward_timer_base(base); } =20 @@ -1128,8 +1144,12 @@ __mod_timer(struct timer_list *timer, unsigned long = expires, unsigned int option * mod_timer_pending() is the same for pending timers as mod_timer(), but * will not activate inactive timers. * + * If @timer->function =3D=3D NULL then the start operation is silently + * discarded. + * * Return: - * * %0 - The timer was inactive and not modified + * * %0 - The timer was inactive and not modified or was in + * shutdown state and the operation was discarded * * %1 - The timer was active and requeued to expire at @expires */ int mod_timer_pending(struct timer_list *timer, unsigned long expires) @@ -1155,8 +1175,12 @@ EXPORT_SYMBOL(mod_timer_pending); * same timer, then mod_timer() is the only safe way to modify the timeout, * since add_timer() cannot modify an already running timer. * + * If @timer->function =3D=3D NULL then the start operation is silently + * discarded. In this case the return value is 0 and meaningless. + * * Return: - * * %0 - The timer was inactive and started + * * %0 - The timer was inactive and started or was in shutdown + * state and the operation was discarded * * %1 - The timer was active and requeued to expire at @expires or * the timer was active and not modified because @expires did * not change the effective expiry time @@ -1176,8 +1200,12 @@ EXPORT_SYMBOL(mod_timer); * modify an enqueued timer if that would reduce the expiration time. If * @timer is not enqueued it starts the timer. * + * If @timer->function =3D=3D NULL then the start operation is silently + * discarded. + * * Return: - * * %0 - The timer was inactive and started + * * %0 - The timer was inactive and started or was in shutdown + * state and the operation was discarded * * %1 - The timer was active and requeued to expire at @expires or * the timer was active and not modified because @expires * did not change the effective expiry time such that the @@ -1200,6 +1228,9 @@ EXPORT_SYMBOL(timer_reduce); * The @timer->expires and @timer->function fields must be set prior * to calling this function. * + * If @timer->function =3D=3D NULL then the start operation is silently + * discarded. + * * If @timer->expires is already in the past @timer will be queued to * expire at the next timer tick. * @@ -1228,7 +1259,9 @@ void add_timer_on(struct timer_list *timer, int cpu) struct timer_base *new_base, *base; unsigned long flags; =20 - if (WARN_ON_ONCE(timer_pending(timer) || !timer->function)) + debug_assert_init(timer); + + if (WARN_ON_ONCE(timer_pending(timer))) return; =20 new_base =3D get_timer_cpu_base(timer->flags, cpu); @@ -1239,6 +1272,13 @@ void add_timer_on(struct timer_list *timer, int cpu) * wrong base locked. See lock_timer_base(). */ base =3D lock_timer_base(timer, &flags); + /* + * Has @timer been shutdown? This needs to be evaluated while + * holding base lock to prevent a race against the shutdown code. + */ + if (!timer->function) + goto out_unlock; + if (base !=3D new_base) { timer->flags |=3D TIMER_MIGRATING; =20 @@ -1252,6 +1292,7 @@ void add_timer_on(struct timer_list *timer, int cpu) =20 debug_timer_activate(timer); internal_add_timer(base, timer); +out_unlock: raw_spin_unlock_irqrestore(&base->lock, flags); } EXPORT_SYMBOL_GPL(add_timer_on); @@ -1541,6 +1582,12 @@ static void expire_timers(struct timer_base *base, s= truct hlist_head *head) =20 fn =3D timer->function; =20 + if (WARN_ON_ONCE(!fn)) { + /* Should never happen. Emphasis on should! */ + base->running_timer =3D NULL; + continue; + } + if (timer->flags & TIMER_IRQSAFE) { raw_spin_unlock(&base->lock); call_timer_fn(timer, fn, baseclk); -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 C0E3334FF70 for ; Thu, 19 Feb 2026 17:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521240; cv=none; b=LLHKnM4jHWf2xFek/OqXc5qysXTCEhOlDxBaChzpZvLr6JnjVJ8UjTFL7Dv+7FQHMUxI3b28b9X2UkjoEtMg0XZPmm58ru8okual/xKebNDIiCFbnvBxHfBPjpTdq8qNkZK5UEGd9RC++811XxEhwYLfrHtR6Riz8wR5SwE0wbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521240; c=relaxed/simple; bh=FfeWAFL01yrxGNZ9KQqmQL8U/+v/91/EffrzfYdxZZA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nbyUAcYKm2qWPMnKEg1hhEAXuzups0lM73+sNQ6HS47SeAN0QkwAqGiY4tX2/Iwi84LVo7NszV6Dsoh0PdYwzOUZ1Gc0knrV590iVEPr744WRCKFMYAR2MDG349S8uTovryPpXfX7TFMyeSXMDeXFMmjl59d0M6vhilpJ/21nwA= 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=iyGey/qG; arc=none smtp.client-ip=209.85.210.180 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="iyGey/qG" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-823c56765fdso561138b3a.1 for ; Thu, 19 Feb 2026 09:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521238; x=1772126038; 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=j0bNeek1LW81/KG2/Q/uicdT1bV3tR+ITFKGtccSqSg=; b=iyGey/qGN2bH2syhXFZyONTsL0ilPXFhOG61L0+4zSQyErMbUWIKILGG/kbJwg/kLW SNtDcJW4TqqRvCQH5GkYEqoozJuqyLtug1gef69hXKqoHJp9Co4Ql4lx5Z/HAiy1duP9 yY9xqq9J8RVlwoGVfY/RPfPwTduCdWvFwy84Ti481pduAGkCGCV0MoKshEudhSTFtEx5 VZmeukutF9VoTH+ugk9l7jGc77D4oX1NAoQFP2mcZZZZaVYjyjtTD1mnJCiIbMloeb7O TSxcsnc6BW0QJS0SVaJguXzXE9hfFtX5sTtyjrJzA6DZWS36F4tgjTWYh/f3TErcdi5e xHZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521238; x=1772126038; 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=j0bNeek1LW81/KG2/Q/uicdT1bV3tR+ITFKGtccSqSg=; b=b/h5HaOzfvtGxxj4YPIGNHhraQShuGLJPN0kz83HO6fq5G1oYghZIhwHYPHtCMETwl BLaDbUHCMGFtz75/EJ6vXknCRtqil1fxfJT+LQ0A4mGcIMYA8ArhwVECSPOef4earC/X ZI5xKBEtMVn4xK15pPXPSURfsOmA0iqlpu/4pPEpooPDfSQmTaO3r0YmTsfr/D8wbpvP TH9ngjsagnK1lYwfbllAWS117HoygufsTNowypZLscm9rVqTJbxw497qia2qKhEHId9X oDLwepzj0q3bvxUSAHGW2cJkpk80MuEUzXRSRZq3RRZDAOjTMMaXhCzn1+S/EQZiwS21 Hh/Q== X-Forwarded-Encrypted: i=1; AJvYcCXY+siZm1LhLYaK6bazDQMykCzFQljGRit8qEa2yOjhcbP90gO11iJ7tlyOnJt4FEQl9jt+kL0IvJx+nPA=@vger.kernel.org X-Gm-Message-State: AOJu0YzbJ2xCTNvjrq/NNWGh06mpe6TE+mt/ziEIFJNrNvQW75xjv29s fnQQuMkNYNRfAZZLBrazKdGQV9zq9RNEXK4iLYIwDwM6ppvTuO/Y+lGzVG/l6lkM X-Gm-Gg: AZuq6aL+h176TZ2x8cJ+wKjAgRoFJnA3bxrmOwnuo0TluyFthSqHQnrlFN6/Km1ylv9 5VR2gyNEJHSmAoR0RLlAHkoosFPREj2kE9RU8BbKIOfifY95pC3YXt9alEb83gwN2oRmHTpfJmK P96HnDGHGLmfg0pvrCK8oOM43UPFDTMVAj5Bm/R7OoDTkjERaYEi6D5hUK9+nPwFM972qwCCbZP wV1VI81RjH1k6AWDLHkDCJLryf8vYEooExVieSUy8xnlsYk5zaLCrS4UfLLSA3tvv+RUgET65Ks jAZTU1KMArAuYfs1NnD7yztFPT50aPLx2t/qmkTWwM5Cbe0MCW2/cDVr4Wa66LxtEvfd3a8RiyJ AwMwjD2FsX67DYkssC17xKc8/4vDzpGTRVtAuiF5ddIDKNNXshH2C1rUh8g3ti6rwGvFkcEZhVn lH90RTSBmMbtpzyKh6Xrt3Zpo7aeCoEltuzJcUUGsXB2+kdAIRvQ== X-Received: by 2002:a05:6a21:3a48:b0:35d:d477:a7db with SMTP id adf61e73a8af0-394fc34764bmr5169360637.56.1771521238056; Thu, 19 Feb 2026 09:13:58 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:13:57 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 10/15] timers: Split [try_to_]del_timer[_sync]() to prepare for shutdown mode Date: Fri, 20 Feb 2026 02:13:05 +0900 Message-Id: <20260219171310.118170-11-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 8553b5f2774a66b1f293b7d783934210afb8f23c ] Tearing down timers which have circular dependencies to other functionality, e.g. workqueues, where the timer can schedule work and work can arm timers, is not trivial. In those cases it is desired to shutdown the timer in a way which prevents rearming of the timer. The mechanism to do so is to set timer->function to NULL and use this as an indicator for the timer arming functions to ignore the (re)arm request. Split the inner workings of try_do_del_timer_sync(), del_timer_sync() and del_timer() into helper functions to prepare for implementing the shutdown functionality. No functional change. Co-developed-by: Steven Rostedt Signed-off-by: Steven Rostedt Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org Link: https://lore.kernel.org/r/20221123201625.195147423@linutronix.de Signed-off-by: Jeongjun Park --- kernel/time/timer.c | 143 ++++++++++++++++++++++++++++---------------- 1 file changed, 92 insertions(+), 51 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 3b6624cd9507..0b76a2ab42e3 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1298,20 +1298,14 @@ void add_timer_on(struct timer_list *timer, int cpu) EXPORT_SYMBOL_GPL(add_timer_on); =20 /** - * timer_delete - Deactivate a timer + * __timer_delete - Internal function: Deactivate a timer * @timer: The timer to be deactivated * - * The function only deactivates a pending timer, but contrary to - * timer_delete_sync() it does not take into account whether the timer's - * callback function is concurrently executed on a different CPU or not. - * It neither prevents rearming of the timer. If @timer can be rearmed - * concurrently then the return value of this function is meaningless. - * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -int timer_delete(struct timer_list *timer) +static int __timer_delete(struct timer_list *timer) { struct timer_base *base; unsigned long flags; @@ -1327,25 +1321,37 @@ int timer_delete(struct timer_list *timer) =20 return ret; } -EXPORT_SYMBOL(timer_delete); =20 /** - * try_to_del_timer_sync - Try to deactivate a timer - * @timer: Timer to deactivate + * timer_delete - Deactivate a timer + * @timer: The timer to be deactivated * - * This function tries to deactivate a timer. On success the timer is not - * queued and the timer callback function is not running on any CPU. + * The function only deactivates a pending timer, but contrary to + * timer_delete_sync() it does not take into account whether the timer's + * callback function is concurrently executed on a different CPU or not. + * It neither prevents rearming of the timer. If @timer can be rearmed + * concurrently then the return value of this function is meaningless. * - * This function does not guarantee that the timer cannot be rearmed right - * after dropping the base lock. That needs to be prevented by the calling - * code if necessary. + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +int timer_delete(struct timer_list *timer) +{ + return __timer_delete(timer); +} +EXPORT_SYMBOL(timer_delete); + +/** + * __try_to_del_timer_sync - Internal function: Try to deactivate a timer + * @timer: Timer to deactivate * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated * * %-1 - The timer callback function is running on a different CPU */ -int try_to_del_timer_sync(struct timer_list *timer) +static int __try_to_del_timer_sync(struct timer_list *timer) { struct timer_base *base; unsigned long flags; @@ -1362,6 +1368,27 @@ int try_to_del_timer_sync(struct timer_list *timer) =20 return ret; } + +/** + * try_to_del_timer_sync - Try to deactivate a timer + * @timer: Timer to deactivate + * + * This function tries to deactivate a timer. On success the timer is not + * queued and the timer callback function is not running on any CPU. + * + * This function does not guarantee that the timer cannot be rearmed right + * after dropping the base lock. That needs to be prevented by the calling + * code if necessary. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + * * %-1 - The timer callback function is running on a different CPU + */ +int try_to_del_timer_sync(struct timer_list *timer) +{ + return __try_to_del_timer_sync(timer); +} EXPORT_SYMBOL(try_to_del_timer_sync); =20 #ifdef CONFIG_PREEMPT_RT @@ -1438,45 +1465,15 @@ static inline void del_timer_wait_running(struct ti= mer_list *timer) { } #endif =20 /** - * timer_delete_sync - Deactivate a timer and wait for the handler to fini= sh. + * __timer_delete_sync - Internal function: Deactivate a timer and wait + * for the handler to finish. * @timer: The timer to be deactivated * - * Synchronization rules: Callers must prevent restarting of the timer, - * otherwise this function is meaningless. It must not be called from - * interrupt contexts unless the timer is an irqsafe one. The caller must - * not hold locks which would prevent completion of the timer's callback - * function. The timer's handler must not call add_timer_on(). Upon exit - * the timer is not queued and the handler is not running on any CPU. - * - * For !irqsafe timers, the caller must not hold locks that are held in - * interrupt context. Even if the lock has nothing to do with the timer in - * question. Here's why:: - * - * CPU0 CPU1 - * ---- ---- - * - * call_timer_fn(); - * base->running_timer =3D mytimer; - * spin_lock_irq(somelock); - * - * spin_lock(somelock); - * timer_delete_sync(mytimer); - * while (base->running_timer =3D=3D mytimer); - * - * Now timer_delete_sync() will never return and never release somelock. - * The interrupt on the other CPU is waiting to grab somelock but it has - * interrupted the softirq that CPU0 is waiting to finish. - * - * This function cannot guarantee that the timer is not rearmed again by - * some concurrent or preempting code, right after it dropped the base - * lock. If there is the possibility of a concurrent rearm then the return - * value of the function is meaningless. - * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -int timer_delete_sync(struct timer_list *timer) +static int __timer_delete_sync(struct timer_list *timer) { int ret; =20 @@ -1506,7 +1503,7 @@ int timer_delete_sync(struct timer_list *timer) lockdep_assert_preemption_enabled(); =20 do { - ret =3D try_to_del_timer_sync(timer); + ret =3D __try_to_del_timer_sync(timer); =20 if (unlikely(ret < 0)) { del_timer_wait_running(timer); @@ -1516,6 +1513,50 @@ int timer_delete_sync(struct timer_list *timer) =20 return ret; } + +/** + * timer_delete_sync - Deactivate a timer and wait for the handler to fini= sh. + * @timer: The timer to be deactivated + * + * Synchronization rules: Callers must prevent restarting of the timer, + * otherwise this function is meaningless. It must not be called from + * interrupt contexts unless the timer is an irqsafe one. The caller must + * not hold locks which would prevent completion of the timer's callback + * function. The timer's handler must not call add_timer_on(). Upon exit + * the timer is not queued and the handler is not running on any CPU. + * + * For !irqsafe timers, the caller must not hold locks that are held in + * interrupt context. Even if the lock has nothing to do with the timer in + * question. Here's why:: + * + * CPU0 CPU1 + * ---- ---- + * + * call_timer_fn(); + * base->running_timer =3D mytimer; + * spin_lock_irq(somelock); + * + * spin_lock(somelock); + * timer_delete_sync(mytimer); + * while (base->running_timer =3D=3D mytimer); + * + * Now timer_delete_sync() will never return and never release somelock. + * The interrupt on the other CPU is waiting to grab somelock but it has + * interrupted the softirq that CPU0 is waiting to finish. + * + * This function cannot guarantee that the timer is not rearmed again by + * some concurrent or preempting code, right after it dropped the base + * lock. If there is the possibility of a concurrent rearm then the return + * value of the function is meaningless. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending and deactivated + */ +int timer_delete_sync(struct timer_list *timer) +{ + return __timer_delete_sync(timer); +} EXPORT_SYMBOL(timer_delete_sync); =20 static void call_timer_fn(struct timer_list *timer, -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 DF99B3502B6 for ; Thu, 19 Feb 2026 17:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521244; cv=none; b=cz3A6deRvBAPF/iWIIlDtOBazjUk6ifWoVSaL7Dcj15N2R4BAX7sOsEPdv4Skg60CAKdaHXfVBMv/BRVDW/ZbAYzUFD3bSA06i1GyOAlj2kXQLRDZCA3R6NnYh9+/yOsrzzMyw594hkkhCYIa6gwJ2s7nHGPZyjRAGMMuUa8MoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521244; c=relaxed/simple; bh=7nNzz17kSCCmlWDu86ZhyMKFITWZeFxpgwAsgGFQJqQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H/fKFUm2D4JCdk6Lu616YNkCdLz8y/7zCXcqHyGcTrys61bNkW0EHsU8OuTKeALNXRYKa+53S5BTRQtpTwn5EpbfZyNTStjK8ADlOZs/CNExibpPvH00iF8Z3QvgWBvu7eLL9LJBPEo5GOpB+3XLEje7O+TeuhgnfqLufQ1r/Gc= 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=TtZGg5yr; arc=none smtp.client-ip=209.85.214.176 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="TtZGg5yr" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2a871c8b171so7127525ad.3 for ; Thu, 19 Feb 2026 09:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521242; x=1772126042; 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=x1WOyKHAoHX8FrQxrc3Dl9TiChr0cIqUNlYEGeUOx2A=; b=TtZGg5yrWFuXu5/GCzdSMMgCHVF7IQTkBxbkcAIG5TOTaC3wLAz5kSZTf4QcrJFM93 jfZGxzHgjH+bCOk6RSCmUlMmeyVH/kX6GkFCuBlO+x8HeSEhukWwQc6FFB4GCaOXvP/P qWuOImVoF45t0oQ/zl1hhADbzfDZyxXfzKyPLfOCsA2AoyKb6kq7akuYA/8EFGdiy28w mMQ7DuyXkxqgr1wrt9OMLNqA6gUM4VDNzPUyt/b+I6IaW1grdMOwToSng1pnHMnMLp+2 YmRKitnk2EWrMwib0SDFYE9IzS3ikUfWcZcmwBXCMPtitR0dNgw8MSGE6aUJoDAFYlOi o9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521242; x=1772126042; 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=x1WOyKHAoHX8FrQxrc3Dl9TiChr0cIqUNlYEGeUOx2A=; b=IpU5C76pug8V7wp1wZ3Rbjf8W2SaPaewL/WbZtkxH0eVYpI24y4LbTHBEV+okYHz/Z pRp38tU5+WdlsyRjipcl/BoIRJ2qT/pWTRHKDNqPCNxi/6UVM+PdNH3pb8jkqW1eowGa G9TBanLgQNGVClqPbcJMxlQjEFslo3j+vJvF9FHBPM713wS6MNXMK0dw0vb00VpeMud9 iyBshr0ga8d9fyf/HGs6hBsUVOCBft3gVy+BkQONSyxITm40CBoNYihOop04Rss4l+q7 rI97NP09kbQVWQ9M3OrQ/WuFA4VPrKMTeiMXMSnPrVvpz5/28p1A4rrbrSmXQ+9b2g8o NhPg== X-Forwarded-Encrypted: i=1; AJvYcCV/8WAE4QYFl8Ix8Gx1FogkxYM9LzEASl42cHRFXzYYrzSkJp/3WoBSAeRQB0wFCgCqZC33Fzqbv1xxopk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzzzh1EOHRjdn7bux7MYoMgt4KB/Z2vMvfpuTTsK/NUDwnP3L08 4Jll+cwULyFebBS6omkKdIEXKuk04tziDuFQPVbdXSLzHTmRFo+IIuZR X-Gm-Gg: AZuq6aJL5M0zUIKikF0nPOZg/pHddU8cNFakWghv4XnGMdC20Ewgp1jXvt78FXhhduu i+CS7iAt9fv1Hhl2PWuy6D7LaC3HZoSYIHqcp6pvdRVnZ+UXEyu36i/JzAU2muwlAavS1t0QqhP fG8RYikpbnobyrdYOgQGhRB8JDbUFxwc+bap1D3J/mR17ep2uD9AKWrj+IxYZa+KmbZxdfHZQ46 TxeD6ZtPLOSPSwa5uEya+XZiBdhtsXQ17kvSLrUJ4DnYjHCwHhKKa2ySbRw1m+3racNtlP023Io qK00rGiuNQLRxBrQxnulgVUQ+DY828fDkfaA62tlJEoVJV8UaenHEBQg9U4VJ7cu9PqNocqPtAQ Ej/EXUhZsl3VPGinqNr8BFCZFEQsHmAHDzlxNn5sjDoABZVWqFRw8rfBbPMSBWDZzWwLKY3k4oA EM2os0HY60ZTXQo3K91lq0icTh+m2kpYj/W6AOKqfnCAag/iMatQ== X-Received: by 2002:a17:903:32cd:b0:2a0:34ee:3725 with SMTP id d9443c01a7336-2ad50e9cad9mr58949655ad.14.1771521242253; Thu, 19 Feb 2026 09:14:02 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:14:01 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 11/15] timers: Add shutdown mechanism to the internal functions Date: Fri, 20 Feb 2026 02:13:06 +0900 Message-Id: <20260219171310.118170-12-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 0cc04e80458a822300b93f82ed861a513edde194 ] Tearing down timers which have circular dependencies to other functionality, e.g. workqueues, where the timer can schedule work and work can arm timers, is not trivial. In those cases it is desired to shutdown the timer in a way which prevents rearming of the timer. The mechanism to do so is to set timer->function to NULL and use this as an indicator for the timer arming functions to ignore the (re)arm request. Add a shutdown argument to the relevant internal functions which makes the actual deactivation code set timer->function to NULL which in turn prevents rearming of the timer. Co-developed-by: Steven Rostedt Signed-off-by: Steven Rostedt Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org Link: https://lore.kernel.org/r/20221123201625.253883224@linutronix.de Signed-off-by: Jeongjun Park --- kernel/time/timer.c | 62 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 0b76a2ab42e3..b46614e14da1 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1300,12 +1300,19 @@ EXPORT_SYMBOL_GPL(add_timer_on); /** * __timer_delete - Internal function: Deactivate a timer * @timer: The timer to be deactivated + * @shutdown: If true, this indicates that the timer is about to be + * shutdown permanently. + * + * If @shutdown is true then @timer->function is set to NULL under the + * timer base lock which prevents further rearming of the time. In that + * case any attempt to rearm @timer after this function returns will be + * silently ignored. * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -static int __timer_delete(struct timer_list *timer) +static int __timer_delete(struct timer_list *timer, bool shutdown) { struct timer_base *base; unsigned long flags; @@ -1313,9 +1320,22 @@ static int __timer_delete(struct timer_list *timer) =20 debug_assert_init(timer); =20 - if (timer_pending(timer)) { + /* + * If @shutdown is set then the lock has to be taken whether the + * timer is pending or not to protect against a concurrent rearm + * which might hit between the lockless pending check and the lock + * aquisition. By taking the lock it is ensured that such a newly + * enqueued timer is dequeued and cannot end up with + * timer->function =3D=3D NULL in the expiry code. + * + * If timer->function is currently executed, then this makes sure + * that the callback cannot requeue the timer. + */ + if (timer_pending(timer) || shutdown) { base =3D lock_timer_base(timer, &flags); ret =3D detach_if_pending(timer, base, true); + if (shutdown) + timer->function =3D NULL; raw_spin_unlock_irqrestore(&base->lock, flags); } =20 @@ -1338,20 +1358,31 @@ static int __timer_delete(struct timer_list *timer) */ int timer_delete(struct timer_list *timer) { - return __timer_delete(timer); + return __timer_delete(timer, false); } EXPORT_SYMBOL(timer_delete); =20 /** * __try_to_del_timer_sync - Internal function: Try to deactivate a timer * @timer: Timer to deactivate + * @shutdown: If true, this indicates that the timer is about to be + * shutdown permanently. + * + * If @shutdown is true then @timer->function is set to NULL under the + * timer base lock which prevents further rearming of the timer. Any + * attempt to rearm @timer after this function returns will be silently + * ignored. + * + * This function cannot guarantee that the timer cannot be rearmed + * right after dropping the base lock if @shutdown is false. That + * needs to be prevented by the calling code if necessary. * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated * * %-1 - The timer callback function is running on a different CPU */ -static int __try_to_del_timer_sync(struct timer_list *timer) +static int __try_to_del_timer_sync(struct timer_list *timer, bool shutdown) { struct timer_base *base; unsigned long flags; @@ -1363,6 +1394,8 @@ static int __try_to_del_timer_sync(struct timer_list = *timer) =20 if (base->running_timer !=3D timer) ret =3D detach_if_pending(timer, base, true); + if (shutdown) + timer->function =3D NULL; =20 raw_spin_unlock_irqrestore(&base->lock, flags); =20 @@ -1387,7 +1420,7 @@ static int __try_to_del_timer_sync(struct timer_list = *timer) */ int try_to_del_timer_sync(struct timer_list *timer) { - return __try_to_del_timer_sync(timer); + return __try_to_del_timer_sync(timer, false); } EXPORT_SYMBOL(try_to_del_timer_sync); =20 @@ -1468,12 +1501,25 @@ static inline void del_timer_wait_running(struct ti= mer_list *timer) { } * __timer_delete_sync - Internal function: Deactivate a timer and wait * for the handler to finish. * @timer: The timer to be deactivated + * @shutdown: If true, @timer->function will be set to NULL under the + * timer base lock which prevents rearming of @timer + * + * If @shutdown is not set the timer can be rearmed later. If the timer can + * be rearmed concurrently, i.e. after dropping the base lock then the + * return value is meaningless. + * + * If @shutdown is set then @timer->function is set to NULL under timer + * base lock which prevents rearming of the timer. Any attempt to rearm + * a shutdown timer is silently ignored. + * + * If the timer should be reused after shutdown it has to be initialized + * again. * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated */ -static int __timer_delete_sync(struct timer_list *timer) +static int __timer_delete_sync(struct timer_list *timer, bool shutdown) { int ret; =20 @@ -1503,7 +1549,7 @@ static int __timer_delete_sync(struct timer_list *tim= er) lockdep_assert_preemption_enabled(); =20 do { - ret =3D __try_to_del_timer_sync(timer); + ret =3D __try_to_del_timer_sync(timer, shutdown); =20 if (unlikely(ret < 0)) { del_timer_wait_running(timer); @@ -1555,7 +1601,7 @@ static int __timer_delete_sync(struct timer_list *tim= er) */ int timer_delete_sync(struct timer_list *timer) { - return __timer_delete_sync(timer); + return __timer_delete_sync(timer, false); } EXPORT_SYMBOL(timer_delete_sync); =20 -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 0CB2D3451CF for ; Thu, 19 Feb 2026 17:14:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521248; cv=none; b=idJznEc3RoD33BCvAAkLPvyW4pXMSrrTXWg/XeTfOSAJNGt6jCYxjUlZA1lr692wQqu2IUu3uRurJKLCcDk44P3aL0qDWIwUeim/ZQCkxOATb0y3LGfwt74F3aJchctbHfZbe9VFq+QNxIIXzz1Eg/cgd3HPLP+w0p28cQk7/Rk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521248; c=relaxed/simple; bh=J7+paRiPLaCD/c+KTz8seNjK8t39KhNj40mTnjX9HD0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GM266T1m7TfCNJ/rOfaIHqBU9fAj7KzTkKiTe1dB6IgBjU9eCPm0+c/6Zg7QUtrq6SMrdCXhzQpLCPfBCBmk0SKDdVlP2aRt+BDqtQJOp+QH0vJE/9nsDF5wOhImLrycK2wOgemPGjBedt43IJQlMomRq5q5HcE6p+oX6Jafr/8= 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=kgRX22We; arc=none smtp.client-ip=209.85.210.169 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="kgRX22We" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-8231061d234so934721b3a.1 for ; Thu, 19 Feb 2026 09:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521246; x=1772126046; 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=rkZJqZ3kQT2WglZ48UatqwsWbUOwu2gzPSjhRt06PHw=; b=kgRX22WeMszm0lbN6aVORu4ACNzYgkL2yG+In274D2/zZBMrVEj3yE0df0DvSHPNvc Es2U/vQ3tL0HP6BzLbd5NWPnmk7kcjNM1wCFU39WVQUZ+seMYw9NfO+sa2PdZAsdGn0b 6RNMJAvZQ33SzAEJo2JkiaUTHrA2bN2/UrEJ1+XwH3PjTfHqiG2NWRhcWnWIYG0qQtC2 csptSjwKBhh3yS6U9+gEeRNEf01dwf4r+S4wRad7lRYIRr8Fka7LECkZN7yiq41CjnlP wJOK2ACy1yHIG34Ycf7jvd2jHNg0rwkuXWvMj3OVOZH7xzhC1IYye3TZapvpjGs9Q59z giyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521246; x=1772126046; 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=rkZJqZ3kQT2WglZ48UatqwsWbUOwu2gzPSjhRt06PHw=; b=mIcpwxqH/406BZ1xHdsbrVLB3T/yIeFhPqUKGRZfJPGuK41xUvlQh3nZvAqadRP1+S Fc1lG+UZueiUV239OzPcc6Ie29lc0XZzazzpQXcteStVFstST9Tih4+O9IHlxswuWEZT mL5Zi3aW0MjgLws/l5evID5u3icgPqtTyv6prmmZbvyj74/cnCU3hv+q7DJLJ35jQMqm cbgIGMec4qa+EIoKSpOkd8eYRc3xmPs0JlTfgXf2QjJW4aHaFFEJOjqX91ZtyWl9/BC8 sed/dyIKyKHij+a8Nud8cn4Da+4VJdzrl9QLMNq98Sm72iIdmqsRFtNg5z2BdD1Ib/UA qgbw== X-Forwarded-Encrypted: i=1; AJvYcCUtKzRZyG/quAgd1cn5Ogy9YlhHn/CteKgZf7JYwpwmF23VLEDykE9UsHAMsf1fG1ONJ3DuqHtNIEK2aJM=@vger.kernel.org X-Gm-Message-State: AOJu0YxH0tIrUehxnnxVSttNTIKlLp0gt08E5OKbCvl3TyAPqbWij/E9 KQ+4bC6kiJuSijHxvtZ6t6UXbWz1Ke/QRnryspe607HFb5jwfHzn/qkm X-Gm-Gg: AZuq6aJybtkVCK+JjH14oMUHLxLlnTWR3HvMiw0QQ+KH4MznvKjy2YRhWv+gxiXidAt wpA/zJCjO4yoZCa+aAno4Zff9AnWWLToU442vO2ypP7fKyIkNSvrj2QHTpvnUhvx9r0p44tkIC5 O1pUyCel+AuhyDXHNKq47YCRj1MKimKg9WlUb5BA7B3p3w56UCmOqINycj7tLzWj5ZXDhFu2ZiE cGJ55NzjQy8azJc4oBznNRAmTQU57ghbB4gbyNJfH1ZmStMKb7c6Sz/m5VUZbGK6KvsBjR0SYjj yp4cmmlQOL+emmyL5jEmKJqhYNs/6SVsGcdYd5GfIq4Jkeyz6uDXbWZKkvYkqMf/13uib1myNOk Ivp+oZ4SKNm3X7ixHias6aX9lKEs0V6fnGEQOcD9oY2bQPIS0Z2ZYVBOlYVsijkpJoUKG+qVzpY 31PgProwaIrcQLwHN855w25IZrsMjpfybtmE5fgNRzBWysMYDK/w== X-Received: by 2002:a05:6a21:2982:b0:394:662e:89ab with SMTP id adf61e73a8af0-394fc24ddc9mr5454817637.23.1771521246359; Thu, 19 Feb 2026 09:14:06 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:14:05 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 12/15] timers: Provide timer_shutdown[_sync]() Date: Fri, 20 Feb 2026 02:13:07 +0900 Message-Id: <20260219171310.118170-13-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit f571faf6e443b6011ccb585d57866177af1f643c ] Tearing down timers which have circular dependencies to other functionality, e.g. workqueues, where the timer can schedule work and work can arm timers, is not trivial. In those cases it is desired to shutdown the timer in a way which prevents rearming of the timer. The mechanism to do so is to set timer->function to NULL and use this as an indicator for the timer arming functions to ignore the (re)arm request. Expose new interfaces for this: timer_shutdown_sync() and timer_shutdown(). timer_shutdown_sync() has the same functionality as timer_delete_sync() plus the NULL-ification of the timer function. timer_shutdown() has the same functionality as timer_delete() plus the NULL-ification of the timer function. In both cases the rearming of the timer is prevented by silently discarding rearm attempts due to timer->function being NULL. Co-developed-by: Steven Rostedt Signed-off-by: Steven Rostedt Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org Link: https://lore.kernel.org/r/20221123201625.314230270@linutronix.de Signed-off-by: Jeongjun Park --- include/linux/timer.h | 2 ++ kernel/time/timer.c | 66 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/include/linux/timer.h b/include/linux/timer.h index e338e173ce8b..9162f275819a 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -184,6 +184,8 @@ extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); extern int timer_delete_sync(struct timer_list *timer); extern int timer_delete(struct timer_list *timer); +extern int timer_shutdown_sync(struct timer_list *timer); +extern int timer_shutdown(struct timer_list *timer); =20 /** * del_timer_sync - Delete a pending timer and wait for a running callback diff --git a/kernel/time/timer.c b/kernel/time/timer.c index b46614e14da1..4f39025ac933 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1362,6 +1362,27 @@ int timer_delete(struct timer_list *timer) } EXPORT_SYMBOL(timer_delete); =20 +/** + * timer_shutdown - Deactivate a timer and prevent rearming + * @timer: The timer to be deactivated + * + * The function does not wait for an eventually running timer callback on a + * different CPU but it prevents rearming of the timer. Any attempt to arm + * @timer after this function returns will be silently ignored. + * + * This function is useful for teardown code and should only be used when + * timer_shutdown_sync() cannot be invoked due to locking or context const= raints. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending + */ +int timer_shutdown(struct timer_list *timer) +{ + return __timer_delete(timer, true); +} +EXPORT_SYMBOL_GPL(timer_shutdown); + /** * __try_to_del_timer_sync - Internal function: Try to deactivate a timer * @timer: Timer to deactivate @@ -1595,6 +1616,9 @@ static int __timer_delete_sync(struct timer_list *tim= er, bool shutdown) * lock. If there is the possibility of a concurrent rearm then the return * value of the function is meaningless. * + * If such a guarantee is needed, e.g. for teardown situations then use + * timer_shutdown_sync() instead. + * * Return: * * %0 - The timer was not pending * * %1 - The timer was pending and deactivated @@ -1605,6 +1629,48 @@ int timer_delete_sync(struct timer_list *timer) } EXPORT_SYMBOL(timer_delete_sync); =20 +/** + * timer_shutdown_sync - Shutdown a timer and prevent rearming + * @timer: The timer to be shutdown + * + * When the function returns it is guaranteed that: + * - @timer is not queued + * - The callback function of @timer is not running + * - @timer cannot be enqueued again. Any attempt to rearm + * @timer is silently ignored. + * + * See timer_delete_sync() for synchronization rules. + * + * This function is useful for final teardown of an infrastructure where + * the timer is subject to a circular dependency problem. + * + * A common pattern for this is a timer and a workqueue where the timer can + * schedule work and work can arm the timer. On shutdown the workqueue must + * be destroyed and the timer must be prevented from rearming. Unless the + * code has conditionals like 'if (mything->in_shutdown)' to prevent that + * there is no way to get this correct with timer_delete_sync(). + * + * timer_shutdown_sync() is solving the problem. The correct ordering of + * calls in this case is: + * + * timer_shutdown_sync(&mything->timer); + * workqueue_destroy(&mything->workqueue); + * + * After this 'mything' can be safely freed. + * + * This obviously implies that the timer is not required to be functional + * for the rest of the shutdown operation. + * + * Return: + * * %0 - The timer was not pending + * * %1 - The timer was pending + */ +int timer_shutdown_sync(struct timer_list *timer) +{ + return __timer_delete_sync(timer, true); +} +EXPORT_SYMBOL_GPL(timer_shutdown_sync); + static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *), unsigned long baseclk) -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) (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 27ED0352943 for ; Thu, 19 Feb 2026 17:14:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521253; cv=none; b=SChxu/YHf3F5sm1gk6bk8/fIQJRaPQywcVmnfokyAyCiJsekqh/XhGGEbi72rPUvMWXnlTAn9BAjcikrmLtnPmqzg5EUGw3GxLUq+tuaZN+YLdB+/KnQN2qGOdgOE33WUEDciepSeWzYoCGuY/kQqY1rT48yho2xgoP+vWfrgIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521253; c=relaxed/simple; bh=KahrOTGFxHDsPLdgeyQZNnXk2bivNdYNaTpq/NJnvcw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bElNNAVE4AUsljjwbYoy4+G9cl2ImtqCxA0iYdq1LS1KpR/yAtj9HWLezuos9ugpdcwghEeUisF3OVdy614YTgSL2JGSHhtimvNJ9AbBV5fGyx2d4yXzaO58q+N7u6VfAUQAHIO2MqSrZ+0e4HM2hoWMNTvFoJKQ0u8ZVGy4BnY= 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=H+y3nH+5; arc=none smtp.client-ip=209.85.215.195 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="H+y3nH+5" Received: by mail-pg1-f195.google.com with SMTP id 41be03b00d2f7-c70942441ebso732176a12.1 for ; Thu, 19 Feb 2026 09:14:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521250; x=1772126050; 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=+9Ys25lUX49p5aMZ9MF04Fc/6uWbxWTtkfKKvleWffc=; b=H+y3nH+5udxeJPaKUZRwmeUgCmqkm7YFHPnKJTNeDr3CfyNHftRhVT40mM/Petkfby JZUa9gBuCzTIEqAOkBue2YF9cPXtetwjNWQHnSKrtit/9mtFTjSTma2/ZwrqeZ5DW03c cOJ5LkbTZxAHG7UA0XvpzH3YSzmit8QsXOTyWxG8vpTX0j2QEX8jEsH4N0lsu+UVNt1K oFjhWbPktQv0rpIqayOEuhg93WaLjpJymoLlmVk8u3F66eBkFmfJRwDfdJbmWLBsdHJ/ fiijiIpW6wDG0bb4sPKc7n/WCEIb5rwoe7/yzt9FSqbqiX5xiKOCfcVHye4eM8+BpTsg Su4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521250; x=1772126050; 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=+9Ys25lUX49p5aMZ9MF04Fc/6uWbxWTtkfKKvleWffc=; b=PPGkW4GfodT5BBeAnnBMA1Xp62qCRiQK2PWok+O+Lmq0KFIa9QLAjs90kzGbO9lKJz JpTiAMWrtpCMrkV3OihcqWzHe9r0l53p1YGlCt676IbClZ0OA+ymZSBaOzht5jTtyYoc fFp0jyQlhxYB3+uG2wDQLI9XWgV1qILRcAeiSIH8o2ouCDrE5Ao1avYqy047q6lRSAp+ TuyM627vNQhbCtwCqyOJyRpXkGwXYg5hxuvx2//WQLOkCmK+z5LJAgZCIdlD3GnOYPxn +ru9+GeKkVXRMQkVof2/HOKO2ya1TqC9ZZ1gamRaxb9rMXNn7wmsxz9X2S0N5vjOfjSA cI3A== X-Forwarded-Encrypted: i=1; AJvYcCWuHx5+y2/qICWhCTgnhvW14DfdG8Ku+CLC6/r0jhFsk7ASKwXRfVnGEJ9iGYk6k0TZ4G/PGaUEaRoI3RM=@vger.kernel.org X-Gm-Message-State: AOJu0YzdITj7kfNWzgEM3ZnA4gPCcTHnEWYnKIgxPBP6K5shGSVovI6O GpXFG9nkVs8+KE0ArdYIH8GyPDZLH001F6TZxP+mjc8YWdhKoNsH9m1Z X-Gm-Gg: AZuq6aJ2c379Pph4CIo9CXHeQQgDI6GNWdulzW1lex4eKFuOhukI0YGva2rJEM3uvfC n/QkFjB+LW8uol6B8WqwUe5rtfAFPIGTECs5aPxZcMLPhgrDVgLC2STGZdkR2WEk8JOk0xfuehc UHXOw0qqQ7wGKpy6Xv7/QN9XkLBYf0MDKtrIubOHVFpjEDIhXBePVcwITFj/01e6Sppw2kvMmWv kw9/zJcHFQz+ti+Yvi1W4hxu83JSr5sOfqcU/M+tXEHmwL1DA9bMOaAoSf6QK3kAJwxpWC0gKCS BCZ+Ssea03NkQner1ZFuCEeVJAlLo4jfKM+9Tj/y0KxZmFNbSTWZP01FZ8vKBWLpSmKqCjNOFM2 9L2VljS77aipQm7LeksXnb1sHZ8i7jknk3djBZGLp0wTtcpPPepQD+/iC8z86hx5bu9BZGxUezK 8wNECve2f2EOi9EriyH+JBUyRoDbsPBB98pVN2BvdwwpfnMRAr2Q== X-Received: by 2002:a05:6a21:7785:b0:395:1869:f63c with SMTP id adf61e73a8af0-3951869f8e7mr1782258637.18.1771521250511; Thu, 19 Feb 2026 09:14:10 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:14:09 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 13/15] timers: Update the documentation to reflect on the new timer_shutdown() API Date: Fri, 20 Feb 2026 02:13:08 +0900 Message-Id: <20260219171310.118170-14-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Docum= entation/RCU/Design/Requirements/Requirements.rst index ad2cc20131ec..e8af3dc3c95a 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 86ac2f4d24f7..4b8fd764aa7f 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -1016,6 +1016,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 handle this case. =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 -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 41C06352C5D for ; Thu, 19 Feb 2026 17:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521257; cv=none; b=ByD/EFSOZ2F/JKwJUh0+GQXAwrHQeIfsoNsJqXYVYr2SGcuVfdZW2pU0eGi3LRuY2CTA2/yfUPziTbzF8EUhjdJEb5ZlSBpxOkA+sZFGiq97vjsBn9gj+3tOOkV8dY0ALX8iQAsF5C0+vSGmWuFK55eCmZz7rYYdZprdY5o2kC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521257; c=relaxed/simple; bh=wtM3KGXEQuicJ8O+1w9NeLqs1Q3c/AYVobYXG6O4xkU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g8nQNBNN6nsAI9yPTVVQJgwUEyuo43Q3ZdprTxt5HFjFw4LWgKvIHszVoTNW6NzD1AC+xZq196HLoQMlMZyXMtj4t8mXPkbzJS5vJLS4fPeo0J9ZIJpsNeofWZFwPouQxfwY2nfAq0UzBt92LIjDuvbBgjYcSlrZIoBh0OoWw+k= 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=ZpEPYB/F; arc=none smtp.client-ip=209.85.214.175 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="ZpEPYB/F" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2a79ded11a2so7731255ad.3 for ; Thu, 19 Feb 2026 09:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521255; x=1772126055; 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=avVd2rCSlmy3mzSueRF3eaj+JsVil8OR/Q+bsjGDE3A=; b=ZpEPYB/F3ptJD1G/dWEZjed0xgEBHRqubbvxKeqMB8yXjHJNDc70RDIDfR/SH9bqKK TLQwWeazbfydFyIHc42gKGPP16FfhJis6WFaGAQX4iylSm0fY7VZ+6QxGvVUZxoOhqVz xUXuHWB58XOEIYeD4s2v7+zKVxsJbbeOp6T74/eHqqjLfv8weOytBW14YYnLvdXjhtQz vgjqRSeF1lZY4oEtkUA2bMBxnks+AerEFEBsFHLD7OvNCJ0Ypstr2V8rngP90Y92+zIS mKeIs8zxdlzCfvl/Aihdvda6rT9cFunclEoL3BMyzbqbEJj03bA5csUCM5iOyJij5bfQ EvLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521255; x=1772126055; 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=avVd2rCSlmy3mzSueRF3eaj+JsVil8OR/Q+bsjGDE3A=; b=FjIA2fBlLFbII6y3D6qnsE9sS40bwY3aGP2+/g+x9tUcVFf4ekiZE+Q2eQJcZ30I4f A6OnXMErdekGVzeN7IbhBPodaB2Vig/GnqW0JVF/SSStPeN5Lr1o12mB//SWLHGeFzvD OvLyzjrL5nRWlkgXPCW2Y5oxucnpAkzRzCFM2H/ky5/9xaRjvVrCiuBlqap+W9vjdkLA x9u/gHumrvm7M+5hps7F/n/tPLNPm5zwPCs39Nb2TsOn6Rj0W+nBXHt9NS826zIakGix YKVh0/yhfXz5zdQ06wDXTL+aPtXRez93bkJvprPCVpG4CdZo4IKGOwUcqhw5V33Eq4+H fudQ== X-Forwarded-Encrypted: i=1; AJvYcCXiSDyk2VhMKw5OoRUF9Cj03AFBc1u6ZqoFfK/T/C40eSCQniPWeLjGk7fBE3Qy3OwsJV+ubIUb6M1G4yU=@vger.kernel.org X-Gm-Message-State: AOJu0Yyf732sUS9S8mOMeY48qJlS3zf/+SRRD2ZXZLH1IrYNeZpQYmv7 A0V39UV8ml2vztpTa3BpTRuVTEaXcsxu6hPVuYVTVc7v31hXPGSPwgsH X-Gm-Gg: AZuq6aLLQGQhM8gq6gMY7KtGfkQ1jxddvYbRMO3/KN+WHbO3hnMCnB8/vOsmBtbZNFH tuEs865QIkm4vg/7AN4VKC8jp1+4QupE6FpH48ne6BjqNM8yxCEOXPsHvTUo1lgzCHmXFQLSIkX sRXhIZAQoheDBDzV/xVq45RCfDp1+7bVe3O1jW7oi1o5q7M2H9oShnJb683+DS92urkfxJkvy/5 s1/CF/vY81hcVgd7h5qpV8MBJd5HaqHxdiQstJoXqp5nmZf0XZdGNXM1RnFjwV8EXbFy2EUlaPC 1Ckokajp113d5cAvwZDF7atl+mLMi8QyLA4J6Mj/l04UKXjEoZP/1VjXBnPETbx5mXsOxGc09yc vFlxZAmdcDagHyCc+XSsNsYmciz2jV3DuCvdMUYtPx5Hzxh6Y210xBLYilFpGLYKZUpdTOpB4Wk Ro09YrKbODQg6K3Np4Luc3B3DhPRAoXwwjLFrUWp7wODQK8lndbw== X-Received: by 2002:a17:902:f54e:b0:2aa:f798:8c7f with SMTP id d9443c01a7336-2ad50fe0da1mr59033605ad.54.1771521254568; Thu, 19 Feb 2026 09:14:14 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:14:13 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev, Jacob Keller Subject: [PATCH 5.10.y 14/15] Bluetooth: hci_qca: Fix the teardown problem for real Date: Fri, 20 Feb 2026 02:13:09 +0900 Message-Id: <20260219171310.118170-15-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit e0d3da982c96aeddc1bbf1cf9469dbb9ebdca657 ] While discussing solutions for the teardown problem which results from circular dependencies between timers and workqueues, where timers schedule work from their timer callback and workqueues arm the timers from work items, it was discovered that the recent fix to the QCA code is incorrect. That commit fixes the obvious problem of using del_timer() instead of del_timer_sync() and reorders the teardown calls to destroy_workqueue(wq); del_timer_sync(t); This makes it less likely to explode, but it's still broken: destroy_workqueue(wq); /* After this point @wq cannot be touched anymore */ ---> timer expires queue_work(wq) <---- Results in a NULL pointer dereference deep in the work queue core code. del_timer_sync(t); Use the new timer_shutdown_sync() function to ensure that the timers are disarmed, no timer callbacks are running and the timers cannot be armed again. This restores the original teardown sequence: timer_shutdown_sync(t); destroy_workqueue(wq); which is now correct because the timer core silently ignores potential rearming attempts which can happen when destroy_workqueue() drains pending work before mopping up the workqueue. Fixes: 72ef98445aca ("Bluetooth: hci_qca: Use del_timer_sync() before freei= ng") Signed-off-by: Thomas Gleixner Tested-by: Guenter Roeck Reviewed-by: Jacob Keller Reviewed-by: Anna-Maria Behnsen Acked-by: Luiz Augusto von Dentz Link: https://lore.kernel.org/all/87iljhsftt.ffs@tglx Link: https://lore.kernel.org/r/20221123201625.435907114@linutronix.de Signed-off-by: Jeongjun Park --- drivers/bluetooth/hci_qca.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 66f416f59a8d..204ba1de624d 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -710,9 +710,15 @@ static int qca_close(struct hci_uart *hu) skb_queue_purge(&qca->tx_wait_q); skb_queue_purge(&qca->txq); skb_queue_purge(&qca->rx_memdump_q); + /* + * Shut the timers down so they can't be rearmed when + * destroy_workqueue() drains pending work which in turn might try + * to arm a timer. After shutdown rearm attempts are silently + * ignored by the timer core code. + */ + timer_shutdown_sync(&qca->tx_idle_timer); + timer_shutdown_sync(&qca->wake_retrans_timer); destroy_workqueue(qca->workqueue); - del_timer_sync(&qca->tx_idle_timer); - del_timer_sync(&qca->wake_retrans_timer); qca->hu =3D NULL; =20 kfree_skb(qca->rx_skb); -- From nobody Fri Apr 3 09:52:01 2026 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 2A64B353EC5 for ; Thu, 19 Feb 2026 17:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521260; cv=none; b=TZFrq/K7Qv6x8pweaxSKGOVOLNhPHU4socQfnAa7Z44ARBVMWhzFEBT3Y3bU6Gk2Lbo+/y/QjW7FZs19IpSxp6k7bcZRHmPbTjBIklVFqstQNDjrKSAKDOuz8OmRPu3sEiKiRb25maA9YHRtiYimC3AoYnxg1iA4Q0zcwJkYva0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771521260; c=relaxed/simple; bh=Hkj+3H7Z8a3D2Y8tRX2SbgMdeMF/kuGLJMd704mftHc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZNcc+FexSl54He2jm7r7S2wPEj8+pJgZE2oOoLb4kkMkULsYqQ3sMsZplOjUcO6L6BxqM/4qdQ9WgX1J672Djl9Xcdc4hcg80/VQDmEVtNpadC0lS2qk9I2TczCBHC7+jGco8lV7R4qRpJK5TqyR0xI9+VicYg4vm30Nm6vY5Hw= 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=OTSVdSNV; arc=none smtp.client-ip=209.85.210.180 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="OTSVdSNV" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-82318702afbso986232b3a.1 for ; Thu, 19 Feb 2026 09:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771521258; x=1772126058; 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=QKKfl8PT/GCaUO5UcTwQ5MiYDnn0Vh3veSo7jvr1Ic4=; b=OTSVdSNVuwBDyXp3D/0mYMOlcZ/IMRRwNikzboDFnxJPVV2zhMW7RKKZgUclNIQXDg 7jzvPDlKIG0kRzsfa8L3IwpnM7wnF1+XfsxKv2pAgjANZ9fv1qDdOdfUPT95aLQCorng ZSLElhkX3S6L28YVBEnvfkIg3Ynaba9hm34SBOrqeNcxQ1zlxrMfkxyiu4Vib9ydiIV0 +Dpz+Kyn2QHw0DeC1yjlpg3wtvrVEUbKlC0V9gmjVIccqXbqjL+2d5sV8ZuYpREEnEZO 5EMcqLTixUWA0UKXvNBQ7VS81ZCKuv/pS4dlgKcMqGCY1+/1AB4Ssj1HAZn8kKdodPPc 1i9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771521258; x=1772126058; 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=QKKfl8PT/GCaUO5UcTwQ5MiYDnn0Vh3veSo7jvr1Ic4=; b=iviF0TsrrVbix3yX1QE3Fb736nFgwiR4qI30PPfjHJvFAtmxg1Aq8zf8+iYb8mFBXg dIZ+/qn9BapytxZEa1uatEjoLeA8kxo2zHKk1ksVvWMq0c7NwycJgt3Z6aCpKpYES3qR EEzQa5lEG67Z/XIY5KpoRJ6h3bWBqOiN66I1dJOJ7qZNylRUjbdd6PCMUFc+rsIQrXk6 gqQdvCsr4lzUlUlGPZ0f5bJhCERgccsKlFk5LmZ927ieFguI1PiNQhgun376wlrvHAad zA111IBzTEsxVvLFp2nebfX7LMghcNysDOn1hX1N0VafWYyxXyjsRFD87NvuB5GP6AY+ JRsQ== X-Forwarded-Encrypted: i=1; AJvYcCVQm4sKDVcA2Kj6G0gGByBGtn86u/2kCeZ6SUcNMWWMrqswbP6Z+rkqBBAdwZTHAGCxO+kFuKPyJ9OIVb8=@vger.kernel.org X-Gm-Message-State: AOJu0YxA9BhwIzBSljhMhPRH//qwVaQ350/5L6wALOBkcjPUBinTxzvN vctMV9bBonEhh6sYrPsaDHIzm3i3wGHIJUWc1NtoNa/4aXUpq3MnNvww X-Gm-Gg: AZuq6aIxrkffremxPF/Hofc34INx/zMMQX2D8t5ylJGhY5g/sx0dmCce9YYQrYcXCOK 0HNC4EiCgxInP5bh4INLDwt24w5YplPv5OeO6FgODTwS79jacyYiPJ9y5Y6w2mR9ks72AvgVQNQ foxqYQ01GKfO5wYMG0ZrR+Xgm9Z2BRv99zLeLnLs94XQtjBqhwZjdYIBBnE9VvbVhDYhV5xn8LR 2aPvGzW55DVSyj51jddiDqrJ6fUocusSWj/Hhs94/uI2y7B6ZlTTLG+ASjwmDWeBCJ7Qmr9CEfz /0bJsOzhuKRjnOBIkx/dOBzzweodirVu8joEJzPjOEAQG+yxKIT0s5VtjnwFOhcak82IiQDL58l OrnPHhCGcTU3NzYcweKLMEMAbur/rZiAJjcgDW0nHOgy7m8U8C6qCa6BYIgcw4F45kG17LPDEin +ltcORgg3YmsSu4T9TLQU0y7Lw7M5nxjjnT8I3P9SXLUHsaMrU/g== X-Received: by 2002:a05:6a20:cf88:b0:361:28dd:a9ff with SMTP id adf61e73a8af0-39483a5a85dmr17158114637.38.1771521258512; Thu, 19 Feb 2026 09:14:18 -0800 (PST) Received: from name2965-Precision-7820-Tower.. ([121.185.236.165]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c6e532fa2e5sm15895002a12.26.2026.02.19.09.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Feb 2026 09:14:17 -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, zouyipeng@huawei.com, aha310510@gmail.com, linux-staging@lists.linux.dev Subject: [PATCH 5.10.y 15/15] timers: Fix NULL function pointer race in timer_shutdown_sync() Date: Fri, 20 Feb 2026 02:13:10 +0900 Message-Id: <20260219171310.118170-16-aha310510@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260219171310.118170-1-aha310510@gmail.com> References: <20260219171310.118170-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-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yipeng Zou [ Upstream commit 20739af07383e6eb1ec59dcd70b72ebfa9ac362c ] There is a race condition between timer_shutdown_sync() and timer expiration that can lead to hitting a WARN_ON in expire_timers(). The issue occurs when timer_shutdown_sync() clears the timer function to NULL while the timer is still running on another CPU. The race scenario looks like this: CPU0 CPU1 lock_timer_base() expire_timers() base->running_timer =3D timer; unlock_timer_base() [call_timer_fn enter] mod_timer() ... timer_shutdown_sync() lock_timer_base() // For now, will not detach the timer but only clear its function to NULL if (base->running_timer !=3D timer) ret =3D detach_if_pending(timer, base, true); if (shutdown) timer->function =3D NULL; unlock_timer_base() [call_timer_fn exit] lock_timer_base() base->running_timer =3D NULL; unlock_timer_base() ... // Now timer is pending while its function set to NULL. // next timer trigger expire_timers() WARN_ON_ONCE(!fn) // hit ... lock_timer_base() // Now timer will detach if (base->running_timer !=3D timer) ret =3D detach_if_pending(timer, base, true); if (shutdown) timer->function =3D NULL; unlock_timer_base() The problem is that timer_shutdown_sync() clears the timer function regardless of whether the timer is currently running. This can leave a pending timer with a NULL function pointer, which triggers the WARN_ON_ONCE(!fn) check in expire_timers(). Fix this by only clearing the timer function when actually detaching the timer. If the timer is running, leave the function pointer intact, which is safe because the timer will be properly detached when it finishes running. Fixes: 0cc04e80458a ("timers: Add shutdown mechanism to the internal functi= ons") Signed-off-by: Yipeng Zou Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20251122093942.301559-1-zouyipeng@huawei.com Signed-off-by: Greg Kroah-Hartman --- kernel/time/timer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1360,10 +1360,11 @@ static int __try_to_del_timer_sync(struc =20 base =3D lock_timer_base(timer, &flags); =20 - if (base->running_timer !=3D timer) + if (base->running_timer !=3D timer) { ret =3D detach_if_pending(timer, base, true); - if (shutdown) - timer->function =3D NULL; + if (shutdown) + timer->function =3D NULL; + } =20 raw_spin_unlock_irqrestore(&base->lock, flags); --