From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEFD5FA3740 for ; Thu, 27 Oct 2022 20:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236150AbiJ0U5G (ORCPT ); Thu, 27 Oct 2022 16:57:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236948AbiJ0U4r (ORCPT ); Thu, 27 Oct 2022 16:56:47 -0400 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA1FFAD998 for ; Thu, 27 Oct 2022 13:49:12 -0700 (PDT) Received: by mail-qv1-xf35.google.com with SMTP id e15so2549676qvo.4 for ; Thu, 27 Oct 2022 13:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=oSQGNRMEvUKfx6go8ULfblA0p1pLNMVNwBSwzmOAVIQ=; b=KiOYl6oYgVWmVt5yfOwXFbg2uqh6VMRSaNrvgwmuxSGJROVhF0gOA1n6rrYx8VRW6R VVZ63rmL9pY6OoKE9oUm6undU4L2Zw1Drahl+CZCyz+M4M06l6JRo9sMPUn+pAaD9PiI Dk7dgLCKUTOIMkWDgv7w/+2Fdi4C07XO5WJgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oSQGNRMEvUKfx6go8ULfblA0p1pLNMVNwBSwzmOAVIQ=; b=zZd3W1UlGl2+JerD+IkDtUPsV+lUL+Nikz7JWvVph35hAVR40xCOQXyFEA9odrlTTX i9TQ/ZhwqESzTlcVJ8Oz1hDi6430fPc7xjYRWYmurUd3VerJrDZRlv2pSzMVTCo2u6hd +cCSJQzcSc+umU69uZVGlQ5eAhryN0j+mN4yV2kSJNjHd1AFkZTa8IX6FI2kO22UldYs L90Lu+DJmdOYflkQ/AOytZQg4zuUlJYsdPFtWl9TtAIGKcoZ2V7l/a2Dx21LpBoyW+Ww EtvaE7kcYV5cXA6sLYAFtgjkWpZZH/ju6eFNZPi7NFHmeXiBNTsjKWRqJCSQQI74HEJV Fo0g== X-Gm-Message-State: ACrzQf0hKmKjZwas1QmSvq3pGI6MG2SOT4Xd/Bg/L9TKEfIpn9PE2cO5 36E62MQBahXnQ6ps2bS3MsiZQsDnJdLTOQ== X-Google-Smtp-Source: AMsMyM7b7Zl1KpyuskWCgwwAwgkbfT3pXO/6GVevcV8AevfRKoHCwpCC0yAwbHVwYEAUxgqOvrhQJQ== X-Received: by 2002:a0c:f04e:0:b0:4bb:61d9:d7b5 with SMTP id b14-20020a0cf04e000000b004bb61d9d7b5mr24218434qvl.10.1666903751852; Thu, 27 Oct 2022 13:49:11 -0700 (PDT) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com. [209.85.219.170]) by smtp.gmail.com with ESMTPSA id bs15-20020a05620a470f00b006ec09d7d357sm1658822qkb.47.2022.10.27.13.49.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Oct 2022 13:49:11 -0700 (PDT) Received: by mail-yb1-f170.google.com with SMTP id z192so3841049yba.0 for ; Thu, 27 Oct 2022 13:49:11 -0700 (PDT) X-Received: by 2002:a05:6902:124f:b0:66e:e3da:487e with SMTP id t15-20020a056902124f00b0066ee3da487emr49547816ybu.310.1666903751005; Thu, 27 Oct 2022 13:49:11 -0700 (PDT) MIME-Version: 1.0 References: <20221027150525.753064657@goodmis.org> <20221027150928.780676863@goodmis.org> <20221027155513.60b211e2@gandalf.local.home> <20221027163453.383bbf8e@gandalf.local.home> In-Reply-To: <20221027163453.383bbf8e@gandalf.local.home> From: Linus Torvalds Date: Thu, 27 Oct 2022 13:48:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH v2 19/31] timers: net: Use del_timer_shutdown() before freeing timer To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Stephen Boyd , Guenter Roeck , Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Mirko Lindner , Stephen Hemminger , Martin KaFai Lau , Alexei Starovoitov , Kuniyuki Iwashima , Pavel Begunkov , Menglong Dong , linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, bridge@lists.linux-foundation.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, lvs-devel@vger.kernel.org, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 27, 2022 at 1:34 PM Steven Rostedt wrote: > > What about del_timer_try_shutdown(), that if it removes the timer, it sets > the function to NULL (making it equivalent to a successful shutdown), > otherwise it does nothing. Allowing the the timer to be rearmed. Sounds sane to me and should work, but as mentioned, I think the networking people need to say "yeah" too. And maybe that function can also disallow any future re-arming even for the case where the timer couldn't be actively removed. So any *currently* active timer wouldn't be waited for (either because locking may make that a deadlock situation, or simply due to performance issues), but at least it would guarantee that no new timer activations can happen. Because I do like the whole notion of "timer has been shutdown and cannot be used as a timer any more without re-initializing it" being a real state - even for a timer that may be "currently in flight". So this all sounds very worthwhile to me, but I'm not surprised that we have code that then knows about all the subtleties of "del_timer() might still have a running timer" and actually take advantage of it (where "advantage" is likely more of a "deal with the complexities" rather than anything really positive ;) And those existing subtle users might want particular semantics to at least make said complexities easier. Linus