public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Software suspend and recalc sigpending bug fix
@ 2005-05-11 15:20 Kirill Korotaev
  2005-05-11 18:04 ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Korotaev @ 2005-05-11 15:20 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds, linux-kernel, pavel, pavel

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

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.

Signed-Off-By: Kirill Korotaev <dev@sw.ru>
Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

[-- Attachment #2: diff-mainstream-freezesigrecalc-20050429 --]
[-- Type: text/plain, Size: 466 bytes --]

--- ./kernel/signal.c.freezesigrec	2005-05-10 16:10:40.000000000 +0400
+++ ./kernel/signal.c	2005-05-10 18:10:08.000000000 +0400
@@ -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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Software suspend and recalc sigpending bug fix
  2005-05-11 15:20 [PATCH] Software suspend and recalc sigpending bug fix Kirill Korotaev
@ 2005-05-11 18:04 ` Pavel Machek
  2005-05-12  6:43   ` Kirill Korotaev
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2005-05-11 18:04 UTC (permalink / raw)
  To: Kirill Korotaev, seife; +Cc: Andrew Morton, Linus Torvalds, linux-kernel

On St 11-05-05 19:20:47, Kirill Korotaev wrote:
> 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.
> 
> Signed-Off-By: Kirill Korotaev <dev@sw.ru>
> Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>

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

> --- ./kernel/signal.c.freezesigrec	2005-05-10 16:10:40.000000000 +0400
> +++ ./kernel/signal.c	2005-05-10 18:10:08.000000000 +0400
> @@ -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);


-- 
Boycott Kodak -- for their patent abuse against Java.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Software suspend and recalc sigpending bug fix
  2005-05-11 18:04 ` Pavel Machek
@ 2005-05-12  6:43   ` Kirill Korotaev
  2005-05-12  8:55     ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill Korotaev @ 2005-05-12  6:43 UTC (permalink / raw)
  To: Pavel Machek; +Cc: seife, Andrew Morton, linux-kernel

>>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.
>>
>>Signed-Off-By: Kirill Korotaev <dev@sw.ru>
>>Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> 
> 
> 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

> 								Pavel
> 
> 
>>--- ./kernel/signal.c.freezesigrec	2005-05-10 16:10:40.000000000 +0400
>>+++ ./kernel/signal.c	2005-05-10 18:10:08.000000000 +0400
>>@@ -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);
> 
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Software suspend and recalc sigpending bug fix
  2005-05-12  6:43   ` Kirill Korotaev
@ 2005-05-12  8:55     ` Pavel Machek
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2005-05-12  8:55 UTC (permalink / raw)
  To: Kirill Korotaev; +Cc: seife, Andrew Morton, linux-kernel

On Čt 12-05-05 10:43:51, Kirill Korotaev wrote:
> >>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.
> >>
> >>Signed-Off-By: Kirill Korotaev <dev@sw.ru>
> >>Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> >
> >
> >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
-- 
Boycott Kodak -- for their patent abuse against Java.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-12  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 15:20 [PATCH] Software suspend and recalc sigpending bug fix Kirill Korotaev
2005-05-11 18:04 ` Pavel Machek
2005-05-12  6:43   ` Kirill Korotaev
2005-05-12  8:55     ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox