* [patch 0/2] workqueue: Add proper debugobjects support for delayed_work on stack @ 2014-03-23 14:20 Thomas Gleixner 2014-03-23 14:20 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Thomas Gleixner 2014-03-23 14:20 ` [patch 2/2] x86: hpet: Use proper destructor for delayed work Thomas Gleixner 0 siblings, 2 replies; 6+ messages in thread From: Thomas Gleixner @ 2014-03-23 14:20 UTC (permalink / raw) To: LKML; +Cc: Vince Weaver While trying to decode Vince mystery crash I noticed, that we have a initializer for delayed work on stack but no destructor. The only user in tree got it wrong, which leaks a tracking object for the work itself. Provide destroy_delayed_work_on_stack() and make hpet use it. Thanks, tglx ^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() 2014-03-23 14:20 [patch 0/2] workqueue: Add proper debugobjects support for delayed_work on stack Thomas Gleixner @ 2014-03-23 14:20 ` Thomas Gleixner 2014-03-24 12:51 ` Tejun Heo 2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner 2014-03-23 14:20 ` [patch 2/2] x86: hpet: Use proper destructor for delayed work Thomas Gleixner 1 sibling, 2 replies; 6+ messages in thread From: Thomas Gleixner @ 2014-03-23 14:20 UTC (permalink / raw) To: LKML; +Cc: Vince Weaver, Tejun Heo [-- Attachment #1: workqueue-add-destroy-delayed-work-on-stack.patch --] [-- Type: text/plain, Size: 1954 bytes --] If a delayed or deferrable work is on stack we need to tell debug objects that we are destroying the timer and the work. Otherwise we leak the tracking object. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Tejun Heo <tj@kernel.org> --- include/linux/workqueue.h | 2 ++ kernel/workqueue.c | 7 +++++++ 2 files changed, 9 insertions(+) Index: tip/include/linux/workqueue.h =================================================================== --- tip.orig/include/linux/workqueue.h +++ tip/include/linux/workqueue.h @@ -191,6 +191,7 @@ struct execute_work { #ifdef CONFIG_DEBUG_OBJECTS_WORK extern void __init_work(struct work_struct *work, int onstack); extern void destroy_work_on_stack(struct work_struct *work); +extern void destroy_delayed_work_on_stack(struct delayed_work *work); static inline unsigned int work_static(struct work_struct *work) { return *work_data_bits(work) & WORK_STRUCT_STATIC; @@ -198,6 +199,7 @@ static inline unsigned int work_static(s #else static inline void __init_work(struct work_struct *work, int onstack) { } static inline void destroy_work_on_stack(struct work_struct *work) { } +static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { } static inline unsigned int work_static(struct work_struct *work) { return 0; } #endif Index: tip/kernel/workqueue.c =================================================================== --- tip.orig/kernel/workqueue.c +++ tip/kernel/workqueue.c @@ -516,6 +516,13 @@ void destroy_work_on_stack(struct work_s } EXPORT_SYMBOL_GPL(destroy_work_on_stack); +void destroy_delayed_work_on_stack(struct delayed_work *work) +{ + destroy_timer_on_stack(&work->timer); + debug_object_free(&work->work, &work_debug_descr); +} +EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack); + #else static inline void debug_work_activate(struct work_struct *work) { } static inline void debug_work_deactivate(struct work_struct *work) { } ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() 2014-03-23 14:20 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Thomas Gleixner @ 2014-03-24 12:51 ` Tejun Heo 2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner 1 sibling, 0 replies; 6+ messages in thread From: Tejun Heo @ 2014-03-24 12:51 UTC (permalink / raw) To: Thomas Gleixner; +Cc: LKML, Vince Weaver On Sun, Mar 23, 2014 at 02:20:44PM -0000, Thomas Gleixner wrote: > If a delayed or deferrable work is on stack we need to tell debug > objects that we are destroying the timer and the work. Otherwise we > leak the tracking object. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Cc: Tejun Heo <tj@kernel.org> Acked-by: Tejun Heo <tj@kernel.org> How do you want to route this? If it's better to route it with the next patch, please feel free to do so. Thanks. -- tejun ^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:timers/core] workqueue: Provide destroy_delayed_work_on_stack() 2014-03-23 14:20 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Thomas Gleixner 2014-03-24 12:51 ` Tejun Heo @ 2014-03-25 16:37 ` tip-bot for Thomas Gleixner 1 sibling, 0 replies; 6+ messages in thread From: tip-bot for Thomas Gleixner @ 2014-03-25 16:37 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, vincent.weaver, tj, tglx Commit-ID: ea2e64f280d2a34a8ed9ae3d783cd770d14b70ec Gitweb: http://git.kernel.org/tip/ea2e64f280d2a34a8ed9ae3d783cd770d14b70ec Author: Thomas Gleixner <tglx@linutronix.de> AuthorDate: Sun, 23 Mar 2014 14:20:44 +0000 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 25 Mar 2014 17:33:42 +0100 workqueue: Provide destroy_delayed_work_on_stack() If a delayed or deferrable work is on stack we need to tell debug objects that we are destroying the timer and the work. Otherwise we leak the tracking object. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Acked-by: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/20140323141939.911487677@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- include/linux/workqueue.h | 2 ++ kernel/workqueue.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 594521b..abdbe5a 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -191,6 +191,7 @@ struct execute_work { #ifdef CONFIG_DEBUG_OBJECTS_WORK extern void __init_work(struct work_struct *work, int onstack); extern void destroy_work_on_stack(struct work_struct *work); +extern void destroy_delayed_work_on_stack(struct delayed_work *work); static inline unsigned int work_static(struct work_struct *work) { return *work_data_bits(work) & WORK_STRUCT_STATIC; @@ -198,6 +199,7 @@ static inline unsigned int work_static(struct work_struct *work) #else static inline void __init_work(struct work_struct *work, int onstack) { } static inline void destroy_work_on_stack(struct work_struct *work) { } +static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { } static inline unsigned int work_static(struct work_struct *work) { return 0; } #endif diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 82ef9f3..5b690b5 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -516,6 +516,13 @@ void destroy_work_on_stack(struct work_struct *work) } EXPORT_SYMBOL_GPL(destroy_work_on_stack); +void destroy_delayed_work_on_stack(struct delayed_work *work) +{ + destroy_timer_on_stack(&work->timer); + debug_object_free(&work->work, &work_debug_descr); +} +EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack); + #else static inline void debug_work_activate(struct work_struct *work) { } static inline void debug_work_deactivate(struct work_struct *work) { } ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 2/2] x86: hpet: Use proper destructor for delayed work 2014-03-23 14:20 [patch 0/2] workqueue: Add proper debugobjects support for delayed_work on stack Thomas Gleixner 2014-03-23 14:20 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Thomas Gleixner @ 2014-03-23 14:20 ` Thomas Gleixner 2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner 1 sibling, 1 reply; 6+ messages in thread From: Thomas Gleixner @ 2014-03-23 14:20 UTC (permalink / raw) To: LKML; +Cc: Vince Weaver [-- Attachment #1: x86-hpet-use-destroy-delayed.patch --] [-- Type: text/plain, Size: 799 bytes --] destroy_timer_on_stack() is hardly the right thing for a delayed work. We leak a tracking object for the work itself when DEBUG_OBJECTS is enabled. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: x86@kernel.org --- arch/x86/kernel/hpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: tip/arch/x86/kernel/hpet.c =================================================================== --- tip.orig/arch/x86/kernel/hpet.c +++ tip/arch/x86/kernel/hpet.c @@ -699,7 +699,7 @@ static int hpet_cpuhp_notify(struct noti /* FIXME: add schedule_work_on() */ schedule_delayed_work_on(cpu, &work.work, 0); wait_for_completion(&work.complete); - destroy_timer_on_stack(&work.work.timer); + destroy_delayed_work_on_stack(&work.work); break; case CPU_DEAD: if (hdev) { ^ permalink raw reply [flat|nested] 6+ messages in thread
* [tip:timers/core] x86: hpet: Use proper destructor for delayed work 2014-03-23 14:20 ` [patch 2/2] x86: hpet: Use proper destructor for delayed work Thomas Gleixner @ 2014-03-25 16:37 ` tip-bot for Thomas Gleixner 0 siblings, 0 replies; 6+ messages in thread From: tip-bot for Thomas Gleixner @ 2014-03-25 16:37 UTC (permalink / raw) To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, vincent.weaver, tglx Commit-ID: b712c8dae05931a76b6c17a4254f403798e6caef Gitweb: http://git.kernel.org/tip/b712c8dae05931a76b6c17a4254f403798e6caef Author: Thomas Gleixner <tglx@linutronix.de> AuthorDate: Sun, 23 Mar 2014 14:20:45 +0000 Committer: Thomas Gleixner <tglx@linutronix.de> CommitDate: Tue, 25 Mar 2014 17:34:01 +0100 x86: hpet: Use proper destructor for delayed work destroy_timer_on_stack() is hardly the right thing for a delayed work. We leak a tracking object for the work itself when DEBUG_OBJECTS is enabled. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: x86@kernel.org Link: http://lkml.kernel.org/r/20140323141940.034005322@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/kernel/hpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index da85a8e..b91abfd 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -699,7 +699,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n, /* FIXME: add schedule_work_on() */ schedule_delayed_work_on(cpu, &work.work, 0); wait_for_completion(&work.complete); - destroy_timer_on_stack(&work.work.timer); + destroy_delayed_work_on_stack(&work.work); break; case CPU_DEAD: if (hdev) { ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-25 16:38 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-03-23 14:20 [patch 0/2] workqueue: Add proper debugobjects support for delayed_work on stack Thomas Gleixner 2014-03-23 14:20 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Thomas Gleixner 2014-03-24 12:51 ` Tejun Heo 2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner 2014-03-23 14:20 ` [patch 2/2] x86: hpet: Use proper destructor for delayed work Thomas Gleixner 2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.