Message ID | 20221122173648.560770928@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2353820wrr; Tue, 22 Nov 2022 09:48:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf5oIiMKFP2KcvlmkW2sTRg8Ohm9s2WLw2BvoQl6Y8wR6KNM/nX/L5pJM5Ms+0AgXzPZ6aiU X-Received: by 2002:a62:3306:0:b0:56b:8181:fe3e with SMTP id z6-20020a623306000000b0056b8181fe3emr26708792pfz.57.1669139312705; Tue, 22 Nov 2022 09:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669139312; cv=none; d=google.com; s=arc-20160816; b=0d1qKfQcAnqg4OT4VSIolUnqVhgLWFrXpevvR1n+9sk8PaZnwBxo5ywr6ff7DjuEqZ JxLlFnEK6NLcvCOySNUZMYXPKLPqIFip3nRbHyq9hwb1D0SWfWWvL/p+8YFRYsE/YGY9 BWz3N84Jt0KbzqcYBZaiRRlwahv0htToSGvB2tPrgWRUfjleTNozAJ0jkaa2c6ucK4c/ 6rwfmkbJCDyCTFgb/UdVPTDbG1INm2nu5ue9/pcauXLKR2mEMesKRMgpeEa9TegSwnL8 h2ZCi1+APlskiM8HkIJHjOz+jM7uphPLAuA046dIfXMzGoAqyqv6yrLohYbdtMuETiSo QtBA== 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=EMpM2Y9+AZ3Mkc+gVMKWk6eghahsVVjAJyXVQ6CR7oc=; b=AoqSiju/YbDzy+MpcCv7xuuAa4SEmFIvhCLJXpjK6QQH6VLLsxKFUAYJIPgoYraEj9 64wMlVyns77aBt3er4d8li+WT7iuIhOp38E/+XxfrDBAqi8+NlaOMi7tC7HLMgLwiiMu InwgHD48W3IrtXf9YonmW6ySrWQyVqFu5UJkx544FQUBh+nCwUHCxP3DY1vfbYR2b9ch 5fCX1Y2ysXv99xkrl4CCgo2xfUZ3fLpoh/bfI7vZuuAgKMeLKvPCnu5CtkDSTsNCuj7i z2ojZSbvIoEW65TF2VGuoqPoPRV4rE71AT6GRJqjljn1PHKsRIMd4h2p1itN+SZUXB6I KUhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=jOfQSKgi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il9-20020a17090b164900b00218cbdb0de5si3080816pjb.72.2022.11.22.09.48.19; Tue, 22 Nov 2022 09:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=jOfQSKgi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S234538AbiKVRps (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Tue, 22 Nov 2022 12:45:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234366AbiKVRp2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 22 Nov 2022 12:45:28 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A9E8D9F; Tue, 22 Nov 2022 09:44:59 -0800 (PST) Message-ID: <20221122173648.560770928@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669139097; 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=EMpM2Y9+AZ3Mkc+gVMKWk6eghahsVVjAJyXVQ6CR7oc=; b=jOfQSKgiI43Mey5tMtwdwq5HcuqumunlijHH9jFhIuNmnqNMa09hn7oPyucrb3Fb7Hy247 sBgZzHiczM2XHBKwQ/4ZYgkb4s+rZsXYUF3Hlb5PGQpHYZMAcnEqweoxl780oo2E/ncE12 TMxE0d0PhCN97Le4qcdR6JQdxsiQn14ANd53XDmF449szrYZKxUH2Pb664Sf0h4nlVhh0T iVDuKH07E3dFD9TiKVSrbxfy62RC2mLgBJFWStGvY+tVP7RsoeKUtLxXtgQdSFS8Eax6aP QOpN12SrPjoFzA6VWLkFtiCkDix5G133PH+yLVfd6KG+DRNqCUrt/OQ4vhBXxA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669139097; 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=EMpM2Y9+AZ3Mkc+gVMKWk6eghahsVVjAJyXVQ6CR7oc=; b=BWp8Zh//+2G8dMEG6BXVGDbM34z0AVD4jWkQgirweP06NXhIGCtYfEjeg8i9J72JprjMmF MOrJTm31/GbXkIBg== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: Linus Torvalds <torvalds@linuxfoundation.org>, Steven Rostedt <rostedt@goodmis.org>, Anna-Maria Behnsen <anna-maria@linutronix.de>, Peter Zijlstra <peterz@infradead.org>, Stephen Boyd <sboyd@kernel.org>, Guenter Roeck <linux@roeck-us.net>, Andrew Morton <akpm@linux-foundation.org>, Julia Lawall <Julia.Lawall@inria.fr>, Arnd Bergmann <arnd@arndb.de>, Viresh Kumar <viresh.kumar@linaro.org>, Marc Zyngier <maz@kernel.org>, Marcel Holtmann <marcel@holtmann.org>, Johan Hedberg <johan.hedberg@gmail.com>, Luiz Augusto von Dentz <luiz.dentz@gmail.com>, linux-bluetooth@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org Subject: [patch V2 08/17] timers: Use del_timer_sync() even on UP References: <20221122171312.191765396@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 22 Nov 2022 18:44:57 +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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750219423901875826?= X-GMAIL-MSGID: =?utf-8?q?1750219423901875826?= |
Series |
timers: Provide timer_shutdown[_sync]()
|
|
Commit Message
Thomas Gleixner
Nov. 22, 2022, 5:44 p.m. UTC
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 <rostedt@goodmis.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Guenter Roeck <linux@roeck-us.net> 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 @@ -1392,7 +1392,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 @@ -1473,7 +1472,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 *),