Skip to contentSkip to conversation

Software suspend and recalc sigpending bug fix

PATCH In review Kirill Korotaev 2 participants 4 messages May 11, 2005 – May 12, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Software suspend and recalc sigpending bug fix

This patch fixes recalc_sigpending() to work correctly with tasks which are being freezed. The problem is that freeze_processes() sets PF_FREEZE and TIF_SIGPENDING flags on tasks, but recalc_sigpending() called from e.g. sys_rt_sigtimedwait or any other kernel place will clear TIF_SIGPENDING due to no pending signals queued and the tasks won't be freezed until it recieves a real signal or freezed_processes() fail due to timeout.

kernel/signal.c renamed from kernel/signal.c.freezesigrec +1 -0
@@ -212,6 +212,7 @@ static inline int has_pending_signals(si
 fastcall void recalc_sigpending_tsk(struct task_struct *t)
 {
 	if (t->signal->group_stop_count > 0 ||
+	    (t->flags&PF_FREEZE) ||
 	    PENDING(&t->pending, &t->blocked) ||
 	    PENDING(&t->signal->shared_pending, &t->blocked))
 		set_tsk_thread_flag(t, TIF_SIGPENDING);
#1 lore raw
Quoted 11 lines · Kirill Korotaev

This patch fixes recalc_sigpending() to work correctly with tasks which are being freezed. The problem is that freeze_processes() sets PF_FREEZE and TIF_SIGPENDING flags on tasks, but recalc_sigpending() called from e.g. sys_rt_sigtimedwait or any other kernel place will clear TIF_SIGPENDING due to no pending signals queued and the tasks won't be freezed until it recieves a real signal or freezed_processes() fail due to timeout.

This should fix our problems with mysqld, right? Yes, patch looks good (modulo missing whitespace around &)). I'll apply it to my tree. (Or andrew, if you prefer, just take it...
Pavel

Quoted 10 lines
kernel/signal.c renamed from kernel/signal.c.freezesigrec +1 -0
@@ -212,6 +212,7 @@ static inline int has_pending_signals(si
 fastcall void recalc_sigpending_tsk(struct task_struct *t)
 {
 	if (t->signal->group_stop_count > 0 ||
+	    (t->flags&PF_FREEZE) ||
 	    PENDING(&t->pending, &t->blocked) ||
 	    PENDING(&t->signal->shared_pending, &t->blocked))
 		set_tsk_thread_flag(t, TIF_SIGPENDING);
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
#2 lore raw
Quoted 9 lines
Quoted 9 lines

This patch fixes recalc_sigpending() to work correctly with tasks which are being freezed. The problem is that freeze_processes() sets PF_FREEZE and TIF_SIGPENDING flags on tasks, but recalc_sigpending() called from e.g. sys_rt_sigtimedwait or any other kernel place will clear TIF_SIGPENDING due to no pending signals queued and the tasks won't be freezed until it recieves a real signal or freezed_processes() fail due to timeout.

Quoted 7 lines
Quoted 2 lines

This should fix our problems with mysqld, right? Yes, patch looks good (modulo missing whitespace around &)). I'll apply it to my tree. (Or andrew, if you prefer, just take it...

Another cleanup idea in swsusp: it would be nice if all such checks for PF_FREEZE were wrapped in inline function is_task_freezing()/any_thing_else, to make freeze code disappear when CONFIG_PM/CONFIG_SOFTWARE_SUSPEND is off...

Kirill

Quoted 16 lines

Pavel

Quoted 10 lines
kernel/signal.c renamed from kernel/signal.c.freezesigrec +1 -0
@@ -212,6 +212,7 @@ static inline int has_pending_signals(si
 fastcall void recalc_sigpending_tsk(struct task_struct *t)
 {
 	if (t->signal->group_stop_count > 0 ||
+	    (t->flags&PF_FREEZE) ||
 	    PENDING(&t->pending, &t->blocked) ||
 	    PENDING(&t->signal->shared_pending, &t->blocked))
 		set_tsk_thread_flag(t, TIF_SIGPENDING);
#3 lore raw
Quoted 13 lines · Kirill Korotaev
Quoted 13 lines
Quoted 11 lines

This patch fixes recalc_sigpending() to work correctly with tasks which are being freezed. The problem is that freeze_processes() sets PF_FREEZE and TIF_SIGPENDING flags on tasks, but recalc_sigpending() called from e.g. sys_rt_sigtimedwait or any other kernel place will clear TIF_SIGPENDING due to no pending signals queued and the tasks won't be freezed until it recieves a real signal or freezed_processes() fail due to timeout.

Quoted 8 lines
Quoted 3 lines

This should fix our problems with mysqld, right? Yes, patch looks good (modulo missing whitespace around &)). I'll apply it to my tree. (Or andrew, if you prefer, just take it...

Another cleanup idea in swsusp: it would be nice if all such checks for PF_FREEZE were wrapped in inline function is_task_freezing()/any_thing_else, to make freeze code disappear when CONFIG_PM/CONFIG_SOFTWARE_SUSPEND is off...

S3 case needs this, too. Nicer solution would be to just define PF_FREEZE to 0 when it is not needed; but as most hooks are hidden in try_to_freeze(), anyway, I do not think this is worth it.
Pavel

Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.