Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2963596rwi; Fri, 28 Oct 2022 13:47:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SaVSfs/u7IAOy694DfJNU6upk7EczmTGejJ0Oo1A3fqYnGulijw5Ew1bE8iQGMbii/RUX X-Received: by 2002:a17:907:3da2:b0:78d:51c4:5b80 with SMTP id he34-20020a1709073da200b0078d51c45b80mr1064777ejc.716.1666990062117; Fri, 28 Oct 2022 13:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666990062; cv=none; d=google.com; s=arc-20160816; b=1KblnkTCipRAKwhjEaKIxkq6McOoC3/8Ba1MU+kwlLU+hf8Hffp8OlSf/bYiwOHb9k 2giIZmuijYm3grY44nJebHhEF4G++t5uf9G+7oUUf04lKT1E22lBtyPlK61nyKe52Jz2 UFNInNlxdIPoSOIp9d2iT/CIwi5LISS+CC0wex6xElB0FHg0RmZyO7hqtLpPEVQO2FR+ Umanhi2q0LOP468iqDwWLlODjEd1s5W/bvIzPWDCvBigAqMddD6SLIHYC9OkUKFf6f+d lXmKzASAu8k3uKEBZcrJLFxaC/zAyC4WSwr/7qh+jxCrF5TJTp0BTvpidhhVw6ueuLqj F4xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=JQybFlrGopTficMncJjf7mginnqx0DwxK0eXKQYNKLs=; b=NmBa1fn0PpK7rsclj/YK5vC/qF0ub+UnTNyfSpld67KMErVYUfPBh5DK2MkeOOEX7i utmn/h5C1aACeW0msiYpimvnETfh1m6xRDjI3E3StZH3/NglN6nzK1FGD6fmKLYcBBYa GzXoMzuEoZaJ36AemRdwuQcmhGUlpecRvsp9BFF7kpsWq8jSMUWvpGlPhIFxf7uweZHV zaW/Ij0Sqh9bh1kqfW2kCW5oCgiB0+G0A8GikPWEK9KDEWvyIUq9Qu/PXptzt3y/CFKm iYiPQ1UoVSWyQiWhxqmDKw5x2942xGGj1mm5pcUHGxYmg9OMn/BAur+jRr4hVSA3+9CG Cwng== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs13-20020a1709073e8d00b00779e6c93108si4355145ejc.598.2022.10.28.13.47.13; Fri, 28 Oct 2022 13:47:42 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbiJ1UkS (ORCPT + 99 others); Fri, 28 Oct 2022 16:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbiJ1UkP (ORCPT ); Fri, 28 Oct 2022 16:40:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF0152F026; Fri, 28 Oct 2022 13:40:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8984CB8274E; Fri, 28 Oct 2022 20:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B699C433D6; Fri, 28 Oct 2022 20:40:08 +0000 (UTC) Date: Fri, 28 Oct 2022 16:40:24 -0400 From: Steven Rostedt To: Guenter Roeck Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Thomas Gleixner , Stephen Boyd , Greg Kroah-Hartman , Felipe Balbi , Johan Hovold , Alan Stern , Mathias Nyman , Kai-Heng Feng , Matthias Kaehlcke , Michael Grzeschik , Bhuvanesh Surachari , Dan Carpenter , linux-usb@vger.kernel.org, Tejun Heo , Lai Jiangshan , John Stultz Subject: Re: [RFC][PATCH v2 20/31] timers: usb: Use del_timer_shutdown() before freeing timer Message-ID: <20221028164024.2ab39cc1@gandalf.local.home> In-Reply-To: <20221028195959.GA1073367@roeck-us.net> References: <20221027150525.753064657@goodmis.org> <20221027150928.983388020@goodmis.org> <4e61935b-b06b-1f2d-6c2b-79bdfd569cd6@roeck-us.net> <20221028140129.040d9acc@gandalf.local.home> <20221028141007.05f5c490@gandalf.local.home> <20221028195959.GA1073367@roeck-us.net> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 On Fri, 28 Oct 2022 12:59:59 -0700 Guenter Roeck wrote: > > I'll test again with the following changes on top of your published > patch series. I hope this is the current status, but I may have lost > something. > > Looking into it ... deactivate_timer() doesn't do anything > and seems wrong. Did I miss something ? You mean debug_deactivate_timer() or debug_deactivate? > --- a/kernel/time/timer.c > +++ b/kernel/time/timer.c > > -static inline void debug_timer_deactivate(struct timer_list *timer) > +static inline void debug_timer_deactivate(struct timer_list *timer, bool free) > { > - if (timer->enabled) > - debug_object_deactivate(timer, &timer_debug_descr); > + switch (timer->enabled) { > + case TIMER_DEBUG_DISABLED: DISABLE is set before an activate happens (before it is ever armed). > + return; > + case TIMER_DEBUG_ENABLED: > + if (!free) > + return; This is called by del_timer{,_sync}() where free is false, or del_timer_shutdown() where free is true. We only want to deactivate when free is true. > + timer->enabled = TIMER_DEBUG_DISABLED; And we allow for initialization of a "freed" timer again. > + break; > + case TIMER_DEBUG_WORK: This is part of the delayed_work timers, were we keep the old behavior (del_timer() and del_timer_sync() both deactivate the timer. > + break; > + } > + debug_object_deactivate(timer, &timer_debug_descr); Here we call the debug object code to deactivate it. > } > > static inline void debug_timer_assert_init(struct timer_list *timer) > @@ -833,6 +854,7 @@ static inline void debug_init(struct timer_list *timer) > > static inline void debug_deactivate(struct timer_list *timer) > { > + debug_timer_deactivate(timer, false); This calls the above code. > trace_timer_cancel(timer); > } Or am I confused and you meant something else? -- Steve