All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-pm@osdl.org, Jiri Slaby <jirislaby@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: swsusp regression
Date: Tue, 04 Jul 2006 12:25:03 +0159	[thread overview]
Message-ID: <44AA4216.4040407@gmail.com> (raw)
In-Reply-To: <20060703172455.d45edb0a.akpm@osdl.org>

Andrew Morton napsal(a):
> On Tue, 04 Jul 2006 01:50:09 +0159
> Jiri Slaby <jirislaby@gmail.com> wrote:
> 
>> Andrew Morton napsal(a):
>>> On Tue, 04 Jul 2006 00:53:02 +0159
>>> Jiri Slaby <jirislaby@gmail.com> wrote:
>>>
>>>> Jiri Slaby napsal(a):
>>>>> Hello,
>>>>>
>>>>> when suspending machine with hyperthreading, only Freezing cpus appears and then
>>>> Note: suspending to disk; done by:
>>>> echo reboot > /sys/power/disk
>>>> echo disk > /sys/power/state
>>>>
>>>>> it loops somewhere. I tried to catch some more info by pressing sysrq-p. Here
>>>>> are some captures:
>>>>> http://www.fi.muni.cz/~xslaby/sklad/03072006074.gif
>>>>> http://www.fi.muni.cz/~xslaby/sklad/03072006075.gif
>>>> One more from some previous kernels (cutted sysrq-t):
>>>> http://www.fi.muni.cz/~xslaby/sklad/22062006046.jpg
>>>>
>>> If you replace kernel/stop_machine.c with the version from 2.6.17, does it
>>> help?
>> Yup. It seems so.
>>
> 
> OK.  I don't see what the problem is - let's just revert it.

I dag into that deeply and:
struct task_struct *__stop_machine_run(int (*fn)(void *), void *data,
                                       unsigned int cpu)
{
[...]
        p = kthread_create(do_stop, &smdata, "kstopmachine");
        if (!IS_ERR(p)) {
                kthread_bind(p, cpu);
                wake_up_process(p);
                wait_for_completion(&smdata.done);
[...]
So here the thread is created and kernel waits for completion. OK.


static int do_stop(void *_smdata)
{
[...]
        /* We're done: you can kthread_stop us now */
        complete(&smdata->done);

This is called, some work is done, so call complete:
void fastcall complete(struct completion *x)
{
        unsigned long flags;

        spin_lock_irqsave(&x->wait.lock, flags);
        x->done++;
        __wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
                         1, 0, NULL);
        spin_unlock_irqrestore(&x->wait.lock, flags);
}
Nice, but spin_unlock_irqrestore never returns -- it loops in preempt_enable(),
why? Is TIF_NEED_RESCHED set all the time? Wouldn't be this the culprit?

regards,
-- 
Jiri Slaby        www.fi.muni.cz/~xslaby/
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E
<a href="http://www.fi.muni.cz/~xslaby/">Jiri Slaby</a>

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Jiri Slaby <jirislaby@gmail.com>,
	linux-kernel@vger.kernel.org, pavel@suse.cz, linux-pm@osdl.org
Subject: Re: swsusp regression
Date: Tue, 04 Jul 2006 12:25:03 +0159	[thread overview]
Message-ID: <44AA4216.4040407@gmail.com> (raw)
In-Reply-To: <20060703172455.d45edb0a.akpm@osdl.org>

Andrew Morton napsal(a):
> On Tue, 04 Jul 2006 01:50:09 +0159
> Jiri Slaby <jirislaby@gmail.com> wrote:
> 
>> Andrew Morton napsal(a):
>>> On Tue, 04 Jul 2006 00:53:02 +0159
>>> Jiri Slaby <jirislaby@gmail.com> wrote:
>>>
>>>> Jiri Slaby napsal(a):
>>>>> Hello,
>>>>>
>>>>> when suspending machine with hyperthreading, only Freezing cpus appears and then
>>>> Note: suspending to disk; done by:
>>>> echo reboot > /sys/power/disk
>>>> echo disk > /sys/power/state
>>>>
>>>>> it loops somewhere. I tried to catch some more info by pressing sysrq-p. Here
>>>>> are some captures:
>>>>> http://www.fi.muni.cz/~xslaby/sklad/03072006074.gif
>>>>> http://www.fi.muni.cz/~xslaby/sklad/03072006075.gif
>>>> One more from some previous kernels (cutted sysrq-t):
>>>> http://www.fi.muni.cz/~xslaby/sklad/22062006046.jpg
>>>>
>>> If you replace kernel/stop_machine.c with the version from 2.6.17, does it
>>> help?
>> Yup. It seems so.
>>
> 
> OK.  I don't see what the problem is - let's just revert it.

I dag into that deeply and:
struct task_struct *__stop_machine_run(int (*fn)(void *), void *data,
                                       unsigned int cpu)
{
[...]
        p = kthread_create(do_stop, &smdata, "kstopmachine");
        if (!IS_ERR(p)) {
                kthread_bind(p, cpu);
                wake_up_process(p);
                wait_for_completion(&smdata.done);
[...]
So here the thread is created and kernel waits for completion. OK.


static int do_stop(void *_smdata)
{
[...]
        /* We're done: you can kthread_stop us now */
        complete(&smdata->done);

This is called, some work is done, so call complete:
void fastcall complete(struct completion *x)
{
        unsigned long flags;

        spin_lock_irqsave(&x->wait.lock, flags);
        x->done++;
        __wake_up_common(&x->wait, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE,
                         1, 0, NULL);
        spin_unlock_irqrestore(&x->wait.lock, flags);
}
Nice, but spin_unlock_irqrestore never returns -- it loops in preempt_enable(),
why? Is TIF_NEED_RESCHED set all the time? Wouldn't be this the culprit?

regards,
-- 
Jiri Slaby        www.fi.muni.cz/~xslaby/
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E
<a href="http://www.fi.muni.cz/~xslaby/">Jiri Slaby</a>

  reply	other threads:[~2006-07-04 10:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03 22:45 swsusp regression Jiri Slaby
2006-07-03 22:45 ` Jiri Slaby
2006-07-03 22:49 ` Pavel Machek
2006-07-03 22:59   ` Jiri Slaby
2006-07-03 23:36   ` Jiri Slaby
2006-07-03 22:54 ` Jiri Slaby
2006-07-03 22:54   ` Jiri Slaby
2006-07-03 23:10   ` Andrew Morton
2006-07-03 23:10     ` Andrew Morton
2006-07-03 23:51     ` Jiri Slaby
2006-07-03 23:51       ` Jiri Slaby
2006-07-04  0:24       ` Andrew Morton
2006-07-04  0:24         ` Andrew Morton
2006-07-04 10:26         ` Jiri Slaby [this message]
2006-07-04 10:26           ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44AA4216.4040407@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.