Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7452782rwb; Tue, 15 Nov 2022 12:31:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf4HyOaDq/Ep4unOmdS19dW9qzpJ3avm2668s0aoGme1BW6OBfj/YCyuxJX16LH5/B7Cz91P X-Received: by 2002:a17:90a:d805:b0:213:a95:88bd with SMTP id a5-20020a17090ad80500b002130a9588bdmr122762pjv.98.1668544283364; Tue, 15 Nov 2022 12:31:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668544283; cv=none; d=google.com; s=arc-20160816; b=BhKWWlbvZBJM3Gnz5CUa56kSBkxSjcyyWkIV1FIAIP2312uA7y+sgEFRAK6X23f7Bm Lj8xZyzsUJwM5NSCpJUKWhotedyZxnLAd5X7MIXU2L0k3BKudh9bak/5+7A6HHLNDaW3 QmYfW829+ptxW4dTPUVQpuUfvY0JaEsd/ciJ9tvB2UZKF0p+1FHYgV09nh1PoJByUSoK PE60UysXBTF+KkXw82hFK8eAMZhTDuwEZWxsszYqA+wBX7870j2EsifNA0qcOBGPwNWD spll/tEWER7YjdeyIDOnWsukVipg5+7Cluh1T0dE1eeP3bDojJW3DkEyukRWiK6qPOS7 p6iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=jmwINQ2aLPhomCKb2of90IzUc3f8LPfpTdJJ0tjAXWA=; b=nBWrlktzCQIVUCtV/QPLFvsTKz9/rs0aO15YQ5bkwr5yjZeHKYfgzwRjjUv0VAK5hm a6g5Jd4dy3VxJcKID1UEEdeSy2TuJYjl1AwSAhE0nPUYZCpBxNic1zz1WjvCFoVTHuSE k2d+aCvKS4tZba4uGbtoe7+3JH2sJ/JLaUxzO86taJP7cmYgb15kSVs6JbvlemL/ME+8 ojO9jVtC1iohWPfDtPqmZZHPQnMzaCG1zoq/ZfX17dvrwYwaNkZCV0tn4duAxueTiBMi iq57tEvVmqgJ/yMncAU9s2/uYdu4PMjbSR0E5RCFkwuAyyCdY7G2OEcUFsPBkOqbrh7l VupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=uYnmubxL; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fEWc8E3q; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n34-20020a635c62000000b00476d6927ba2si1136589pgm.659.2022.11.15.12.31.10; Tue, 15 Nov 2022 12:31:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=uYnmubxL; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=fEWc8E3q; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232713AbiKOU30 (ORCPT + 99 others); Tue, 15 Nov 2022 15:29:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232302AbiKOU3H (ORCPT ); Tue, 15 Nov 2022 15:29:07 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EAF8EE11; Tue, 15 Nov 2022 12:28:46 -0800 (PST) Message-ID: <20221115202117.381022914@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668544125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=jmwINQ2aLPhomCKb2of90IzUc3f8LPfpTdJJ0tjAXWA=; b=uYnmubxL74vpNPe1yY7N8Ixqeqx72Wk6fNXKkOehstD1Kst8YCLM99Ny385r8ft3qBjxcO awJytt30xm/q3wd5G5r4QR5ameAHC7AUYsr8zyiHkJeoiPageSFmLY9cZqKwim9gDTfjed JRidt/RofyASggWNqLjTwP+T5bmW+NsDvYb5Q8KKMhYNXagjHee5H4Y5e6RqXLGHBsGzWB wGzMion+vWBvhXNWYdknKCU46FfIQRVFuh4G7mWmMinmflf3/r9DuMm5gGfxMLdUnQOChA N1c8IpfX0rTUoKgc47SspELF8+AHdC48zjhWzMvyDhiMQBLVY8zKBSaykcu1nw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668544125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=jmwINQ2aLPhomCKb2of90IzUc3f8LPfpTdJJ0tjAXWA=; b=fEWc8E3qz1ewulSShtWTP1Ypkngwuu+VLMWXHStwK0sydhqhHyrAtn/QK21EYbxjzHdLWb Vf6wiNaxhCC7t7AQ== From: Thomas Gleixner To: LKML Cc: Linus Torvalds , Steven Rostedt , Anna-Maria Behnsen , Peter Zijlstra , Stephen Boyd , Guenter Roeck , Andrew Morton , Julia Lawall , Arnd Bergmann , Viresh Kumar , Marc Zyngier , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [patch 07/15] timers: Use del_timer_sync() even on UP References: <20221115195802.415956561@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 15 Nov 2022 21:28:44 +0100 (CET) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org del_timer_sync() is assumed to be pointless on uniprocessor systems and can be mapped to del_timer() because in theory del_timer() can never be invoked while the timer callback function is executed. This is not entirely true because del_timer() can be invoked from interrupt context and therefore hit in the middle of a running timer callback. Contrary to that del_timer_sync() is not allowed to be invoked from interrupt context unless the affected timer is marked with TIMER_IRQSAFE. del_timer_sync() has proper checks in place to detect such a situation. Give up on the UP optimization and make del_timer_sync() unconditionally available. Co-developed-by: Steven Rostedt Signed-off-by: Steven Rostedt Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org --- include/linux/timer.h | 7 +------ kernel/time/timer.c | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -183,12 +183,7 @@ extern int timer_reduce(struct timer_lis extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); - -#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT) - extern int del_timer_sync(struct timer_list *timer); -#else -# define del_timer_sync(t) del_timer(t) -#endif +extern int del_timer_sync(struct timer_list *timer); extern void init_timers(void); struct hrtimer; --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1387,7 +1387,6 @@ static inline void timer_sync_wait_runni static inline void del_timer_wait_running(struct timer_list *timer) { } #endif -#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT) /** * del_timer_sync - Deactivate a timer and wait for the handler to finish. * @timer: The timer to be deactivated @@ -1468,7 +1467,6 @@ int del_timer_sync(struct timer_list *ti return ret; } EXPORT_SYMBOL(del_timer_sync); -#endif static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *),