Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7151294rwb; Wed, 23 Nov 2022 02:58:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ydi9NFtWsusmENnVn5nYX1gvG1mS1QIf2ae86yv0679gNqSKtg7XlWYcyVTilDfzyvmZW X-Received: by 2002:a05:6402:4289:b0:467:9864:9463 with SMTP id g9-20020a056402428900b0046798649463mr8191886edc.360.1669201099377; Wed, 23 Nov 2022 02:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669201099; cv=none; d=google.com; s=arc-20160816; b=n97R8HLYksVgV1wvtdD3OR+d9zKNfXpEc+L6CkprE8BmpkxHvoSPIl8oP92ZrCz3Nm voOjC2dgS+tjCXGik568/md6669lc7GDCd88UqASmBEFc67i36+FDBNz+mQFH/WJ8I6D yQ2NNJroaosuLYzx5O/HYM+tVzKKQHb8QOzINHkJEbjAbJdUAN9ci8sNrA+q7SSTQkd/ 5RaNzT+9Lsi5rNOVWa9E0bsI5Q6LHSUG+/C1kCG3/zFget990qjmaZPipyydREbjGw+P BPxjo3Gq8qoTaU+1EWBmKnFjeS8ychgoYSSAMoNFepHu/Co6LYkeeO0OqdW+3ykw9YDs qyXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:dkim-signature:dkim-signature:date; bh=bWx+syrVkp3Bs5TQK0zJVwfz+f2QVugtV7Vnnswr1DY=; b=uT8x6HkDFNbV2Ijw8vWf72iGG50rtnqgmLyfBY368ubXlLb0cnJqAnn397NQURaomK MytoIf4QHwSqEYTFac2JvWYtasDpUDpX1A2vwVND906CmuuMf5+p5jg90QmDQXO6q+Rs JVIk7+4Pv5ipvJcHdcqu01v5RY6QYvmVdY1IgIaegQoVLf2uB9euvmSQr21ireNJio8x +WkuNSCzX0erzt6NaMUHq/mf25HvPJY5V3jh8y/3KfzFdGW249P8J1rgJMLb6ncPKdAc x5bmDNXfbV0WndK8fiQBT49TW3WXc1PU4NjV3VzBBRCPG6x7tgizbdYcb28mw2wlSb1w pgnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KUZzCzQh; dkim=neutral (no key) header.i=@linutronix.de header.b=t4BSrZeM; 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 z4-20020a05640235c400b0045ddb2076casi14776904edc.177.2022.11.23.02.57.45; Wed, 23 Nov 2022 02:58:19 -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=KUZzCzQh; dkim=neutral (no key) header.i=@linutronix.de header.b=t4BSrZeM; 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 S236875AbiKWKwl (ORCPT + 99 others); Wed, 23 Nov 2022 05:52:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237682AbiKWKwC (ORCPT ); Wed, 23 Nov 2022 05:52:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77CDDA471; Wed, 23 Nov 2022 02:39:03 -0800 (PST) Date: Wed, 23 Nov 2022 11:39:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669199942; 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: in-reply-to:in-reply-to:references:references; bh=bWx+syrVkp3Bs5TQK0zJVwfz+f2QVugtV7Vnnswr1DY=; b=KUZzCzQheoKwx9UCNhqqaf0xx6QqkOGpsWdU0nxl2HNAmA9rDPZfgWpo13JlhWHFIZKU1o pxqYLnkC1PWOiRr8zbn0v7fWO+JkspD+ogXX6JE1waI8vy5hKkszeapiQyqw0IRAV8HBpA muGFRmCS/htW9dvZjntjFOsWA0XQFHVvJCPPFcJMjb5DJLVqJ7gdwnYFiuTWezRB7qU6rk hfI60jE3YWZ79eR+QmXw8Rjy6ANnzEbycSsj0BM3rHVRjw95lqkmbPIaozpHAlHP1Fk9H9 M+CSZxkD8y2Kvw++fVAnf7jXyRFNiDRSA/rsKmLMAbOPSqcf8a0NC0oTsxdYQw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669199942; 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: in-reply-to:in-reply-to:references:references; bh=bWx+syrVkp3Bs5TQK0zJVwfz+f2QVugtV7Vnnswr1DY=; b=t4BSrZeM86Ma19HnfSro2jQz0o+kyPq6OWYx9UbNR58mdx5CpR0IaxKKZZZiwJp69uznkV Sewrmksh9/wqZ1CQ== From: Anna-Maria Behnsen To: Thomas Gleixner cc: LKML , Linus Torvalds , Steven Rostedt , 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: Re: [patch V2 12/17] timers: Silently ignore timers with a NULL function In-Reply-To: <20221122173648.793640919@linutronix.de> Message-ID: <1f8f4b0-f9fe-c9c6-7620-862deff6b9d8@linutronix.de> References: <20221122171312.191765396@linutronix.de> <20221122173648.793640919@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 On Tue, 22 Nov 2022, Thomas Gleixner wrote: > 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 it 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 pathes > with checks for timer->function == NULL and 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. > > 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. > > Co-developed-by: Steven Rostedt > Signed-off-by: Steven Rostedt > Signed-off-by: Thomas Gleixner > Tested-by: Guenter Roeck > Link: https://lore.kernel.org/all/20220407161745.7d6754b3@gandalf.local.home > Link: https://lore.kernel.org/all/20221110064101.429013735@goodmis.org > --- > V2: Use continue instead of return and amend the return value docs (Steven) > --- > kernel/time/timer.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 55 insertions(+), 5 deletions(-) > > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > @@ -1202,6 +1230,9 @@ EXPORT_SYMBOL(timer_reduce); > * > * If @timer->expires is already in the past @timer will be queued to > * expire at the next timer tick. > + * > + * If @timer->function == NULL then the start operation is silently > + * discarded. > */ > void add_timer(struct timer_list *timer) > { Could you move the new paragraph after the paragraph where is is mentioned, that timer->function has to be set prior calling add_timer()? Thanks, Anna-Maria