[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221028164024.2ab39cc1@gandalf.local.home>
Date: Fri, 28 Oct 2022 16:40:24 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...nel.org>,
Johan Hovold <johan@...nel.org>,
Alan Stern <stern@...land.harvard.edu>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>,
Matthias Kaehlcke <mka@...omium.org>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
Bhuvanesh Surachari <Bhuvanesh_Surachari@...tor.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
linux-usb@...r.kernel.org, Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
John Stultz <jstultz@...gle.com>
Subject: Re: [RFC][PATCH v2 20/31] timers: usb: Use del_timer_shutdown()
before freeing timer
On Fri, 28 Oct 2022 12:59:59 -0700
Guenter Roeck <linux@...ck-us.net> 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
Powered by blists - more mailing lists