From patchwork Thu Nov 24 14:16:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 25581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3426775wrr; Thu, 24 Nov 2022 06:22:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tqGN/xLpARGkJoeKWLomA9hEC0u4VCqaprgIZzTbj3f4oRCrtmsM4Oq6q8vQsyzu2dcwG X-Received: by 2002:a17:906:5a9a:b0:7bc:26e:a259 with SMTP id l26-20020a1709065a9a00b007bc026ea259mr523859ejq.445.1669299769763; Thu, 24 Nov 2022 06:22:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669299769; cv=none; d=google.com; s=arc-20160816; b=Xamvu5703FJ7yoaLJ+jL+2jBJNVBmWSG7KFhiLJwYU0B1pIR045JrE3Bnrh1gJhqOL C4wyHACPnOM9+Z43AVSN5pVRTAI/5IKQUPtTMmXcWHBA4/I7sX1fg1PUJBMJW7ro7tBi AGfeiaMpToQlkGDu73GgvIkgHxoIsbDtmyI1iDLe5SWglgmJNai56pFmlE550JtDGOTU UgSlD/ifMHVM1zfm1N5UbuIqndqg38s7BrP9wxHHIXIqllYxBtMqbwe0prPoK2GAwPR2 L1PeYNlVRjOQxgldZJ6SL7XzklelbiBT5V0fg4XYvBoehBS9kE6W9oMyi6H3OKtvzrA2 hqcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=A0MSRuoO4d2mr+Cc4AxhIXRdsBFwp0zTQjK68kdN02Q=; b=H+NkXfe/jwIl12KVXKw0ygeqYg4dtxQiSkONzHt82e3vALmIjGZ7ZITPQS0QjWFG1w Mytxm9GJ3Qb2XFr/XO5S/6GpKJBjC9xmA6CaSF0E4SLihNyyfiOUIO8kWk/04HiXoAqV laMtmIVWnmgYv6/dt3R5/8MOfmA24GtwAepMAp32IAzRGi9/dDy1G4octSgEax5J4VjP 5LYvvk9HW7CmTgztw7lO6NCSIWQUHF6TElo6BnpcsVYvMkj6plhGygiOV5tSdDjwIWfs y4go110pLrxe9WdQdwx9U6OaBG0xF+eccnwrfVA0n9owc1jlp63tlzfY4PDB9u1CPtXi Amlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=U8ZgAepo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="a6/rBcZo"; 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 dp19-20020a170906c15300b00781599eb7dbsi1144339ejc.573.2022.11.24.06.22.25; Thu, 24 Nov 2022 06:22:49 -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=U8ZgAepo; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="a6/rBcZo"; 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 S229850AbiKXOQq (ORCPT + 99 others); Thu, 24 Nov 2022 09:16:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiKXOQO (ORCPT ); Thu, 24 Nov 2022 09:16:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4834EECCD3; Thu, 24 Nov 2022 06:16:13 -0800 (PST) Date: Thu, 24 Nov 2022 14:16:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669299372; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A0MSRuoO4d2mr+Cc4AxhIXRdsBFwp0zTQjK68kdN02Q=; b=U8ZgAepo25HA0Skmu+EsGuH95830Lo3t7C50o5/8LoS8W5B2Ndp4zyzT1qMSLw1RLYMJLW G+La49tZW42Z+uGPAQGKZURQvZuAU/ntm2Z6Tb3/PjPPWZffYJzoFivSnJFOb4anLwCr0u Wff1Gn+8laKbWUQeLlcQRaNtUZqzhfOBgJGcQj7n41wSmTH2DMzUQ9tBNjfZtKpG3tlrSy gRSp9Ki+0jHapu89c8zEwOXEY5gKt/u5OnzEZqXLWCrgpRvByeUUtZr2CUMAgOwLV59GO/ DhJAcKNZIcNBBIq9zvmaYYbEhbwdyX7G80eQc2Q5Yk2VuiPtjC/EuGg0TzKdEg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669299372; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A0MSRuoO4d2mr+Cc4AxhIXRdsBFwp0zTQjK68kdN02Q=; b=a6/rBcZohQ4t/v1DoSQ1os1aa7EwT9kuTVywNcmtsNHbI05Mb12jQQEa7wjOm9Xwa1n+8y 6bD39of6GvN5DnBg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Use del_timer_sync() even on UP Cc: Steven Rostedt , Thomas Gleixner , Guenter Roeck , Jacob Keller , "Anna-Maria Behnsen" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220407161745.7d6754b3@gandalf.local.home> References: <20220407161745.7d6754b3@gandalf.local.home> MIME-Version: 1.0 Message-ID: <166929937066.4906.2771893826103631893.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750387675024683908?= X-GMAIL-MSGID: =?utf-8?q?1750387675024683908?= The following commit has been merged into the timers/core branch of tip: Commit-ID: 168f6b6ffbeec0b9333f3582e4cf637300858db5 Gitweb: https://git.kernel.org/tip/168f6b6ffbeec0b9333f3582e4cf637300858db5 Author: Thomas Gleixner AuthorDate: Wed, 23 Nov 2022 21:18:42 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 24 Nov 2022 15:09:11 +01:00 timers: Use del_timer_sync() even on UP 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 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/20221123201624.888306160@linutronix.de --- include/linux/timer.h | 7 +------ kernel/time/timer.c | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/include/linux/timer.h b/include/linux/timer.h index ea35d00..31b8b60 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -183,12 +183,7 @@ extern int timer_reduce(struct timer_list *timer, unsigned long expires); 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; diff --git a/kernel/time/timer.c b/kernel/time/timer.c index ea0150c..550f0df 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1396,7 +1396,6 @@ static inline void timer_sync_wait_running(struct timer_base *base) { } 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 @@ -1477,7 +1476,6 @@ int del_timer_sync(struct timer_list *timer) return ret; } EXPORT_SYMBOL(del_timer_sync); -#endif static void call_timer_fn(struct timer_list *timer, void (*fn)(struct timer_list *),